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