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