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