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