Makefile revision 1.83
1# $NetBSD: Makefile,v 1.83 2004/07/28 09:17:31 skrll Exp $ 2 3.include <bsd.own.mk> 4 5.if ${TOOLCHAIN_MISSING} == "no" 6TOOLCHAIN_BITS= binutils .WAIT 7. if ${USE_TOOLS_TOOLCHAIN} != "yes" 8TOOLCHAIN_BITS+= gcc 9. if ${MKCROSSGDB:Uno} != "no" 10TOOLCHAIN_BITS+= gdb 11. endif 12. else 13TOOLCHAIN_BITS+= toolchain 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 20# Dependencies in SUBDIR below ordered to maximize parallel ability. 21.if !defined(NOSUBDIR) # { 22 23SUBDIR= host-mkdep .WAIT compat .WAIT \ 24 binstall .WAIT mktemp .WAIT \ 25 cap_mkdb crunchgen ctags gencat hexdump lint lint2 lorder \ 26 m4 makewhatis mkdep mtree rpcgen tsort uudecode \ 27 texinfo .WAIT \ 28 yacc .WAIT \ 29 lex .WAIT \ 30 ${TOOLCHAIN_BITS} \ 31 asn1_compile cat cksum compile_et config db file installboot \ 32 lint1 makefs menuc mkcsmapper mkesdb mklocale mknod msgc pax \ 33 pwd_mkdb stat sunlabel zic 34 35.if ${MKMAN} != "no" 36SUBDIR+= groff 37.endif 38 39.if ${MKMAINTAINERTOOLS:Uno} != "no" 40SUBDIR+= autoconf gettext 41.endif 42 43.if ${MACHINE} == hp700 44SUBDIR+= hp700-mkboot 45.endif 46 47.if ${MACHINE} == ibmnws 48SUBDIR+= ibmnws-ncdcs 49.endif 50 51.if ${MACHINE} == macppc 52SUBDIR+= macppc-fixcoff 53.endif 54 55.if ${MACHINE} == prep 56SUBDIR+= prep-mkbootimage 57.endif 58 59.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb") 60SUBDIR+= mips-elf2ecoff 61.endif 62 63.if (${MACHINE} == "sgimips") 64SUBDIR+= sgivol 65.endif 66 67.if ${MACHINE} == "acorn32" 68SUBDIR+= sparkcrc 69.endif 70 71.if (${MACHINE} == "sparc" || ${MACHINE} == "sparc64") 72SUBDIR+= fgen 73.endif 74 75.endif # ! NOSUBDIR # } 76 77check_MKTOOLS: .PHONY .NOTMAIN 78.if ${MKTOOLS:Uyes} == "no" 79 @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and' 80 @echo '*** updating your host toolchain. This should be used only as a' 81 @echo '*** temporary workaround for toolchain problems, as it will result' 82 @echo '*** in version skew and build errors over time!' 83.endif 84 85.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # { 86realall realdepend install: check_MKTOOLS 87 88.for dir in ${SUBDIR:N.WAIT} 89all-${dir} depend-${dir} dependall-${dir} install-${dir}: 90 @true 91.endfor 92.endif # } 93 94.include <bsd.subdir.mk> 95.include <bsd.obj.mk> 96 97.if exists(PREVIOUSTOOLDIR) 98PREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR 99.else 100PREVIOUSTOOLDIR= 101.endif 102 103CLEANFILES+= PREVIOUSTOOLDIR 104 105realall realdepend: 106.if (${PREVIOUSTOOLDIR} != ${TOOLDIR}) 107 @echo "*** WARNING: TOOLDIR has moved?" 108 @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'" 109 @echo "*** != TOOLDIR '${TOOLDIR}'" 110 @echo "*** Cleaning mis-matched tools" 111 rm -f PREVIOUSTOOLDIR 112 (cd ${.CURDIR} && ${MAKE} cleandir) 113.endif 114 echo ${TOOLDIR} > PREVIOUSTOOLDIR 115 116# For each .WAIT point, make sure the immediately preceding target is 117# installed before building anything after that point. 118# 119# We use the "internal" targets and dependencies generated by <bsd.subdir.mk> 120# to achieve this. These targets look like: 121# subdir-all: all-dir1 [.WAIT] all-dir2 etc.. 122# subdir-install: install-dir1 [.WAIT] install-dir2 etc.. 123# and so on for each element in ${TARGETS}, with .WAIT sources inserted at 124# places corresponding to the .WAITs in our $SUBDIR variable. 125# 126# Also, since we're now mixing `install' with `all' and `depend' targets 127# an order relationship between those in each individual subdirectory 128# must be established. 129# 130_deps:= 131_prev:= 132 133.for d in ${SUBDIR} 134_this:= ${d} 135 136.if ${_this} == ".WAIT" 137 138# setup dependency to apply to all/depend targets in the next group 139_deps:= ${_deps} ${_prev:S/^/install-/} 140 141# if we're building *only* individual targets (i.e. "dependall-yacc"), 142# make sure prerequisite tools build before installing 143.if !make(all) && !make(dependall) 144install-${_prev}: dependall-${_prev} 145.endif 146 147.else 148 149# order depend/all/install targets for ${d} subdir. Note the additional 150# .WAIT to achieve "closure" of the predecessor/successor relationships. 151.ORDER: depend-${d} all-${d} dependall-${d} .WAIT install-${d} 152 153# make all/depend-${d} dependent on list of install targets 154depend-${d} all-${d} dependall-${d}: ${_deps} 155 156.endif 157 158# stash current name in case the next entry is .WAIT 159_prev:= ${d} 160.endfor 161 162cleandir: 163 rm -f ${CLEANFILES} 164