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