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