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