Makefile revision 1.76
11.76Ssekiya# $NetBSD: Makefile,v 1.76 2003/11/08 05:02:33 sekiya Exp $ 21.1Stv 31.3Stv.include <bsd.own.mk> 41.3Stv 51.60Sthorpej.if ${TOOLCHAIN_MISSING} != "yes" 61.70Smrg. if ${USE_TOOLS_TOOLCHAIN} != "yes" 71.70SmrgTOOLCHAIN_BITS= binutils .WAIT gcc 81.74Scl. if ${MKCROSSGDB:Uno} != "no" 91.74SclTOOLCHAIN_BITS+= gdb 101.74Scl. endif 111.70Smrg. else 121.70SmrgTOOLCHAIN_BITS= toolchain 131.70Smrg. endif 141.70SmrgTOOLCHAIN_BITS+= .WAIT dbsym mdsetimage 151.58Sthorpej# XXX Eventually, we want to be able to build dbsym and mdsetimage 161.58Sthorpej# XXX if EXTERNAL_TOOLCHAIN is set. 171.31Stv.endif 181.31Stv 191.16Stv# Dependencies in SUBDIR below ordered to maximize parallel ability. 201.50Slukem.if !defined(NOSUBDIR) # { 211.50Slukem 221.29StvSUBDIR= host-mkdep .WAIT compat .WAIT \ 231.57Schris binstall .WAIT mktemp .WAIT \ 241.62Sthorpej cap_mkdb crunchgen ctags gencat hexdump lint lint2 lorder \ 251.32Stv m4 makewhatis mkdep mtree rpcgen tsort uudecode \ 261.32Stv texinfo .WAIT \ 271.16Stv yacc .WAIT \ 281.16Stv lex .WAIT \ 291.32Stv ${TOOLCHAIN_BITS} \ 301.64Slukem asn1_compile cat cksum compile_et config db file installboot \ 311.75Slukem lint1 makefs menuc mkcsmapper mkesdb mklocale mknod msgc pax \ 321.68Slukem pwd_mkdb stat sunlabel zic 331.39Stv 341.39Stv.if ${MKMAN} != "no" 351.39StvSUBDIR+= groff 361.39Stv.endif 371.22Stv 381.22Stv.if ${MKMAINTAINERTOOLS:Uno} != "no" 391.38StvSUBDIR+= autoconf gettext 401.72Smatt.endif 411.72Smatt 421.72Smatt.if ${MACHINE} == ibmnws 431.72SmattSUBDIR+= ibmnws-ncdcs 441.48Skleink.endif 451.48Skleink 461.48Skleink.if ${MACHINE} == prep 471.48SkleinkSUBDIR+= prep-mkbootimage 481.22Stv.endif 491.37Sgmcgarry 501.37Sgmcgarry.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb") 511.37SgmcgarrySUBDIR+= mips-elf2ecoff 521.76Ssekiya.endif 531.76Ssekiya 541.76Ssekiya.if (${MACHINE} == "sgimips") 551.76SsekiyaSUBDIR+= sgivol 561.51Sbjh21.endif 571.51Sbjh21 581.51Sbjh21.if (${MACHINE} == "sparc" || ${MACHINE} == "sparc64") 591.51Sbjh21SUBDIR+= fgen 601.37Sgmcgarry.endif 611.37Sgmcgarry 621.50Slukem.endif # ! NOSUBDIR # } 631.17Stv 641.66Slukemcheck_MKTOOLS: .PHONY .NOTMAIN 651.19Sjmc.if ${MKTOOLS:Uyes} == "no" 661.17Stv @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and' 671.17Stv @echo '*** updating your host toolchain. This should be used only as a' 681.17Stv @echo '*** temporary workaround for toolchain problems, as it will result' 691.23Swiz @echo '*** in version skew and build errors over time!' 701.18Sjmc.endif 711.17Stv 721.66Slukem.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # { 731.67Slukemrealall realdepend install: check_MKTOOLS 741.66Slukem 751.17Stv.for dir in ${SUBDIR:N.WAIT} 761.17Stvall-${dir} depend-${dir} dependall-${dir} install-${dir}: 771.17Stv @true 781.17Stv.endfor 791.66Slukem.endif # } 801.1Stv 811.1Stv.include <bsd.subdir.mk> 821.11Stv.include <bsd.obj.mk> 831.16Stv 841.66Slukem.if exists(PREVIOUSTOOLDIR) 851.66SlukemPREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR 861.66Slukem.else 871.66SlukemPREVIOUSTOOLDIR= 881.66Slukem.endif 891.66Slukem 901.66SlukemCLEANFILES+= PREVIOUSTOOLDIR 911.66Slukem 921.67Slukemrealall realdepend: 931.66Slukem.if (${PREVIOUSTOOLDIR} != ${TOOLDIR}) 941.66Slukem @echo "*** WARNING: TOOLDIR has moved?" 951.66Slukem @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'" 961.66Slukem @echo "*** != TOOLDIR '${TOOLDIR}'" 971.66Slukem @echo "*** Cleaning mis-matched tools" 981.66Slukem rm -f PREVIOUSTOOLDIR 991.66Slukem ${MAKE} cleandir 1001.66Slukem.endif 1011.66Slukem echo ${TOOLDIR} > PREVIOUSTOOLDIR 1021.66Slukem 1031.40Stv# For each .WAIT point, make sure the immediately preceding target is 1041.40Stv# installed before building anything after that point. 1051.36Spk# 1061.36Spk# We use the "internal" targets and dependencies generated by <bsd.subdir.mk> 1071.36Spk# to achieve this. These targets look like: 1081.36Spk# subdir-all: all-dir1 [.WAIT] all-dir2 etc.. 1091.36Spk# subdir-install: install-dir1 [.WAIT] install-dir2 etc.. 1101.36Spk# and so on for each element in ${TARGETS}, with .WAIT sources inserted at 1111.36Spk# places corresponding to the .WAITs in our $SUBDIR variable. 1121.36Spk# 1131.36Spk# Also, since we're now mixing `install' with `all' and `depend' targets 1141.36Spk# an order relationship between those in each individual subdirectory 1151.36Spk# must be established. 1161.36Spk# 1171.40Stv_deps:= 1181.40Stv_prev:= 1191.40Stv 1201.16Stv.for d in ${SUBDIR} 1211.16Stv_this:= ${d} 1221.40Stv 1231.16Stv.if ${_this} == ".WAIT" 1241.36Spk 1251.36Spk# setup dependency to apply to all/depend targets in the next group 1261.40Stv_deps:= ${_deps} ${_prev:S/^/install-/} 1271.40Stv 1281.40Stv# if we're building *only* individual targets (i.e. "dependall-yacc"), 1291.40Stv# make sure prerequisite tools build before installing 1301.40Stv.if !make(all) && !make(dependall) 1311.40Stvinstall-${_prev}: dependall-${_prev} 1321.40Stv.endif 1331.36Spk 1341.16Stv.else 1351.36Spk 1361.36Spk# order depend/all/install targets for ${d} subdir. Note the additional 1371.36Spk# .WAIT to achieve "closure" of the predecessor/successor relationships. 1381.36Spk.ORDER: depend-${d} all-${d} dependall-${d} .WAIT install-${d} 1391.40Stv 1401.40Stv# make all/depend-${d} dependent on list of install targets 1411.40Stvdepend-${d} all-${d} dependall-${d}: ${_deps} 1421.36Spk 1431.16Stv.endif 1441.40Stv 1451.40Stv# stash current name in case the next entry is .WAIT 1461.40Stv_prev:= ${d} 1471.16Stv.endfor 1481.69Stron 1491.69Stroncleandir: 1501.69Stron rm -f ${CLEANFILES} 151