Makefile revision 1.82
11.82Sabs# $NetBSD: Makefile,v 1.82 2004/06/08 21:44:46 abs Exp $ 21.1Stv 31.3Stv.include <bsd.own.mk> 41.3Stv 51.81Slukem.if ${TOOLCHAIN_MISSING} == "no" 61.77SmrgTOOLCHAIN_BITS= binutils .WAIT 71.70Smrg. if ${USE_TOOLS_TOOLCHAIN} != "yes" 81.77SmrgTOOLCHAIN_BITS+= gcc 91.74Scl. if ${MKCROSSGDB:Uno} != "no" 101.74SclTOOLCHAIN_BITS+= gdb 111.74Scl. endif 121.70Smrg. else 131.77SmrgTOOLCHAIN_BITS+= toolchain 141.70Smrg. endif 151.70SmrgTOOLCHAIN_BITS+= .WAIT dbsym mdsetimage 161.58Sthorpej# XXX Eventually, we want to be able to build dbsym and mdsetimage 171.58Sthorpej# XXX if EXTERNAL_TOOLCHAIN is set. 181.31Stv.endif 191.31Stv 201.16Stv# Dependencies in SUBDIR below ordered to maximize parallel ability. 211.50Slukem.if !defined(NOSUBDIR) # { 221.50Slukem 231.29StvSUBDIR= host-mkdep .WAIT compat .WAIT \ 241.57Schris binstall .WAIT mktemp .WAIT \ 251.62Sthorpej cap_mkdb crunchgen ctags gencat hexdump lint lint2 lorder \ 261.32Stv m4 makewhatis mkdep mtree rpcgen tsort uudecode \ 271.32Stv texinfo .WAIT \ 281.16Stv yacc .WAIT \ 291.16Stv lex .WAIT \ 301.32Stv ${TOOLCHAIN_BITS} \ 311.64Slukem asn1_compile cat cksum compile_et config db file installboot \ 321.75Slukem lint1 makefs menuc mkcsmapper mkesdb mklocale mknod msgc pax \ 331.68Slukem pwd_mkdb stat sunlabel zic 341.39Stv 351.39Stv.if ${MKMAN} != "no" 361.39StvSUBDIR+= groff 371.39Stv.endif 381.22Stv 391.22Stv.if ${MKMAINTAINERTOOLS:Uno} != "no" 401.38StvSUBDIR+= autoconf gettext 411.72Smatt.endif 421.72Smatt 431.72Smatt.if ${MACHINE} == ibmnws 441.72SmattSUBDIR+= ibmnws-ncdcs 451.79Smatt.endif 461.79Smatt 471.80Smatt.if ${MACHINE} == macppc 481.79SmattSUBDIR+= macppc-fixcoff 491.48Skleink.endif 501.48Skleink 511.48Skleink.if ${MACHINE} == prep 521.48SkleinkSUBDIR+= prep-mkbootimage 531.22Stv.endif 541.37Sgmcgarry 551.37Sgmcgarry.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb") 561.37SgmcgarrySUBDIR+= mips-elf2ecoff 571.76Ssekiya.endif 581.76Ssekiya 591.76Ssekiya.if (${MACHINE} == "sgimips") 601.76SsekiyaSUBDIR+= sgivol 611.51Sbjh21.endif 621.51Sbjh21 631.82Sabs.if ${MACHINE} == "acorn32" 641.82SabsSUBDIR+= sparkcrc 651.82Sabs.endif 661.82Sabs 671.51Sbjh21.if (${MACHINE} == "sparc" || ${MACHINE} == "sparc64") 681.51Sbjh21SUBDIR+= fgen 691.37Sgmcgarry.endif 701.37Sgmcgarry 711.50Slukem.endif # ! NOSUBDIR # } 721.17Stv 731.66Slukemcheck_MKTOOLS: .PHONY .NOTMAIN 741.19Sjmc.if ${MKTOOLS:Uyes} == "no" 751.17Stv @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and' 761.17Stv @echo '*** updating your host toolchain. This should be used only as a' 771.17Stv @echo '*** temporary workaround for toolchain problems, as it will result' 781.23Swiz @echo '*** in version skew and build errors over time!' 791.18Sjmc.endif 801.17Stv 811.66Slukem.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # { 821.67Slukemrealall realdepend install: check_MKTOOLS 831.66Slukem 841.17Stv.for dir in ${SUBDIR:N.WAIT} 851.17Stvall-${dir} depend-${dir} dependall-${dir} install-${dir}: 861.17Stv @true 871.17Stv.endfor 881.66Slukem.endif # } 891.1Stv 901.1Stv.include <bsd.subdir.mk> 911.11Stv.include <bsd.obj.mk> 921.16Stv 931.66Slukem.if exists(PREVIOUSTOOLDIR) 941.66SlukemPREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR 951.66Slukem.else 961.66SlukemPREVIOUSTOOLDIR= 971.66Slukem.endif 981.66Slukem 991.66SlukemCLEANFILES+= PREVIOUSTOOLDIR 1001.66Slukem 1011.67Slukemrealall realdepend: 1021.66Slukem.if (${PREVIOUSTOOLDIR} != ${TOOLDIR}) 1031.66Slukem @echo "*** WARNING: TOOLDIR has moved?" 1041.66Slukem @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'" 1051.66Slukem @echo "*** != TOOLDIR '${TOOLDIR}'" 1061.66Slukem @echo "*** Cleaning mis-matched tools" 1071.66Slukem rm -f PREVIOUSTOOLDIR 1081.78Slukem (cd ${.CURDIR} && ${MAKE} cleandir) 1091.66Slukem.endif 1101.66Slukem echo ${TOOLDIR} > PREVIOUSTOOLDIR 1111.66Slukem 1121.40Stv# For each .WAIT point, make sure the immediately preceding target is 1131.40Stv# installed before building anything after that point. 1141.36Spk# 1151.36Spk# We use the "internal" targets and dependencies generated by <bsd.subdir.mk> 1161.36Spk# to achieve this. These targets look like: 1171.36Spk# subdir-all: all-dir1 [.WAIT] all-dir2 etc.. 1181.36Spk# subdir-install: install-dir1 [.WAIT] install-dir2 etc.. 1191.36Spk# and so on for each element in ${TARGETS}, with .WAIT sources inserted at 1201.36Spk# places corresponding to the .WAITs in our $SUBDIR variable. 1211.36Spk# 1221.36Spk# Also, since we're now mixing `install' with `all' and `depend' targets 1231.36Spk# an order relationship between those in each individual subdirectory 1241.36Spk# must be established. 1251.36Spk# 1261.40Stv_deps:= 1271.40Stv_prev:= 1281.40Stv 1291.16Stv.for d in ${SUBDIR} 1301.16Stv_this:= ${d} 1311.40Stv 1321.16Stv.if ${_this} == ".WAIT" 1331.36Spk 1341.36Spk# setup dependency to apply to all/depend targets in the next group 1351.40Stv_deps:= ${_deps} ${_prev:S/^/install-/} 1361.40Stv 1371.40Stv# if we're building *only* individual targets (i.e. "dependall-yacc"), 1381.40Stv# make sure prerequisite tools build before installing 1391.40Stv.if !make(all) && !make(dependall) 1401.40Stvinstall-${_prev}: dependall-${_prev} 1411.40Stv.endif 1421.36Spk 1431.16Stv.else 1441.36Spk 1451.36Spk# order depend/all/install targets for ${d} subdir. Note the additional 1461.36Spk# .WAIT to achieve "closure" of the predecessor/successor relationships. 1471.36Spk.ORDER: depend-${d} all-${d} dependall-${d} .WAIT install-${d} 1481.40Stv 1491.40Stv# make all/depend-${d} dependent on list of install targets 1501.40Stvdepend-${d} all-${d} dependall-${d}: ${_deps} 1511.36Spk 1521.16Stv.endif 1531.40Stv 1541.40Stv# stash current name in case the next entry is .WAIT 1551.40Stv_prev:= ${d} 1561.16Stv.endfor 1571.69Stron 1581.69Stroncleandir: 1591.69Stron rm -f ${CLEANFILES} 160