1# $NetBSD: Makefile,v 1.79 2003/12/11 00:29:33 matt Exp $ 2 3.include <bsd.own.mk> 4 5.if ${TOOLCHAIN_MISSING} != "yes" 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} == ibmnws 44SUBDIR+= ibmnws-ncdcs 45.endif 46 47.if ${MACHINE} == macpcc 48SUBDIR+= macppc-fixcoff 49.endif 50 51.if ${MACHINE} == prep 52SUBDIR+= prep-mkbootimage 53.endif 54 55.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb") 56SUBDIR+= mips-elf2ecoff 57.endif 58 59.if (${MACHINE} == "sgimips") 60SUBDIR+= sgivol 61.endif 62 63.if (${MACHINE} == "sparc" || ${MACHINE} == "sparc64") 64SUBDIR+= fgen 65.endif 66 67.endif # ! NOSUBDIR # } 68 69check_MKTOOLS: .PHONY .NOTMAIN 70.if ${MKTOOLS:Uyes} == "no" 71 @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and' 72 @echo '*** updating your host toolchain. This should be used only as a' 73 @echo '*** temporary workaround for toolchain problems, as it will result' 74 @echo '*** in version skew and build errors over time!' 75.endif 76 77.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # { 78realall realdepend install: check_MKTOOLS 79 80.for dir in ${SUBDIR:N.WAIT} 81all-${dir} depend-${dir} dependall-${dir} install-${dir}: 82 @true 83.endfor 84.endif # } 85 86.include <bsd.subdir.mk> 87.include <bsd.obj.mk> 88 89.if exists(PREVIOUSTOOLDIR) 90PREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR 91.else 92PREVIOUSTOOLDIR= 93.endif 94 95CLEANFILES+= PREVIOUSTOOLDIR 96 97realall realdepend: 98.if (${PREVIOUSTOOLDIR} != ${TOOLDIR}) 99 @echo "*** WARNING: TOOLDIR has moved?" 100 @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'" 101 @echo "*** != TOOLDIR '${TOOLDIR}'" 102 @echo "*** Cleaning mis-matched tools" 103 rm -f PREVIOUSTOOLDIR 104 (cd ${.CURDIR} && ${MAKE} cleandir) 105.endif 106 echo ${TOOLDIR} > PREVIOUSTOOLDIR 107 108# For each .WAIT point, make sure the immediately preceding target is 109# installed before building anything after that point. 110# 111# We use the "internal" targets and dependencies generated by <bsd.subdir.mk> 112# to achieve this. These targets look like: 113# subdir-all: all-dir1 [.WAIT] all-dir2 etc.. 114# subdir-install: install-dir1 [.WAIT] install-dir2 etc.. 115# and so on for each element in ${TARGETS}, with .WAIT sources inserted at 116# places corresponding to the .WAITs in our $SUBDIR variable. 117# 118# Also, since we're now mixing `install' with `all' and `depend' targets 119# an order relationship between those in each individual subdirectory 120# must be established. 121# 122_deps:= 123_prev:= 124 125.for d in ${SUBDIR} 126_this:= ${d} 127 128.if ${_this} == ".WAIT" 129 130# setup dependency to apply to all/depend targets in the next group 131_deps:= ${_deps} ${_prev:S/^/install-/} 132 133# if we're building *only* individual targets (i.e. "dependall-yacc"), 134# make sure prerequisite tools build before installing 135.if !make(all) && !make(dependall) 136install-${_prev}: dependall-${_prev} 137.endif 138 139.else 140 141# order depend/all/install targets for ${d} subdir. Note the additional 142# .WAIT to achieve "closure" of the predecessor/successor relationships. 143.ORDER: depend-${d} all-${d} dependall-${d} .WAIT install-${d} 144 145# make all/depend-${d} dependent on list of install targets 146depend-${d} all-${d} dependall-${d}: ${_deps} 147 148.endif 149 150# stash current name in case the next entry is .WAIT 151_prev:= ${d} 152.endfor 153 154cleandir: 155 rm -f ${CLEANFILES} 156