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