1 # $NetBSD: Makefile,v 1.77 2003/12/04 10:08:58 mrg Exp $ 2 3 .include <bsd.own.mk> 4 5 .if ${TOOLCHAIN_MISSING} != "yes" 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 gencat hexdump lint lint2 lorder \ 26 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 file installboot \ 32 lint1 makefs menuc mkcsmapper mkesdb mklocale mknod msgc pax \ 33 pwd_mkdb stat sunlabel zic 34 35 .if ${MKMAN} != "no" 36 SUBDIR+= groff 37 .endif 38 39 .if ${MKMAINTAINERTOOLS:Uno} != "no" 40 SUBDIR+= autoconf gettext 41 .endif 42 43 .if ${MACHINE} == ibmnws 44 SUBDIR+= ibmnws-ncdcs 45 .endif 46 47 .if ${MACHINE} == prep 48 SUBDIR+= prep-mkbootimage 49 .endif 50 51 .if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb") 52 SUBDIR+= mips-elf2ecoff 53 .endif 54 55 .if (${MACHINE} == "sgimips") 56 SUBDIR+= sgivol 57 .endif 58 59 .if (${MACHINE} == "sparc" || ${MACHINE} == "sparc64") 60 SUBDIR+= fgen 61 .endif 62 63 .endif # ! NOSUBDIR # } 64 65 check_MKTOOLS: .PHONY .NOTMAIN 66 .if ${MKTOOLS:Uyes} == "no" 67 @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and' 68 @echo '*** updating your host toolchain. This should be used only as a' 69 @echo '*** temporary workaround for toolchain problems, as it will result' 70 @echo '*** in version skew and build errors over time!' 71 .endif 72 73 .if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # { 74 realall realdepend install: check_MKTOOLS 75 76 .for dir in ${SUBDIR:N.WAIT} 77 all-${dir} depend-${dir} dependall-${dir} install-${dir}: 78 @true 79 .endfor 80 .endif # } 81 82 .include <bsd.subdir.mk> 83 .include <bsd.obj.mk> 84 85 .if exists(PREVIOUSTOOLDIR) 86 PREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR 87 .else 88 PREVIOUSTOOLDIR= 89 .endif 90 91 CLEANFILES+= PREVIOUSTOOLDIR 92 93 realall realdepend: 94 .if (${PREVIOUSTOOLDIR} != ${TOOLDIR}) 95 @echo "*** WARNING: TOOLDIR has moved?" 96 @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'" 97 @echo "*** != TOOLDIR '${TOOLDIR}'" 98 @echo "*** Cleaning mis-matched tools" 99 rm -f PREVIOUSTOOLDIR 100 ${MAKE} cleandir 101 .endif 102 echo ${TOOLDIR} > PREVIOUSTOOLDIR 103 104 # For each .WAIT point, make sure the immediately preceding target is 105 # installed before building anything after that point. 106 # 107 # We use the "internal" targets and dependencies generated by <bsd.subdir.mk> 108 # to achieve this. These targets look like: 109 # subdir-all: all-dir1 [.WAIT] all-dir2 etc.. 110 # subdir-install: install-dir1 [.WAIT] install-dir2 etc.. 111 # and so on for each element in ${TARGETS}, with .WAIT sources inserted at 112 # places corresponding to the .WAITs in our $SUBDIR variable. 113 # 114 # Also, since we're now mixing `install' with `all' and `depend' targets 115 # an order relationship between those in each individual subdirectory 116 # must be established. 117 # 118 _deps:= 119 _prev:= 120 121 .for d in ${SUBDIR} 122 _this:= ${d} 123 124 .if ${_this} == ".WAIT" 125 126 # setup dependency to apply to all/depend targets in the next group 127 _deps:= ${_deps} ${_prev:S/^/install-/} 128 129 # if we're building *only* individual targets (i.e. "dependall-yacc"), 130 # make sure prerequisite tools build before installing 131 .if !make(all) && !make(dependall) 132 install-${_prev}: dependall-${_prev} 133 .endif 134 135 .else 136 137 # order depend/all/install targets for ${d} subdir. Note the additional 138 # .WAIT to achieve "closure" of the predecessor/successor relationships. 139 .ORDER: depend-${d} all-${d} dependall-${d} .WAIT install-${d} 140 141 # make all/depend-${d} dependent on list of install targets 142 depend-${d} all-${d} dependall-${d}: ${_deps} 143 144 .endif 145 146 # stash current name in case the next entry is .WAIT 147 _prev:= ${d} 148 .endfor 149 150 cleandir: 151 rm -f ${CLEANFILES} 152