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