1 1.155 joerg # $NetBSD: Makefile,v 1.155 2011/11/03 07:42:56 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.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.155 joerg # .WAIT between llvm-tblgen and llvm-clang-tblgen ensures install 72 1.155 joerg # rules works correctly 73 1.142 joerg SUBDIR+= \ 74 1.142 joerg llvm .WAIT \ 75 1.149 joerg llvm-lib/libLLVMSupport llvm-lib/libLLVMTableGen .WAIT \ 76 1.155 joerg llvm-tblgen .WAIT llvm-clang-tblgen .WAIT \ 77 1.142 joerg llvm-include .WAIT \ 78 1.142 joerg llvm-lib .WAIT \ 79 1.142 joerg llvm-clang 80 1.142 joerg .endif 81 1.142 joerg 82 1.121 dyoung .if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no" 83 1.136 joerg . if ${MKGROFF} != "no" 84 1.39 tv SUBDIR+= groff 85 1.136 joerg . endif 86 1.128 joerg SUBDIR+= mandoc 87 1.39 tv .endif 88 1.22 tv 89 1.22 tv .if ${MKMAINTAINERTOOLS:Uno} != "no" 90 1.103 lukem SUBDIR+= autoconf .WAIT gettext 91 1.72 matt .endif 92 1.72 matt 93 1.140 mrg .if ${USE_PIGZGZIP} != "no" 94 1.140 mrg SUBDIR+= pigz 95 1.140 mrg .endif 96 1.140 mrg 97 1.86 jmc .if ${MACHINE} == "hp700" 98 1.83 skrll SUBDIR+= hp700-mkboot 99 1.83 skrll .endif 100 1.83 skrll 101 1.86 jmc .if ${MACHINE} == "ibmnws" 102 1.72 matt SUBDIR+= ibmnws-ncdcs 103 1.79 matt .endif 104 1.79 matt 105 1.86 jmc .if ${MACHINE} == "macppc" 106 1.79 matt SUBDIR+= macppc-fixcoff 107 1.48 kleink .endif 108 1.48 kleink 109 1.116 garbled .if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox") 110 1.115 garbled SUBDIR+= powerpc-mkbootimage 111 1.22 tv .endif 112 1.37 gmcgarry 113 1.148 tsutsui .if ${MACHINE_ARCH} == "m68k" 114 1.148 tsutsui SUBDIR+= m68k-elf2aout 115 1.148 tsutsui .endif 116 1.148 tsutsui 117 1.147 mrg .if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \ 118 1.147 mrg ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb") 119 1.37 gmcgarry SUBDIR+= mips-elf2ecoff 120 1.76 sekiya .endif 121 1.76 sekiya 122 1.76 sekiya .if (${MACHINE} == "sgimips") 123 1.76 sekiya SUBDIR+= sgivol 124 1.51 bjh21 .endif 125 1.51 bjh21 126 1.82 abs .if ${MACHINE} == "acorn32" 127 1.82 abs SUBDIR+= sparkcrc 128 1.82 abs .endif 129 1.82 abs 130 1.125 abs .if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") 131 1.51 bjh21 SUBDIR+= fgen 132 1.37 gmcgarry .endif 133 1.37 gmcgarry 134 1.85 jmc .if ${MACHINE} == "amiga" 135 1.85 jmc SUBDIR+= amiga-elf2bb 136 1.85 jmc SUBDIR+= amiga-txlt 137 1.85 jmc .endif 138 1.85 jmc 139 1.86 jmc .if ${MACHINE} == "hp300" 140 1.86 jmc SUBDIR+= hp300-mkboot 141 1.86 jmc .endif 142 1.86 jmc 143 1.143 phx .if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \ 144 1.143 phx ${MACHINE} == "evbppc" || ${MACHINE} == "sandpoint" 145 1.139 jmcneill SUBDIR+= mkubootimage 146 1.139 jmcneill .endif 147 1.139 jmcneill 148 1.66 lukem check_MKTOOLS: .PHONY .NOTMAIN 149 1.19 jmc .if ${MKTOOLS:Uyes} == "no" 150 1.17 tv @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and' 151 1.17 tv @echo '*** updating your host toolchain. This should be used only as a' 152 1.17 tv @echo '*** temporary workaround for toolchain problems, as it will result' 153 1.23 wiz @echo '*** in version skew and build errors over time!' 154 1.18 jmc .endif 155 1.17 tv 156 1.66 lukem .if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # { 157 1.67 lukem realall realdepend install: check_MKTOOLS 158 1.66 lukem 159 1.17 tv .for dir in ${SUBDIR:N.WAIT} 160 1.17 tv all-${dir} depend-${dir} dependall-${dir} install-${dir}: 161 1.17 tv @true 162 1.17 tv .endfor 163 1.66 lukem .endif # } 164 1.1 tv 165 1.1 tv .include <bsd.subdir.mk> 166 1.11 tv .include <bsd.obj.mk> 167 1.16 tv 168 1.102 tron .if !defined(PREVIOUSTOOLDIR) 169 1.102 tron . if exists(PREVIOUSTOOLDIR) 170 1.66 lukem PREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR 171 1.102 tron . else 172 1.66 lukem PREVIOUSTOOLDIR= 173 1.102 tron . endif 174 1.66 lukem .endif 175 1.66 lukem 176 1.66 lukem CLEANFILES+= PREVIOUSTOOLDIR 177 1.66 lukem 178 1.101 tron realall realdepend: .MAKE 179 1.107 apb .if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}" 180 1.66 lukem @echo "*** WARNING: TOOLDIR has moved?" 181 1.66 lukem @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'" 182 1.66 lukem @echo "*** != TOOLDIR '${TOOLDIR}'" 183 1.66 lukem @echo "*** Cleaning mis-matched tools" 184 1.66 lukem rm -f PREVIOUSTOOLDIR 185 1.106 freza (cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir) 186 1.66 lukem .endif 187 1.102 tron echo ${TOOLDIR} >PREVIOUSTOOLDIR 188 1.66 lukem 189 1.40 tv # For each .WAIT point, make sure the immediately preceding target is 190 1.40 tv # installed before building anything after that point. 191 1.109 dsl # (dsl: which means that with: 'a b .WAIT c' the build of 'c' waits for the 192 1.109 dsl # install of 'b', but not the install of 'a'.) 193 1.36 pk # 194 1.36 pk # We use the "internal" targets and dependencies generated by <bsd.subdir.mk> 195 1.36 pk # to achieve this. These targets look like: 196 1.36 pk # subdir-all: all-dir1 [.WAIT] all-dir2 etc.. 197 1.36 pk # subdir-install: install-dir1 [.WAIT] install-dir2 etc.. 198 1.36 pk # and so on for each element in ${TARGETS}, with .WAIT sources inserted at 199 1.36 pk # places corresponding to the .WAITs in our $SUBDIR variable. 200 1.36 pk # 201 1.36 pk # Also, since we're now mixing `install' with `all' and `depend' targets 202 1.36 pk # an order relationship between those in each individual subdirectory 203 1.36 pk # must be established. 204 1.36 pk # 205 1.40 tv _deps:= 206 1.40 tv _prev:= 207 1.40 tv 208 1.123 apb .for d in ${SUBDIR} # { 209 1.16 tv _this:= ${d} 210 1.40 tv 211 1.123 apb .if ${_this} == ".WAIT" # { 212 1.36 pk 213 1.36 pk # setup dependency to apply to all/depend targets in the next group 214 1.40 tv _deps:= ${_deps} ${_prev:S/^/install-/} 215 1.40 tv 216 1.40 tv # if we're building *only* individual targets (i.e. "dependall-yacc"), 217 1.40 tv # make sure prerequisite tools build before installing 218 1.109 dsl # XXX: dsl: this is likely to generate a dependency loop since there is 219 1.109 dsl # a .ORDER releation between the nodes as well. 220 1.109 dsl .if !make(all) && !make(dependall) && !make(install) 221 1.40 tv install-${_prev}: dependall-${_prev} 222 1.40 tv .endif 223 1.36 pk 224 1.123 apb .else # ${_this} != ".WAIT" # } { 225 1.36 pk 226 1.109 dsl # order depend/all/install targets for ${d} subdir. 227 1.109 dsl .ORDER: depend-${d} all-${d} dependall-${d} install-${d} 228 1.40 tv 229 1.106 freza # prevent cleandir in real{all,depend} from interfering with subdir makes 230 1.106 freza .ORDER: realdepend dependall-${d} 231 1.106 freza .ORDER: realdepend depend-${d} 232 1.106 freza .ORDER: realall all-${d} 233 1.106 freza 234 1.40 tv # make all/depend-${d} dependent on list of install targets 235 1.40 tv depend-${d} all-${d} dependall-${d}: ${_deps} 236 1.36 pk 237 1.123 apb .endif # ${_this} != ".WAIT" # } 238 1.40 tv 239 1.40 tv # stash current name in case the next entry is .WAIT 240 1.40 tv _prev:= ${d} 241 1.123 apb .endfor # } 242 1.69 tron 243 1.69 tron cleandir: 244 1.69 tron rm -f ${CLEANFILES} 245