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