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