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