Makefile revision 1.158
1# $NetBSD: Makefile,v 1.158 2012/11/15 19:49:12 jkunz Exp $ 2 3.include <bsd.own.mk> 4 5.if defined(HAVE_GCC) || defined(HAVE_PCC) 6TOOLCHAIN_BITS= gmake .WAIT 7.endif 8 9.if ${TOOLCHAIN_MISSING} == "no" 10.if defined(HAVE_GCC) 11.if ${HAVE_GCC} >= 45 12TOOLCHAIN_BITS+= gmp .WAIT 13TOOLCHAIN_BITS+= mpfr .WAIT 14TOOLCHAIN_BITS+= mpc .WAIT 15.endif 16.endif 17.endif 18 19.if ${TOOLCHAIN_MISSING} == "no" 20TOOLCHAIN_BITS+= binutils .WAIT 21.endif 22 23.if defined(HAVE_GCC) 24.if ${TOOLCHAIN_MISSING} == "no" 25TOOLCHAIN_BITS+= gcc 26. if ${MKCROSSGDB:Uno} != "no" 27TOOLCHAIN_BITS+= gdb 28. endif 29TOOLCHAIN_BITS+= .WAIT 30.endif 31.endif 32 33.if defined(HAVE_PCC) 34.if ${TOOLCHAIN_MISSING} == "no" 35TOOLCHAIN_BITS+= pcc 36.endif 37.endif 38 39.if ${TOOLCHAIN_MISSING} == "no" 40# XXX Eventually, we want to be able to build dbsym and mdsetimage 41# XXX if EXTERNAL_TOOLCHAIN is set. 42TOOLCHAIN_BITS+= dbsym mdsetimage 43.endif 44 45DTRACE_BITS= 46.if ${MKDTRACE} != "no" 47DTRACE_BITS+= .WAIT libelf 48DTRACE_BITS+= .WAIT libdwarf 49DTRACE_BITS+= .WAIT libctf 50DTRACE_BITS+= .WAIT ctfconvert ctfmerge 51.endif 52 53LINT_BITS= 54.if ${MKLINT} != "no" 55LINT_BITS= lint lint2 56.endif 57 58# Dependencies in SUBDIR below ordered to maximize parallel ability. 59SUBDIR= host-mkdep .WAIT compat .WAIT \ 60 binstall .WAIT mktemp .WAIT sed .WAIT \ 61 cap_mkdb crunchgen ctags genassym gencat hexdump join \ 62 ${LINT_BITS} \ 63 lorder makewhatis mkdep mtree nbperf .WAIT rpcgen tsort \ 64 uudecode m4 \ 65 .WAIT texinfo \ 66 .WAIT yacc \ 67 .WAIT awk \ 68 .WAIT tic \ 69 .WAIT lex \ 70 .WAIT pax \ 71 .WAIT ${TOOLCHAIN_BITS} \ 72 ${DTRACE_BITS} \ 73 asn1_compile cat cksum compile_et config db \ 74 file lint1 slc \ 75 makefs .WAIT menuc mkcsmapper mkesdb mklocale mknod msgc \ 76 .WAIT disklabel \ 77 .WAIT paxctl \ 78 .WAIT fdisk \ 79 .WAIT installboot \ 80 pwd_mkdb stat strfile sunlabel zic 81 82.if ${MKLLVM} != "no" 83# .WAIT between llvm-tblgen and llvm-clang-tblgen ensures install 84# rules works correctly 85SUBDIR+= \ 86 llvm .WAIT \ 87 llvm-lib/libLLVMSupport llvm-lib/libLLVMTableGen .WAIT \ 88 llvm-tblgen .WAIT llvm-clang-tblgen .WAIT \ 89 llvm-include .WAIT \ 90 llvm-lib .WAIT \ 91 llvm-clang 92.endif 93 94.if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no" 95. if ${MKGROFF} != "no" 96SUBDIR+= groff 97. endif 98SUBDIR+= mandoc 99.endif 100 101.if ${MKMAINTAINERTOOLS:Uno} != "no" 102SUBDIR+= autoconf .WAIT gettext 103.endif 104 105.if ${USE_PIGZGZIP} != "no" 106SUBDIR+= pigz 107.endif 108 109.if ${MACHINE} == "hp700" 110SUBDIR+= hp700-mkboot 111.endif 112 113.if ${MACHINE} == "ibmnws" 114SUBDIR+= ibmnws-ncdcs 115.endif 116 117.if ${MACHINE} == "macppc" 118SUBDIR+= macppc-fixcoff 119.endif 120 121.if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox") 122SUBDIR+= powerpc-mkbootimage 123.endif 124 125.if ${MACHINE_ARCH} == "m68k" 126SUBDIR+= m68k-elf2aout 127.endif 128 129.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \ 130 ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb") 131SUBDIR+= mips-elf2ecoff 132.endif 133 134.if (${MACHINE} == "sgimips") 135SUBDIR+= sgivol 136.endif 137 138.if ${MACHINE} == "acorn32" 139SUBDIR+= sparkcrc 140.endif 141 142.if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") 143SUBDIR+= fgen 144.endif 145 146.if ${MACHINE} == "amiga" 147SUBDIR+= amiga-elf2bb 148SUBDIR+= amiga-txlt 149.endif 150 151.if ${MACHINE} == "hp300" 152SUBDIR+= hp300-mkboot 153.endif 154 155.if ${MACHINE} == "evbarm" 156SUBDIR+= elftosb 157.endif 158 159.if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \ 160 ${MACHINE} == "evbppc" || ${MACHINE} == "sandpoint" 161SUBDIR+= mkubootimage 162.endif 163 164check_MKTOOLS: .PHONY .NOTMAIN 165.if ${MKTOOLS:Uyes} == "no" 166 @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and' 167 @echo '*** updating your host toolchain. This should be used only as a' 168 @echo '*** temporary workaround for toolchain problems, as it will result' 169 @echo '*** in version skew and build errors over time!' 170.endif 171 172.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # { 173realall realdepend install: check_MKTOOLS 174 175.for dir in ${SUBDIR:N.WAIT} 176all-${dir} depend-${dir} dependall-${dir} install-${dir}: 177 @true 178.endfor 179.endif # } 180 181.include <bsd.subdir.mk> 182.include <bsd.obj.mk> 183 184.if !defined(PREVIOUSTOOLDIR) 185. if exists(PREVIOUSTOOLDIR) 186PREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR 187. else 188PREVIOUSTOOLDIR= 189. endif 190.endif 191 192CLEANFILES+= PREVIOUSTOOLDIR 193 194realall realdepend: .MAKE 195.if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}" 196 @echo "*** WARNING: TOOLDIR has moved?" 197 @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'" 198 @echo "*** != TOOLDIR '${TOOLDIR}'" 199 @echo "*** Cleaning mis-matched tools" 200 rm -f PREVIOUSTOOLDIR 201 (cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir) 202.endif 203 echo ${TOOLDIR} >PREVIOUSTOOLDIR 204 205# For each .WAIT point, make sure the immediately preceding target is 206# installed before building anything after that point. 207# (dsl: which means that with: 'a b .WAIT c' the build of 'c' waits for the 208# install of 'b', but not the install of 'a'.) 209# 210# We use the "internal" targets and dependencies generated by <bsd.subdir.mk> 211# to achieve this. These targets look like: 212# subdir-all: all-dir1 [.WAIT] all-dir2 etc.. 213# subdir-install: install-dir1 [.WAIT] install-dir2 etc.. 214# and so on for each element in ${TARGETS}, with .WAIT sources inserted at 215# places corresponding to the .WAITs in our $SUBDIR variable. 216# 217# Also, since we're now mixing `install' with `all' and `depend' targets 218# an order relationship between those in each individual subdirectory 219# must be established. 220# 221_deps:= 222_prev:= 223 224.for d in ${SUBDIR} # { 225_this:= ${d} 226 227.if ${_this} == ".WAIT" # { 228 229# setup dependency to apply to all/depend targets in the next group 230_deps:= ${_deps} ${_prev:S/^/install-/} 231 232# if we're building *only* individual targets (i.e. "dependall-yacc"), 233# make sure prerequisite tools build before installing 234# XXX: dsl: this is likely to generate a dependency loop since there is 235# a .ORDER releation between the nodes as well. 236.if !make(all) && !make(dependall) && !make(install) 237install-${_prev}: dependall-${_prev} 238.endif 239 240.else # ${_this} != ".WAIT" # } { 241 242# order depend/all/install targets for ${d} subdir. 243.ORDER: depend-${d} all-${d} dependall-${d} install-${d} 244 245# prevent cleandir in real{all,depend} from interfering with subdir makes 246.ORDER: realdepend dependall-${d} 247.ORDER: realdepend depend-${d} 248.ORDER: realall all-${d} 249 250# make all/depend-${d} dependent on list of install targets 251depend-${d} all-${d} dependall-${d}: ${_deps} 252 253.endif # ${_this} != ".WAIT" # } 254 255# stash current name in case the next entry is .WAIT 256_prev:= ${d} 257.endfor # } 258 259cleandir: 260 rm -f ${CLEANFILES} 261