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