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