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