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