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