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