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