Home | History | Annotate | Line # | Download | only in tools
Makefile revision 1.73
      1 #	$NetBSD: Makefile,v 1.73 2003/10/21 10:01:22 lukem 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 	rm -f PREVIOUSTOOLDIR
     92 	${MAKE} cleandir
     93 .endif
     94 	echo ${TOOLDIR} > PREVIOUSTOOLDIR
     95 
     96 # For each .WAIT point, make sure the immediately preceding target is
     97 # installed before building anything after that point.
     98 #
     99 # We use the "internal" targets and dependencies generated by <bsd.subdir.mk>
    100 # to achieve this. These targets look like:
    101 #	subdir-all:	all-dir1     [.WAIT] all-dir2     etc..
    102 #	subdir-install:	install-dir1 [.WAIT] install-dir2 etc..
    103 # and so on for each element in ${TARGETS}, with .WAIT sources inserted at
    104 # places corresponding to the .WAITs in our $SUBDIR variable.
    105 #
    106 # Also, since we're now mixing `install' with `all' and `depend' targets
    107 # an order relationship between those in each individual subdirectory
    108 # must be established.
    109 #
    110 _deps:=
    111 _prev:=
    112 
    113 .for d in ${SUBDIR}
    114 _this:=		${d}
    115 
    116 .if ${_this} == ".WAIT"
    117 
    118 # setup dependency to apply to all/depend targets in the next group
    119 _deps:=		${_deps} ${_prev:S/^/install-/}
    120 
    121 # if we're building *only* individual targets (i.e. "dependall-yacc"),
    122 # make sure prerequisite tools build before installing
    123 .if !make(all) && !make(dependall)
    124 install-${_prev}: dependall-${_prev}
    125 .endif
    126 
    127 .else
    128 
    129 # order depend/all/install targets for ${d} subdir.  Note the additional
    130 # .WAIT to achieve "closure" of the predecessor/successor relationships.
    131 .ORDER: depend-${d} all-${d} dependall-${d} .WAIT install-${d}
    132 
    133 # make all/depend-${d} dependent on list of install targets
    134 depend-${d} all-${d} dependall-${d}: ${_deps}
    135 
    136 .endif
    137 
    138 # stash current name in case the next entry is .WAIT
    139 _prev:=		${d}
    140 .endfor
    141 
    142 cleandir:
    143 	rm -f ${CLEANFILES}
    144