1 # $NetBSD: Makefile,v 1.111 2006/12/19 21:23:18 agc 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 paxctl .WAIT \ 42 fdisk .WAIT \ 43 installboot .WAIT \ 44 veriexecgen .WAIT \ 45 pwd_mkdb stat sunlabel zic 46 47 .if ${MKMAN} != "no" 48 SUBDIR+= groff 49 .endif 50 51 .if ${MKMAINTAINERTOOLS:Uno} != "no" 52 SUBDIR+= autoconf .WAIT gettext 53 .endif 54 55 .if ${MACHINE} == "hp700" 56 SUBDIR+= hp700-mkboot 57 .endif 58 59 .if ${MACHINE} == "ibmnws" 60 SUBDIR+= ibmnws-ncdcs 61 .endif 62 63 .if ${MACHINE} == "macppc" 64 SUBDIR+= macppc-fixcoff 65 .endif 66 67 .if ${MACHINE} == "prep" 68 SUBDIR+= prep-mkbootimage 69 .endif 70 71 .if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb") 72 SUBDIR+= mips-elf2ecoff 73 .endif 74 75 .if (${MACHINE} == "sgimips") 76 SUBDIR+= sgivol 77 .endif 78 79 .if ${MACHINE} == "acorn32" 80 SUBDIR+= sparkcrc 81 .endif 82 83 .if (${MACHINE} == "sparc" || ${MACHINE} == "sparc64") 84 SUBDIR+= fgen 85 .endif 86 87 .if ${MACHINE} == "bebox" 88 SUBDIR+= bebox-elf2pef 89 SUBDIR+= bebox-mkbootimage 90 .endif 91 92 .if ${MACHINE} == "amiga" 93 SUBDIR+= amiga-elf2bb 94 SUBDIR+= amiga-txlt 95 .endif 96 97 .if ${MACHINE} == "hp300" 98 SUBDIR+= hp300-mkboot 99 .endif 100 101 .endif # ! NOSUBDIR # } 102 103 check_MKTOOLS: .PHONY .NOTMAIN 104 .if ${MKTOOLS:Uyes} == "no" 105 @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and' 106 @echo '*** updating your host toolchain. This should be used only as a' 107 @echo '*** temporary workaround for toolchain problems, as it will result' 108 @echo '*** in version skew and build errors over time!' 109 .endif 110 111 .if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # { 112 realall realdepend install: check_MKTOOLS 113 114 .for dir in ${SUBDIR:N.WAIT} 115 all-${dir} depend-${dir} dependall-${dir} install-${dir}: 116 @true 117 .endfor 118 .endif # } 119 120 .include <bsd.subdir.mk> 121 .include <bsd.obj.mk> 122 123 .if !defined(PREVIOUSTOOLDIR) 124 . if exists(PREVIOUSTOOLDIR) 125 PREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR 126 . else 127 PREVIOUSTOOLDIR= 128 . endif 129 .endif 130 131 CLEANFILES+= PREVIOUSTOOLDIR 132 133 realall realdepend: .MAKE 134 .if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}" 135 @echo "*** WARNING: TOOLDIR has moved?" 136 @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'" 137 @echo "*** != TOOLDIR '${TOOLDIR}'" 138 @echo "*** Cleaning mis-matched tools" 139 rm -f PREVIOUSTOOLDIR 140 (cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir) 141 .endif 142 echo ${TOOLDIR} >PREVIOUSTOOLDIR 143 144 # For each .WAIT point, make sure the immediately preceding target is 145 # installed before building anything after that point. 146 # (dsl: which means that with: 'a b .WAIT c' the build of 'c' waits for the 147 # install of 'b', but not the install of 'a'.) 148 # 149 # We use the "internal" targets and dependencies generated by <bsd.subdir.mk> 150 # to achieve this. These targets look like: 151 # subdir-all: all-dir1 [.WAIT] all-dir2 etc.. 152 # subdir-install: install-dir1 [.WAIT] install-dir2 etc.. 153 # and so on for each element in ${TARGETS}, with .WAIT sources inserted at 154 # places corresponding to the .WAITs in our $SUBDIR variable. 155 # 156 # Also, since we're now mixing `install' with `all' and `depend' targets 157 # an order relationship between those in each individual subdirectory 158 # must be established. 159 # 160 _deps:= 161 _prev:= 162 163 .for d in ${SUBDIR} 164 _this:= ${d} 165 166 .if ${_this} == ".WAIT" 167 168 # setup dependency to apply to all/depend targets in the next group 169 _deps:= ${_deps} ${_prev:S/^/install-/} 170 171 # if we're building *only* individual targets (i.e. "dependall-yacc"), 172 # make sure prerequisite tools build before installing 173 # XXX: dsl: this is likely to generate a dependency loop since there is 174 # a .ORDER releation between the nodes as well. 175 .if !make(all) && !make(dependall) && !make(install) 176 install-${_prev}: dependall-${_prev} 177 .endif 178 179 .else 180 181 # order depend/all/install targets for ${d} subdir. 182 .ORDER: depend-${d} all-${d} dependall-${d} install-${d} 183 184 # prevent cleandir in real{all,depend} from interfering with subdir makes 185 .ORDER: realdepend dependall-${d} 186 .ORDER: realdepend depend-${d} 187 .ORDER: realall all-${d} 188 189 # make all/depend-${d} dependent on list of install targets 190 depend-${d} all-${d} dependall-${d}: ${_deps} 191 192 .endif 193 194 # stash current name in case the next entry is .WAIT 195 _prev:= ${d} 196 .endfor 197 198 cleandir: 199 rm -f ${CLEANFILES} 200