Makefile revision 1.76
11.9Sdholland# $NetBSD: Makefile,v 1.76 2003/11/08 05:02:33 sekiya Exp $ 21.1Shauke 31.1Shauke.include <bsd.own.mk> 41.1Shauke 51.1Shauke.if ${TOOLCHAIN_MISSING} != "yes" 61.1Shauke. if ${USE_TOOLS_TOOLCHAIN} != "yes" 71.1ShaukeTOOLCHAIN_BITS= binutils .WAIT gcc 81.1Shauke. if ${MKCROSSGDB:Uno} != "no" 91.1ShaukeTOOLCHAIN_BITS+= gdb 101.1Shauke. endif 111.1Shauke. else 121.1ShaukeTOOLCHAIN_BITS= toolchain 131.1Shauke. endif 141.1ShaukeTOOLCHAIN_BITS+= .WAIT dbsym mdsetimage 151.1Shauke# XXX Eventually, we want to be able to build dbsym and mdsetimage 161.1Shauke# XXX if EXTERNAL_TOOLCHAIN is set. 171.1Shauke.endif 181.1Shauke 191.1Shauke# Dependencies in SUBDIR below ordered to maximize parallel ability. 201.1Shauke.if !defined(NOSUBDIR) # { 211.1Shauke 221.1ShaukeSUBDIR= host-mkdep .WAIT compat .WAIT \ 231.1Shauke binstall .WAIT mktemp .WAIT \ 241.1Shauke cap_mkdb crunchgen ctags gencat hexdump lint lint2 lorder \ 251.1Shauke m4 makewhatis mkdep mtree rpcgen tsort uudecode \ 261.1Shauke texinfo .WAIT \ 271.1Shauke yacc .WAIT \ 281.9Sdholland lex .WAIT \ 291.1Shauke ${TOOLCHAIN_BITS} \ 301.1Shauke asn1_compile cat cksum compile_et config db file installboot \ 311.1Shauke lint1 makefs menuc mkcsmapper mkesdb mklocale mknod msgc pax \ 321.1Shauke pwd_mkdb stat sunlabel zic 331.1Shauke 341.1Shauke.if ${MKMAN} != "no" 351.1ShaukeSUBDIR+= groff 361.1Shauke.endif 371.1Shauke 381.1Shauke.if ${MKMAINTAINERTOOLS:Uno} != "no" 391.1ShaukeSUBDIR+= autoconf gettext 401.1Shauke.endif 411.1Shauke 421.6Shauke.if ${MACHINE} == ibmnws 431.1ShaukeSUBDIR+= ibmnws-ncdcs 441.1Shauke.endif 451.1Shauke 461.1Shauke.if ${MACHINE} == prep 471.1ShaukeSUBDIR+= prep-mkbootimage 481.1Shauke.endif 491.1Shauke 501.1Shauke.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb") 511.1ShaukeSUBDIR+= mips-elf2ecoff 521.1Shauke.endif 531.1Shauke 541.1Shauke.if (${MACHINE} == "sgimips") 551.1ShaukeSUBDIR+= sgivol 561.1Shauke.endif 571.1Shauke 581.1Shauke.if (${MACHINE} == "sparc" || ${MACHINE} == "sparc64") 591.1ShaukeSUBDIR+= fgen 601.1Shauke.endif 611.1Shauke 621.1Shauke.endif # ! NOSUBDIR # } 631.1Shauke 641.1Shaukecheck_MKTOOLS: .PHONY .NOTMAIN 651.1Shauke.if ${MKTOOLS:Uyes} == "no" 661.1Shauke @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and' 671.1Shauke @echo '*** updating your host toolchain. This should be used only as a' 681.1Shauke @echo '*** temporary workaround for toolchain problems, as it will result' 691.1Shauke @echo '*** in version skew and build errors over time!' 701.1Shauke.endif 711.1Shauke 721.1Shauke.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # { 731.1Shaukerealall realdepend install: check_MKTOOLS 741.6Shauke 751.1Shauke.for dir in ${SUBDIR:N.WAIT} 761.1Shaukeall-${dir} depend-${dir} dependall-${dir} install-${dir}: 771.1Shauke @true 781.1Shauke.endfor 791.1Shauke.endif # } 801.1Shauke 811.1Shauke.include <bsd.subdir.mk> 821.1Shauke.include <bsd.obj.mk> 831.1Shauke 841.1Shauke.if exists(PREVIOUSTOOLDIR) 851.6ShaukePREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR 861.1Shauke.else 871.1ShaukePREVIOUSTOOLDIR= 881.1Shauke.endif 891.6Shauke 901.6ShaukeCLEANFILES+= PREVIOUSTOOLDIR 911.1Shauke 921.1Shaukerealall realdepend: 931.1Shauke.if (${PREVIOUSTOOLDIR} != ${TOOLDIR}) 941.1Shauke @echo "*** WARNING: TOOLDIR has moved?" 951.1Shauke @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'" 961.1Shauke @echo "*** != TOOLDIR '${TOOLDIR}'" 971.1Shauke @echo "*** Cleaning mis-matched tools" 981.6Shauke rm -f PREVIOUSTOOLDIR 991.1Shauke ${MAKE} cleandir 1001.1Shauke.endif 1011.6Shauke echo ${TOOLDIR} > PREVIOUSTOOLDIR 1021.1Shauke 1031.1Shauke# For each .WAIT point, make sure the immediately preceding target is 1041.1Shauke# installed before building anything after that point. 1051.1Shauke# 1061.1Shauke# We use the "internal" targets and dependencies generated by <bsd.subdir.mk> 1071.1Shauke# to achieve this. These targets look like: 1081.7Schs# subdir-all: all-dir1 [.WAIT] all-dir2 etc.. 1091.1Shauke# subdir-install: install-dir1 [.WAIT] install-dir2 etc.. 1101.1Shauke# and so on for each element in ${TARGETS}, with .WAIT sources inserted at 1111.1Shauke# places corresponding to the .WAITs in our $SUBDIR variable. 1121.1Shauke# 1131.1Shauke# Also, since we're now mixing `install' with `all' and `depend' targets 1141.1Shauke# an order relationship between those in each individual subdirectory 1151.1Shauke# must be established. 1161.1Shauke# 1171.1Shauke_deps:= 1181.8Sdholland_prev:= 1191.8Sdholland 1201.8Sdholland.for d in ${SUBDIR} 1211.8Sdholland_this:= ${d} 1221.8Sdholland 1231.8Sdholland.if ${_this} == ".WAIT" 1241.8Sdholland 1251.8Sdholland# setup dependency to apply to all/depend targets in the next group 1261.8Sdholland_deps:= ${_deps} ${_prev:S/^/install-/} 1271.8Sdholland 1281.9Sdholland# if we're building *only* individual targets (i.e. "dependall-yacc"), 1291.8Sdholland# make sure prerequisite tools build before installing 1301.1Shauke.if !make(all) && !make(dependall) 1311.1Shaukeinstall-${_prev}: dependall-${_prev} 1321.1Shauke.endif 1331.1Shauke 1341.1Shauke.else 1351.1Shauke 1361.1Shauke# order depend/all/install targets for ${d} subdir. Note the additional 1371.1Shauke# .WAIT to achieve "closure" of the predecessor/successor relationships. 1381.1Shauke.ORDER: depend-${d} all-${d} dependall-${d} .WAIT install-${d} 1391.6Shauke 1401.6Shauke# make all/depend-${d} dependent on list of install targets 1411.6Shaukedepend-${d} all-${d} dependall-${d}: ${_deps} 1421.6Shauke 1431.6Shauke.endif 1441.1Shauke 1451.6Shauke# stash current name in case the next entry is .WAIT 1461.1Shauke_prev:= ${d} 1471.1Shauke.endfor 1481.1Shauke 1491.1Shaukecleandir: 1501.1Shauke rm -f ${CLEANFILES} 1511.1Shauke