1 1.106 freza # $NetBSD: Makefile,v 1.106 2006/08/03 17:11:05 freza Exp $ 2 1.1 tv 3 1.3 tv .include <bsd.own.mk> 4 1.3 tv 5 1.96 mrg .if ${HAVE_GCC} == "4" 6 1.94 jmc TOOLCHAIN_BITS= gmake .WAIT 7 1.94 jmc .endif 8 1.81 lukem .if ${TOOLCHAIN_MISSING} == "no" 9 1.94 jmc TOOLCHAIN_BITS+= binutils .WAIT 10 1.77 mrg TOOLCHAIN_BITS+= gcc 11 1.97 mrg . if ${MKCROSSGDB:Uno} != "no" 12 1.74 cl TOOLCHAIN_BITS+= gdb 13 1.70 mrg . endif 14 1.70 mrg TOOLCHAIN_BITS+= .WAIT dbsym mdsetimage 15 1.58 thorpej # XXX Eventually, we want to be able to build dbsym and mdsetimage 16 1.58 thorpej # XXX if EXTERNAL_TOOLCHAIN is set. 17 1.31 tv .endif 18 1.31 tv 19 1.99 mrg LINT_BITS= 20 1.99 mrg .if ${MKLINT} != "no" 21 1.99 mrg LINT_BITS= lint lint2 22 1.99 mrg .endif 23 1.99 mrg 24 1.16 tv # Dependencies in SUBDIR below ordered to maximize parallel ability. 25 1.50 lukem .if !defined(NOSUBDIR) # { 26 1.50 lukem 27 1.29 tv SUBDIR= host-mkdep .WAIT compat .WAIT \ 28 1.57 chris binstall .WAIT mktemp .WAIT \ 29 1.99 mrg cap_mkdb crunchgen ctags genassym gencat hexdump \ 30 1.99 mrg ${LINT_BITS} \ 31 1.98 gdamore lorder m4 makewhatis mkdep mtree rpcgen sed tsort uudecode \ 32 1.32 tv texinfo .WAIT \ 33 1.16 tv yacc .WAIT \ 34 1.16 tv lex .WAIT \ 35 1.32 tv ${TOOLCHAIN_BITS} \ 36 1.90 dyoung asn1_compile cat cksum compile_et config db \ 37 1.91 dyoung file lint1 \ 38 1.90 dyoung makefs menuc mkcsmapper mkesdb mklocale mknod msgc \ 39 1.90 dyoung pax .WAIT \ 40 1.92 jmc disklabel .WAIT \ 41 1.92 jmc fdisk .WAIT \ 42 1.92 jmc installboot .WAIT \ 43 1.68 lukem pwd_mkdb stat sunlabel zic 44 1.39 tv 45 1.39 tv .if ${MKMAN} != "no" 46 1.39 tv SUBDIR+= groff 47 1.39 tv .endif 48 1.22 tv 49 1.22 tv .if ${MKMAINTAINERTOOLS:Uno} != "no" 50 1.103 lukem SUBDIR+= autoconf .WAIT gettext 51 1.72 matt .endif 52 1.72 matt 53 1.86 jmc .if ${MACHINE} == "hp700" 54 1.83 skrll SUBDIR+= hp700-mkboot 55 1.83 skrll .endif 56 1.83 skrll 57 1.86 jmc .if ${MACHINE} == "ibmnws" 58 1.72 matt SUBDIR+= ibmnws-ncdcs 59 1.79 matt .endif 60 1.79 matt 61 1.86 jmc .if ${MACHINE} == "macppc" 62 1.79 matt SUBDIR+= macppc-fixcoff 63 1.48 kleink .endif 64 1.48 kleink 65 1.86 jmc .if ${MACHINE} == "prep" 66 1.48 kleink SUBDIR+= prep-mkbootimage 67 1.22 tv .endif 68 1.37 gmcgarry 69 1.37 gmcgarry .if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb") 70 1.37 gmcgarry SUBDIR+= mips-elf2ecoff 71 1.76 sekiya .endif 72 1.76 sekiya 73 1.76 sekiya .if (${MACHINE} == "sgimips") 74 1.76 sekiya SUBDIR+= sgivol 75 1.51 bjh21 .endif 76 1.51 bjh21 77 1.82 abs .if ${MACHINE} == "acorn32" 78 1.82 abs SUBDIR+= sparkcrc 79 1.82 abs .endif 80 1.82 abs 81 1.51 bjh21 .if (${MACHINE} == "sparc" || ${MACHINE} == "sparc64") 82 1.51 bjh21 SUBDIR+= fgen 83 1.37 gmcgarry .endif 84 1.37 gmcgarry 85 1.84 jmc .if ${MACHINE} == "bebox" 86 1.84 jmc SUBDIR+= bebox-elf2pef 87 1.84 jmc SUBDIR+= bebox-mkbootimage 88 1.84 jmc .endif 89 1.84 jmc 90 1.85 jmc .if ${MACHINE} == "amiga" 91 1.85 jmc SUBDIR+= amiga-elf2bb 92 1.85 jmc SUBDIR+= amiga-txlt 93 1.85 jmc .endif 94 1.85 jmc 95 1.86 jmc .if ${MACHINE} == "hp300" 96 1.86 jmc SUBDIR+= hp300-mkboot 97 1.86 jmc .endif 98 1.86 jmc 99 1.50 lukem .endif # ! NOSUBDIR # } 100 1.17 tv 101 1.66 lukem check_MKTOOLS: .PHONY .NOTMAIN 102 1.19 jmc .if ${MKTOOLS:Uyes} == "no" 103 1.17 tv @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and' 104 1.17 tv @echo '*** updating your host toolchain. This should be used only as a' 105 1.17 tv @echo '*** temporary workaround for toolchain problems, as it will result' 106 1.23 wiz @echo '*** in version skew and build errors over time!' 107 1.18 jmc .endif 108 1.17 tv 109 1.66 lukem .if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # { 110 1.67 lukem realall realdepend install: check_MKTOOLS 111 1.66 lukem 112 1.17 tv .for dir in ${SUBDIR:N.WAIT} 113 1.17 tv all-${dir} depend-${dir} dependall-${dir} install-${dir}: 114 1.17 tv @true 115 1.17 tv .endfor 116 1.66 lukem .endif # } 117 1.1 tv 118 1.1 tv .include <bsd.subdir.mk> 119 1.11 tv .include <bsd.obj.mk> 120 1.16 tv 121 1.102 tron .if !defined(PREVIOUSTOOLDIR) 122 1.102 tron . if exists(PREVIOUSTOOLDIR) 123 1.66 lukem PREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR 124 1.102 tron . else 125 1.66 lukem PREVIOUSTOOLDIR= 126 1.102 tron . endif 127 1.66 lukem .endif 128 1.66 lukem 129 1.66 lukem CLEANFILES+= PREVIOUSTOOLDIR 130 1.66 lukem 131 1.101 tron realall realdepend: .MAKE 132 1.87 mycroft .if "${PREVIOUSTOOLDIR}" != "${TOOLDIR}" 133 1.66 lukem @echo "*** WARNING: TOOLDIR has moved?" 134 1.66 lukem @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'" 135 1.66 lukem @echo "*** != TOOLDIR '${TOOLDIR}'" 136 1.66 lukem @echo "*** Cleaning mis-matched tools" 137 1.66 lukem rm -f PREVIOUSTOOLDIR 138 1.106 freza (cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir) 139 1.66 lukem .endif 140 1.102 tron echo ${TOOLDIR} >PREVIOUSTOOLDIR 141 1.66 lukem 142 1.40 tv # For each .WAIT point, make sure the immediately preceding target is 143 1.40 tv # installed before building anything after that point. 144 1.36 pk # 145 1.36 pk # We use the "internal" targets and dependencies generated by <bsd.subdir.mk> 146 1.36 pk # to achieve this. These targets look like: 147 1.36 pk # subdir-all: all-dir1 [.WAIT] all-dir2 etc.. 148 1.36 pk # subdir-install: install-dir1 [.WAIT] install-dir2 etc.. 149 1.36 pk # and so on for each element in ${TARGETS}, with .WAIT sources inserted at 150 1.36 pk # places corresponding to the .WAITs in our $SUBDIR variable. 151 1.36 pk # 152 1.36 pk # Also, since we're now mixing `install' with `all' and `depend' targets 153 1.36 pk # an order relationship between those in each individual subdirectory 154 1.36 pk # must be established. 155 1.36 pk # 156 1.40 tv _deps:= 157 1.40 tv _prev:= 158 1.40 tv 159 1.16 tv .for d in ${SUBDIR} 160 1.16 tv _this:= ${d} 161 1.40 tv 162 1.16 tv .if ${_this} == ".WAIT" 163 1.36 pk 164 1.36 pk # setup dependency to apply to all/depend targets in the next group 165 1.40 tv _deps:= ${_deps} ${_prev:S/^/install-/} 166 1.40 tv 167 1.40 tv # if we're building *only* individual targets (i.e. "dependall-yacc"), 168 1.40 tv # make sure prerequisite tools build before installing 169 1.40 tv .if !make(all) && !make(dependall) 170 1.40 tv install-${_prev}: dependall-${_prev} 171 1.40 tv .endif 172 1.36 pk 173 1.16 tv .else 174 1.36 pk 175 1.36 pk # order depend/all/install targets for ${d} subdir. Note the additional 176 1.36 pk # .WAIT to achieve "closure" of the predecessor/successor relationships. 177 1.36 pk .ORDER: depend-${d} all-${d} dependall-${d} .WAIT install-${d} 178 1.40 tv 179 1.106 freza # prevent cleandir in real{all,depend} from interfering with subdir makes 180 1.106 freza .ORDER: realdepend dependall-${d} 181 1.106 freza .ORDER: realdepend depend-${d} 182 1.106 freza .ORDER: realall all-${d} 183 1.106 freza 184 1.40 tv # make all/depend-${d} dependent on list of install targets 185 1.40 tv depend-${d} all-${d} dependall-${d}: ${_deps} 186 1.36 pk 187 1.16 tv .endif 188 1.40 tv 189 1.40 tv # stash current name in case the next entry is .WAIT 190 1.40 tv _prev:= ${d} 191 1.16 tv .endfor 192 1.69 tron 193 1.69 tron cleandir: 194 1.69 tron rm -f ${CLEANFILES} 195