2004-01-03 17:04:27 +03:00
|
|
|
# $NetBSD: Makefile,v 1.81 2004/01/03 14:04:27 lukem Exp $
|
2001-08-14 15:01:55 +04:00
|
|
|
|
2001-09-22 08:15:19 +04:00
|
|
|
.include <bsd.own.mk>
|
|
|
|
|
2004-01-03 17:04:27 +03:00
|
|
|
.if ${TOOLCHAIN_MISSING} == "no"
|
2003-12-04 13:08:58 +03:00
|
|
|
TOOLCHAIN_BITS= binutils .WAIT
|
2003-07-25 20:26:51 +04:00
|
|
|
. if ${USE_TOOLS_TOOLCHAIN} != "yes"
|
2003-12-04 13:08:58 +03:00
|
|
|
TOOLCHAIN_BITS+= gcc
|
2003-10-26 04:06:27 +03:00
|
|
|
. if ${MKCROSSGDB:Uno} != "no"
|
|
|
|
TOOLCHAIN_BITS+= gdb
|
|
|
|
. endif
|
2003-07-25 20:26:51 +04:00
|
|
|
. else
|
2003-12-04 13:08:58 +03:00
|
|
|
TOOLCHAIN_BITS+= toolchain
|
2003-07-25 20:26:51 +04:00
|
|
|
. endif
|
|
|
|
TOOLCHAIN_BITS+= .WAIT dbsym mdsetimage
|
* Eliminate the USE_NEW_TOOLCHAIN variable. Instead, split it into
two variables:
TOOLCHAIN_MISSING -- set to "yes" on platforms for which there is
no working in-tree toolchain (hppa, ns32k, sh5, x86_64).
EXTERNAL_TOOLCHAIN -- if defined by the user, points to the root of
an external toolchain (e.g. /usr/local/gnu). This enables the cross-build
framework even for TOOLCHAIN_MISSING platforms.
If TOOLCHAIN_MISSING is set to "yes", MKGDB, MKBFD, and MKGCC are all
unconditionally set to "no", since the bits are not there to build.
If EXTERNAL_TOOLCHAIN is set, MKGCC is unconditionally set to "no",
since the external toolchain's compiler is not in-sync with the
in-tree compiler support components (e.g. libgcc).
* Set MACHINE_CPU much earlier in bsd.own.mk, so that more tests in
that file can use it.
2002-09-18 03:18:25 +04:00
|
|
|
# XXX Eventually, we want to be able to build dbsym and mdsetimage
|
|
|
|
# XXX if EXTERNAL_TOOLCHAIN is set.
|
2002-01-29 13:20:28 +03:00
|
|
|
.endif
|
|
|
|
|
2001-11-13 02:16:17 +03:00
|
|
|
# Dependencies in SUBDIR below ordered to maximize parallel ability.
|
2002-05-18 09:59:23 +04:00
|
|
|
.if !defined(NOSUBDIR) # {
|
|
|
|
|
2002-01-10 20:04:20 +03:00
|
|
|
SUBDIR= host-mkdep .WAIT compat .WAIT \
|
2002-09-15 03:34:16 +04:00
|
|
|
binstall .WAIT mktemp .WAIT \
|
2003-03-07 04:14:30 +03:00
|
|
|
cap_mkdb crunchgen ctags gencat hexdump lint lint2 lorder \
|
2002-02-01 01:43:33 +03:00
|
|
|
m4 makewhatis mkdep mtree rpcgen tsort uudecode \
|
|
|
|
texinfo .WAIT \
|
2001-11-13 02:16:17 +03:00
|
|
|
yacc .WAIT \
|
|
|
|
lex .WAIT \
|
2002-02-01 01:43:33 +03:00
|
|
|
${TOOLCHAIN_BITS} \
|
2003-05-18 12:05:32 +04:00
|
|
|
asn1_compile cat cksum compile_et config db file installboot \
|
2003-10-27 03:35:37 +03:00
|
|
|
lint1 makefs menuc mkcsmapper mkesdb mklocale mknod msgc pax \
|
2003-07-20 18:06:32 +04:00
|
|
|
pwd_mkdb stat sunlabel zic
|
2001-12-12 00:17:56 +03:00
|
|
|
|
2002-03-07 21:57:18 +03:00
|
|
|
.if ${MKMAN} != "no"
|
|
|
|
SUBDIR+= groff
|
|
|
|
.endif
|
|
|
|
|
2001-12-12 00:17:56 +03:00
|
|
|
.if ${MKMAINTAINERTOOLS:Uno} != "no"
|
2002-02-26 21:14:40 +03:00
|
|
|
SUBDIR+= autoconf gettext
|
2001-12-12 00:17:56 +03:00
|
|
|
.endif
|
2002-01-05 10:03:30 +03:00
|
|
|
|
2003-10-19 07:35:30 +04:00
|
|
|
.if ${MACHINE} == ibmnws
|
|
|
|
SUBDIR+= ibmnws-ncdcs
|
|
|
|
.endif
|
|
|
|
|
2003-12-11 17:52:46 +03:00
|
|
|
.if ${MACHINE} == macppc
|
2003-12-11 03:29:33 +03:00
|
|
|
SUBDIR+= macppc-fixcoff
|
|
|
|
.endif
|
|
|
|
|
2002-05-04 00:35:46 +04:00
|
|
|
.if ${MACHINE} == prep
|
|
|
|
SUBDIR+= prep-mkbootimage
|
|
|
|
.endif
|
|
|
|
|
2002-02-24 00:32:27 +03:00
|
|
|
.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb")
|
|
|
|
SUBDIR+= mips-elf2ecoff
|
|
|
|
.endif
|
|
|
|
|
2003-11-08 08:02:33 +03:00
|
|
|
.if (${MACHINE} == "sgimips")
|
|
|
|
SUBDIR+= sgivol
|
|
|
|
.endif
|
|
|
|
|
2002-05-29 01:56:05 +04:00
|
|
|
.if (${MACHINE} == "sparc" || ${MACHINE} == "sparc64")
|
|
|
|
SUBDIR+= fgen
|
|
|
|
.endif
|
|
|
|
|
2002-05-18 09:59:23 +04:00
|
|
|
.endif # ! NOSUBDIR # }
|
2001-08-14 15:01:55 +04:00
|
|
|
|
2003-07-16 16:57:57 +04:00
|
|
|
check_MKTOOLS: .PHONY .NOTMAIN
|
2001-11-22 22:09:42 +03:00
|
|
|
.if ${MKTOOLS:Uyes} == "no"
|
2001-11-13 19:17:24 +03:00
|
|
|
@echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
|
|
|
|
@echo '*** updating your host toolchain. This should be used only as a'
|
|
|
|
@echo '*** temporary workaround for toolchain problems, as it will result'
|
2001-12-29 18:45:52 +03:00
|
|
|
@echo '*** in version skew and build errors over time!'
|
2001-11-22 03:13:10 +03:00
|
|
|
.endif
|
2001-11-13 19:17:24 +03:00
|
|
|
|
2003-07-16 16:57:57 +04:00
|
|
|
.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # {
|
2003-07-16 17:13:42 +04:00
|
|
|
realall realdepend install: check_MKTOOLS
|
2003-07-16 16:57:57 +04:00
|
|
|
|
2001-11-13 19:17:24 +03:00
|
|
|
.for dir in ${SUBDIR:N.WAIT}
|
|
|
|
all-${dir} depend-${dir} dependall-${dir} install-${dir}:
|
|
|
|
@true
|
|
|
|
.endfor
|
2003-07-16 16:57:57 +04:00
|
|
|
.endif # }
|
2001-11-13 19:17:24 +03:00
|
|
|
|
2001-08-14 15:01:55 +04:00
|
|
|
.include <bsd.subdir.mk>
|
2001-10-31 04:20:09 +03:00
|
|
|
.include <bsd.obj.mk>
|
2001-10-31 20:46:08 +03:00
|
|
|
|
2003-07-16 16:57:57 +04:00
|
|
|
.if exists(PREVIOUSTOOLDIR)
|
|
|
|
PREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR
|
|
|
|
.else
|
|
|
|
PREVIOUSTOOLDIR=
|
|
|
|
.endif
|
|
|
|
|
|
|
|
CLEANFILES+= PREVIOUSTOOLDIR
|
|
|
|
|
2003-07-16 17:13:42 +04:00
|
|
|
realall realdepend:
|
2003-07-16 16:57:57 +04:00
|
|
|
.if (${PREVIOUSTOOLDIR} != ${TOOLDIR})
|
|
|
|
@echo "*** WARNING: TOOLDIR has moved?"
|
|
|
|
@echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'"
|
|
|
|
@echo "*** != TOOLDIR '${TOOLDIR}'"
|
|
|
|
@echo "*** Cleaning mis-matched tools"
|
|
|
|
rm -f PREVIOUSTOOLDIR
|
2003-12-10 08:19:41 +03:00
|
|
|
(cd ${.CURDIR} && ${MAKE} cleandir)
|
2003-07-16 16:57:57 +04:00
|
|
|
.endif
|
|
|
|
echo ${TOOLDIR} > PREVIOUSTOOLDIR
|
|
|
|
|
2002-03-07 22:12:33 +03:00
|
|
|
# For each .WAIT point, make sure the immediately preceding target is
|
|
|
|
# installed before building anything after that point.
|
2002-02-18 18:35:53 +03:00
|
|
|
#
|
|
|
|
# We use the "internal" targets and dependencies generated by <bsd.subdir.mk>
|
|
|
|
# to achieve this. These targets look like:
|
|
|
|
# subdir-all: all-dir1 [.WAIT] all-dir2 etc..
|
|
|
|
# subdir-install: install-dir1 [.WAIT] install-dir2 etc..
|
|
|
|
# and so on for each element in ${TARGETS}, with .WAIT sources inserted at
|
|
|
|
# places corresponding to the .WAITs in our $SUBDIR variable.
|
|
|
|
#
|
|
|
|
# Also, since we're now mixing `install' with `all' and `depend' targets
|
|
|
|
# an order relationship between those in each individual subdirectory
|
|
|
|
# must be established.
|
|
|
|
#
|
2002-03-07 22:12:33 +03:00
|
|
|
_deps:=
|
|
|
|
_prev:=
|
|
|
|
|
2001-11-13 02:16:17 +03:00
|
|
|
.for d in ${SUBDIR}
|
|
|
|
_this:= ${d}
|
2002-03-07 22:12:33 +03:00
|
|
|
|
2001-11-13 02:16:17 +03:00
|
|
|
.if ${_this} == ".WAIT"
|
2002-02-18 18:35:53 +03:00
|
|
|
|
|
|
|
# setup dependency to apply to all/depend targets in the next group
|
2002-03-07 22:12:33 +03:00
|
|
|
_deps:= ${_deps} ${_prev:S/^/install-/}
|
|
|
|
|
|
|
|
# if we're building *only* individual targets (i.e. "dependall-yacc"),
|
|
|
|
# make sure prerequisite tools build before installing
|
|
|
|
.if !make(all) && !make(dependall)
|
|
|
|
install-${_prev}: dependall-${_prev}
|
|
|
|
.endif
|
2002-02-18 18:35:53 +03:00
|
|
|
|
2001-11-13 02:16:17 +03:00
|
|
|
.else
|
2002-02-18 18:35:53 +03:00
|
|
|
|
|
|
|
# order depend/all/install targets for ${d} subdir. Note the additional
|
|
|
|
# .WAIT to achieve "closure" of the predecessor/successor relationships.
|
|
|
|
.ORDER: depend-${d} all-${d} dependall-${d} .WAIT install-${d}
|
2002-03-07 22:12:33 +03:00
|
|
|
|
|
|
|
# make all/depend-${d} dependent on list of install targets
|
|
|
|
depend-${d} all-${d} dependall-${d}: ${_deps}
|
2002-02-18 18:35:53 +03:00
|
|
|
|
2001-11-13 02:16:17 +03:00
|
|
|
.endif
|
2002-03-07 22:12:33 +03:00
|
|
|
|
|
|
|
# stash current name in case the next entry is .WAIT
|
|
|
|
_prev:= ${d}
|
2001-11-13 02:16:17 +03:00
|
|
|
.endfor
|
2003-07-24 17:00:52 +04:00
|
|
|
|
|
|
|
cleandir:
|
|
|
|
rm -f ${CLEANFILES}
|