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