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