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