Home | History | Annotate | Line # | Download | only in tools
Makefile revision 1.89
      1 #	$NetBSD: Makefile,v 1.89 2005/05/30 15:51:36 thorpej 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 genassym gencat hexdump lint lint2 \
     26 		lorder 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 .if ${MACHINE} == "amiga"
     81 SUBDIR+=	amiga-elf2bb
     82 SUBDIR+=	amiga-txlt
     83 .endif
     84 
     85 .if ${MACHINE} == "hp300"
     86 SUBDIR+=	hp300-mkboot
     87 .endif
     88 
     89 .endif	# ! NOSUBDIR					# }
     90 
     91 check_MKTOOLS: .PHONY .NOTMAIN
     92 .if ${MKTOOLS:Uyes} == "no"
     93 	@echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
     94 	@echo '*** updating your host toolchain.  This should be used only as a'
     95 	@echo '*** temporary workaround for toolchain problems, as it will result'
     96 	@echo '*** in version skew and build errors over time!'
     97 .endif
     98 
     99 .if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes"	# {
    100 realall realdepend install: check_MKTOOLS
    101 
    102 .for dir in ${SUBDIR:N.WAIT}
    103 all-${dir} depend-${dir} dependall-${dir} install-${dir}:
    104 	@true
    105 .endfor
    106 .endif							# }
    107 
    108 .include <bsd.subdir.mk>
    109 .include <bsd.obj.mk>
    110 
    111 .if exists(PREVIOUSTOOLDIR)
    112 PREVIOUSTOOLDIR!=	cat PREVIOUSTOOLDIR
    113 .else
    114 PREVIOUSTOOLDIR=	
    115 .endif
    116 
    117 CLEANFILES+=	PREVIOUSTOOLDIR
    118 
    119 realall realdepend:
    120 .if "${PREVIOUSTOOLDIR}" != "${TOOLDIR}"
    121 	@echo "*** WARNING: TOOLDIR has moved?"
    122 	@echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'"
    123 	@echo "***     !=  TOOLDIR '${TOOLDIR}'"
    124 	@echo "*** Cleaning mis-matched tools"
    125 	rm -f PREVIOUSTOOLDIR
    126 	(cd ${.CURDIR} && ${MAKE} cleandir)
    127 .endif
    128 	echo ${TOOLDIR} > PREVIOUSTOOLDIR
    129 
    130 # For each .WAIT point, make sure the immediately preceding target is
    131 # installed before building anything after that point.
    132 #
    133 # We use the "internal" targets and dependencies generated by <bsd.subdir.mk>
    134 # to achieve this. These targets look like:
    135 #	subdir-all:	all-dir1     [.WAIT] all-dir2     etc..
    136 #	subdir-install:	install-dir1 [.WAIT] install-dir2 etc..
    137 # and so on for each element in ${TARGETS}, with .WAIT sources inserted at
    138 # places corresponding to the .WAITs in our $SUBDIR variable.
    139 #
    140 # Also, since we're now mixing `install' with `all' and `depend' targets
    141 # an order relationship between those in each individual subdirectory
    142 # must be established.
    143 #
    144 _deps:=
    145 _prev:=
    146 
    147 .for d in ${SUBDIR}
    148 _this:=		${d}
    149 
    150 .if ${_this} == ".WAIT"
    151 
    152 # setup dependency to apply to all/depend targets in the next group
    153 _deps:=		${_deps} ${_prev:S/^/install-/}
    154 
    155 # if we're building *only* individual targets (i.e. "dependall-yacc"),
    156 # make sure prerequisite tools build before installing
    157 .if !make(all) && !make(dependall)
    158 install-${_prev}: dependall-${_prev}
    159 .endif
    160 
    161 .else
    162 
    163 # order depend/all/install targets for ${d} subdir.  Note the additional
    164 # .WAIT to achieve "closure" of the predecessor/successor relationships.
    165 .ORDER: depend-${d} all-${d} dependall-${d} .WAIT install-${d}
    166 
    167 # make all/depend-${d} dependent on list of install targets
    168 depend-${d} all-${d} dependall-${d}: ${_deps}
    169 
    170 .endif
    171 
    172 # stash current name in case the next entry is .WAIT
    173 _prev:=		${d}
    174 .endfor
    175 
    176 cleandir:
    177 	rm -f ${CLEANFILES}
    178