Home | History | Annotate | Line # | Download | only in tools
Makefile revision 1.191
      1 #	$NetBSD: Makefile,v 1.191 2017/06/07 10:38:33 skrll Exp $
      2 
      3 .include <bsd.own.mk>
      4 .include <bsd.endian.mk>
      5 
      6 # Make sure that the ordered build/install processing applies when using
      7 # plain make.
      8 .MAIN: build_install
      9 
     10 # TOOLDIR must be valid, unless MKTOOLS=no
     11 .if ${MKTOOLS:Uyes} != "no"
     12 .if "${TOOLDIR}" == ""
     13 .error "TOOLDIR is undefined or empty"
     14 .elif "${TOOLDIR:tW:M/*}" == ""
     15 .error "TOOLDIR is not an absolute path: ${TOOLDIR}"
     16 #.elif !exists(TOOLDIR) # XXX .exists fails for directories
     17 #.error "TOOLDIR does not exist: ${TOOLDIR}"
     18 .endif
     19 .endif # MKTOOLS != no
     20 
     21 # TOOLS_BUILDRUMP == yes builds only the subset of the tools required
     22 # for building rump kernels and the hypervisor.  It is typically used
     23 # when building rump kernels targeted for non-NetBSD systems (via
     24 # buildrump.sh), and should not be set for a regular "make build".
     25 TOOLS_BUILDRUMP?=no
     26 
     27 .if ${TOOLCHAIN_MISSING} == "no"
     28 . if defined(HAVE_GCC) && ${HAVE_GCC} > 0
     29 TOOLCHAIN_BITS= gmake .WAIT
     30 TOOLCHAIN_BITS+= gmp .WAIT
     31 TOOLCHAIN_BITS+= mpfr .WAIT
     32 TOOLCHAIN_BITS+= mpc .WAIT
     33 . endif
     34 .endif
     35 
     36 .if ${TOOLCHAIN_MISSING} == "no"
     37 TOOLCHAIN_BITS+= binutils .WAIT
     38 .endif
     39 
     40 .if defined(HAVE_GCC) && ${HAVE_GCC} > 0
     41 . if ${TOOLCHAIN_MISSING} == "no"
     42 TOOLCHAIN_BITS+= gcc
     43 .  if ${MKCROSSGDB:Uno} != "no" || make(obj)
     44 TOOLCHAIN_BITS+= gdb
     45 .  endif
     46 TOOLCHAIN_BITS+= .WAIT
     47 . endif
     48 .endif
     49 
     50 .if defined(HAVE_PCC)
     51 . if ${TOOLCHAIN_MISSING} == "no"
     52 TOOLCHAIN_BITS+= pcc
     53 . endif
     54 .endif
     55 
     56 .if ${TOOLCHAIN_MISSING} == "no"
     57 # XXX Eventually, we want to be able to build dbsym and mdsetimage
     58 # XXX if EXTERNAL_TOOLCHAIN is set.
     59 TOOLCHAIN_BITS+= dbsym mdsetimage
     60 .endif
     61 
     62 DTRACE_BITS=
     63 .if ${MKDTRACE} != "no" || ${MKCTF} != "no"
     64 DTRACE_BITS+= .WAIT libelf
     65 DTRACE_BITS+= .WAIT libdwarf
     66 DTRACE_BITS+= .WAIT libctf
     67 .endif
     68 .if ${MKCTF} != "no"
     69 DTRACE_BITS+= .WAIT ctfconvert ctfmerge
     70 .endif
     71 
     72 LINT_BITS=
     73 .if ${MKLINT} != "no"
     74 LINT_BITS= lint lint2
     75 .endif
     76 
     77 # All of host-mkdep, compat, and binstall are needed before anything
     78 # else.  Within this group, they must be built in a specific order, and
     79 # all of them must be built before any of them is installed.  They may
     80 # be installed in any order.  This can't be expressed using the .WAIT
     81 # notation inside the SUBDIR list.
     82 #
     83 # XXX .ORDER does not work when multiple targets are passed on the
     84 # make command line without "-j", so use dependencies in addition to .ORDER.
     85 #
     86 .ORDER: dependall-host-mkdep dependall-compat dependall-binstall
     87 .if make(dependall-host-mkdep) && make(dependall-compat)
     88 dependall-compat: dependall-host-mkdep
     89 .endif
     90 .if make(dependall-compat) && make(dependall-binstall)
     91 dependall-binstall: dependall-compat
     92 .endif
     93 
     94 # Dependencies in SUBDIR below ordered to maximize parallel ability.
     95 # See above for special treatment for host-mkdep, compat, and binstall.
     96 #
     97 SUBDIR=	host-mkdep compat binstall \
     98 	.WAIT mktemp .WAIT sed .WAIT genassym
     99 .if ${TOOLS_BUILDRUMP} == "no"
    100 SUBDIR+= cap_mkdb crunchgen ctags gencat hexdump \
    101 		${LINT_BITS} \
    102 		makewhatis mtree nbperf .WAIT uudecode
    103 .endif
    104 
    105 SUBDIR+= cat rpcgen join lorder m4 mkdep tsort .WAIT yacc .WAIT awk .WAIT lex
    106 
    107 .if ${TOOLS_BUILDRUMP} == "no"
    108 SUBDIR += .WAIT texinfo \
    109 	.WAIT tic \
    110 	.WAIT pax \
    111 	.WAIT ${TOOLCHAIN_BITS} \
    112 	${DTRACE_BITS} \
    113 		asn1_compile cksum compile_et db \
    114 		file lint1 slc \
    115 		makefs sortinfo \
    116 		.WAIT menuc mkcsmapper mkesdb mklocale mknod msgc \
    117 		.WAIT disklabel gpt \
    118 		.WAIT paxctl \
    119 		.WAIT fdisk \
    120 		.WAIT installboot \
    121 		pwd_mkdb strfile sunlabel vgrind zic
    122 .endif
    123 SUBDIR+= stat .WAIT config
    124 
    125 .if ${MKLLVM} != "no"
    126 SUBDIR+= \
    127 	llvm .WAIT \
    128 	llvm-lib/libLLVMDemangle llvm-lib/libLLVMSupport llvm-lib/libLLVMTableGen .WAIT \
    129 	llvm-tblgen llvm-clang-tblgen .WAIT \
    130 	llvm-include .WAIT \
    131 	llvm-lib .WAIT \
    132 	llvm-clang
    133 . if ${MKLLD} != "no"
    134 SUBDIR+=	llvm-lld
    135 . endif
    136 . if ${MKMCLINKER} != "no"
    137 SUBDIR+=	llvm-mcld
    138 . endif
    139 .endif
    140 
    141 .if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no"
    142 . if ${MKGROFF} != "no"
    143 SUBDIR+=	groff
    144 . endif
    145 SUBDIR+=	mandoc
    146 .endif
    147 
    148 .if ${TOOLS_BUILDRUMP} == "no"
    149 
    150 .if ${MKMAINTAINERTOOLS:Uno} != "no"
    151 SUBDIR+=	autoconf .WAIT gettext
    152 .endif
    153 
    154 .if ${USE_PIGZGZIP} != "no"
    155 SUBDIR+=	pigz
    156 .endif
    157 
    158 .if ${MACHINE} == "hppa"
    159 SUBDIR+=	hppa-mkboot
    160 .endif
    161 
    162 .if ${MACHINE} == "ibmnws"
    163 SUBDIR+=	ibmnws-ncdcs
    164 .endif
    165 
    166 .if ${MACHINE} == "macppc"
    167 SUBDIR+=	macppc-fixcoff
    168 .endif
    169 
    170 .if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox")
    171 SUBDIR+=	powerpc-mkbootimage
    172 .endif
    173 
    174 .if ${MACHINE_ARCH} == "m68k"
    175 SUBDIR+=	m68k-elf2aout
    176 .endif
    177 
    178 .if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
    179      ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb")
    180 SUBDIR+=	mips-elf2ecoff
    181 .endif
    182 
    183 .if (${MACHINE} == "sgimips")
    184 SUBDIR+=	sgivol
    185 .endif
    186 
    187 .if ${MACHINE} == "acorn32"
    188 SUBDIR+=	sparkcrc
    189 .endif
    190 
    191 .if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64")
    192 SUBDIR+=	fgen
    193 .endif
    194 
    195 .if ${MACHINE} == "amiga"
    196 SUBDIR+=	amiga-elf2bb
    197 SUBDIR+=	amiga-txlt
    198 .endif
    199 
    200 .if ${MACHINE} == "hp300"
    201 SUBDIR+=	hp300-mkboot
    202 .endif
    203 
    204 .if ${MACHINE} == "evbarm" \
    205     && ${MACHINE_CPU} == "arm" \
    206     && ${TARGET_ENDIANNESS} == "1234"
    207 SUBDIR+=	elftosb
    208 .endif
    209 
    210 .if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \
    211     ${MACHINE} == "evbppc" || ${MACHINE} == "sandpoint"
    212 SUBDIR+=	mkubootimage
    213 SUBDIR+=	libfdt .WAIT
    214 SUBDIR+=	dtc
    215 .endif
    216 
    217 .if ${MKX11} != "no"
    218 SUBDIR+=	makestrs
    219 SUBDIR+=	makekeys
    220 .endif
    221 
    222 SUBDIR+= cvslatest
    223 
    224 .endif # TOOLCHAIN_BUILDRUMP
    225 
    226 check_MKTOOLS: .PHONY .NOTMAIN
    227 .if ${MKTOOLS:Uyes} == "no"
    228 	@echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
    229 	@echo '*** updating your host toolchain.  This should be used only as a'
    230 	@echo '*** temporary workaround for toolchain problems, as it will result'
    231 	@echo '*** in version skew and build errors over time!'
    232 .endif
    233 
    234 .if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes"	# {
    235 SUBDIR= # empty
    236 realall realdepend install: check_MKTOOLS
    237 .endif							# }
    238 
    239 .include <bsd.subdir.mk>
    240 .include <bsd.buildinstall.mk>
    241 .include <bsd.obj.mk>
    242 
    243 .if !defined(PREVIOUSTOOLDIR)
    244 .  if exists(PREVIOUSTOOLDIR)
    245 PREVIOUSTOOLDIR!=	cat PREVIOUSTOOLDIR
    246 .  else
    247 PREVIOUSTOOLDIR=
    248 .  endif
    249 .endif
    250 
    251 CLEANFILES+=	PREVIOUSTOOLDIR
    252 
    253 realall realdepend: .MAKE
    254 .if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}"
    255 	@echo "*** WARNING: TOOLDIR has moved?"
    256 	@echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'"
    257 	@echo "***     !=  TOOLDIR '${TOOLDIR}'"
    258 	@echo "*** Cleaning mis-matched tools"
    259 	rm -f PREVIOUSTOOLDIR
    260 	(cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir)
    261 .endif
    262 	echo ${TOOLDIR} >PREVIOUSTOOLDIR
    263 
    264 cleandir:
    265 	rm -f ${CLEANFILES}
    266