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