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