xref: /netbsd/tools/Makefile (revision ee92d5a6)
1*ee92d5a6Spk#	$NetBSD: Makefile,v 1.36 2002/02/18 15:35:53 pk Exp $
2a328e341Stv
39fbd8888Stv# XXX Note: NO_DBSYM is a stopgap temporary variable for use
49fbd8888Stv# with the development of non-NetBSD hosting support.  This will go away.
5c5d597ceStv
614e39089Stv.include <bsd.own.mk>
714e39089Stv
888371dafSthorpej# XXX We can't currently build the toolchain for x86-64.
988371dafSthorpej.if ${MACHINE_ARCH} != "x86_64"
10a328e341StvTOOLCHAIN_BITS= toolchain .WAIT ${NO_DBSYM:D:Udbsym} mdsetimage
11a328e341Stv.endif
12a328e341Stv
13b5cd2489Stv# Dependencies in SUBDIR below ordered to maximize parallel ability.
14472dcba2Stv.if !defined(NOSUBDIR)
1554579742StvSUBDIR=	host-mkdep .WAIT compat .WAIT \
16b5cd2489Stv	binstall .WAIT \
179fbd8888Stv		cap_mkdb crunchgen ctags gencat lint lint2 lorder \
189fbd8888Stv		m4 makewhatis mkdep mtree rpcgen tsort uudecode \
199fbd8888Stv	texinfo .WAIT \
20b5cd2489Stv	yacc .WAIT \
21b5cd2489Stv		groff \
22b5cd2489Stv	lex .WAIT \
239fbd8888Stv	${TOOLCHAIN_BITS} \
249fbd8888Stv		asn1_compile compile_et config lint1 \
259fbd8888Stv		makefs menuc mklocale msgc pax pwd_mkdb zic
2687d14ee4Stv
2787d14ee4Stv.if ${MKMAINTAINERTOOLS:Uno} != "no"
289fbd8888StvSUBDIR+=	autoconf
2987d14ee4Stv.endif
30fc820c72Smrg
31fc820c72Smrg.if ${MACHINE} == sparc || ${MACHINE} == sparc64
32fc820c72SmrgSUBDIR+=	sparc-installboot
33fc820c72Smrg.endif
34472dcba2Stv.endif
35c5d597ceStv
360d11dd01Sjmc.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes"
37259ff4e7Stvrealall install: _warn
385a0f427eSjmc.if ${MKTOOLS:Uyes} == "no"
39259ff4e7Stv_warn:
40259ff4e7Stv	@echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
41259ff4e7Stv	@echo '*** updating your host toolchain.  This should be used only as a'
42259ff4e7Stv	@echo '*** temporary workaround for toolchain problems, as it will result'
43ecc52c58Swiz	@echo '*** in version skew and build errors over time!'
440d11dd01Sjmc.else
450d11dd01Sjmc_warn:
460d11dd01Sjmc.endif
47259ff4e7Stv
48259ff4e7Stv.for dir in ${SUBDIR:N.WAIT}
49259ff4e7Stvall-${dir} depend-${dir} dependall-${dir} install-${dir}:
50259ff4e7Stv	@true
51259ff4e7Stv.endfor
52259ff4e7Stv.endif
53259ff4e7Stv
54c5d597ceStv.include <bsd.subdir.mk>
55c9a6a2c3Stv.include <bsd.obj.mk>
5661be23b4Stv
57*ee92d5a6Spk# For each .WAIT point, make sure the previous targets are installed before
58b5cd2489Stv# building a dependent target.
59*ee92d5a6Spk#
60*ee92d5a6Spk# We use the "internal" targets and dependencies generated by <bsd.subdir.mk>
61*ee92d5a6Spk# to achieve this. These targets look like:
62*ee92d5a6Spk#	subdir-all:	all-dir1     [.WAIT] all-dir2     etc..
63*ee92d5a6Spk#	subdir-install:	install-dir1 [.WAIT] install-dir2 etc..
64*ee92d5a6Spk# and so on for each element in ${TARGETS}, with .WAIT sources inserted at
65*ee92d5a6Spk# places corresponding to the .WAITs in our $SUBDIR variable.
66*ee92d5a6Spk#
67*ee92d5a6Spk# In this Makefile we want additional depencies of the `all-dirN',
68*ee92d5a6Spk# `depend-dirN' and `dependall-dirN' targets in the Nth ".WAIT group" on all
69*ee92d5a6Spk# of the `install-dir[N-1]' targets in the previous ".WAIT group".
70*ee92d5a6Spk#
71*ee92d5a6Spk# Also, since we're now mixing `install' with `all' and `depend' targets
72*ee92d5a6Spk# an order relationship between those in each individual subdirectory
73*ee92d5a6Spk# must be established.
74*ee92d5a6Spk#
75354e70b7Spk_dep:=
76*ee92d5a6Spk_group:=
77b5cd2489Stv.for d in ${SUBDIR}
78b5cd2489Stv_this:=		${d}
79b5cd2489Stv.if ${_this} == ".WAIT"
80*ee92d5a6Spk
81*ee92d5a6Spk# setup dependency to apply to all/depend targets in the next group
82*ee92d5a6Spk_dep:=		${_group:S/^/install-/}
83*ee92d5a6Spk_group:=
84*ee92d5a6Spk
85b5cd2489Stv.else
86*ee92d5a6Spk
87*ee92d5a6Spk# build the current ".WAIT group"
88*ee92d5a6Spk_group:=	${_group} ${d}
89*ee92d5a6Spk# order depend/all/install targets for ${d} subdir.  Note the additional
90*ee92d5a6Spk# .WAIT to achieve "closure" of the predecessor/successor relationships.
91*ee92d5a6Spk.ORDER: depend-${d} all-${d} dependall-${d} .WAIT install-${d}
92*ee92d5a6Spk# make all/depend-${d} dependent on all install targets in the previous group
93354e70b7Spkdepend-${d} all-${d} dependall-${d}: ${_dep}
94*ee92d5a6Spk
95b5cd2489Stv.endif
96b5cd2489Stv.endfor
97b5cd2489Stv
9861be23b4Stvcleantools:
9961be23b4Stv	rm -r -f tools.${HOST_OSTYPE}
100