2008-10-13 22:11:15 +04:00
|
|
|
# $NetBSD: Makefile,v 1.121 2008/10/13 18:11:15 dyoung Exp $
|
2001-08-14 15:01:55 +04:00
|
|
|
|
2001-09-22 08:15:19 +04:00
|
|
|
.include <bsd.own.mk>
|
|
|
|
|
2008-08-24 09:53:36 +04:00
|
|
|
.if defined(HAVE_GCC)
|
2006-05-11 05:15:32 +04:00
|
|
|
.if ${HAVE_GCC} == "4"
|
2006-03-30 01:10:52 +04:00
|
|
|
TOOLCHAIN_BITS= gmake .WAIT
|
|
|
|
.endif
|
2004-01-03 17:04:27 +03:00
|
|
|
.if ${TOOLCHAIN_MISSING} == "no"
|
2006-03-30 01:10:52 +04:00
|
|
|
TOOLCHAIN_BITS+= binutils .WAIT
|
2003-12-04 13:08:58 +03:00
|
|
|
TOOLCHAIN_BITS+= gcc
|
2006-06-03 02:16:18 +04:00
|
|
|
. if ${MKCROSSGDB:Uno} != "no"
|
2003-10-26 04:06:27 +03:00
|
|
|
TOOLCHAIN_BITS+= gdb
|
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
|
2008-08-24 09:53:36 +04:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.if defined(HAVE_PCC)
|
|
|
|
TOOLCHAIN_BITS= gmake .WAIT
|
|
|
|
.if ${TOOLCHAIN_MISSING} == "no"
|
|
|
|
TOOLCHAIN_BITS+= binutils .WAIT
|
|
|
|
TOOLCHAIN_BITS+= pcc
|
|
|
|
.endif
|
|
|
|
TOOLCHAIN_BITS+= .WAIT dbsym mdsetimage
|
|
|
|
.endif
|
2002-01-29 13:20:28 +03:00
|
|
|
|
2006-06-23 00:03:41 +04:00
|
|
|
LINT_BITS=
|
|
|
|
.if ${MKLINT} != "no"
|
|
|
|
LINT_BITS= lint lint2
|
|
|
|
.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 \
|
2006-11-22 18:08:47 +03:00
|
|
|
binstall .WAIT mktemp .WAIT \
|
2007-01-14 19:17:29 +03:00
|
|
|
cap_mkdb crunchgen ctags genassym gencat hexdump join \
|
2006-06-23 00:03:41 +04:00
|
|
|
${LINT_BITS} \
|
2008-10-06 00:11:54 +04:00
|
|
|
lorder m4 makewhatis mkdep mtree rpcgen tsort uudecode \
|
|
|
|
sed .WAIT \
|
2002-02-01 01:43:33 +03:00
|
|
|
texinfo .WAIT \
|
2001-11-13 02:16:17 +03:00
|
|
|
yacc .WAIT \
|
|
|
|
lex .WAIT \
|
2002-02-01 01:43:33 +03:00
|
|
|
${TOOLCHAIN_BITS} \
|
2007-11-12 17:54:43 +03:00
|
|
|
asn1_compile atf-compile cat cksum compile_et config db \
|
2005-06-13 00:24:14 +04:00
|
|
|
file lint1 \
|
Make disklabel(8) and fdisk(8) into "host tools " last step: build
and install ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-disklabel,
${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-fdisk by "reaching over" to
the sources in ${NETBSDSRCDIR}/sbin/{disklabel fdisk}/.
To avoid clashes with a build-host's header files, especially on
*BSD, the host-tools versions of fdisk and disklabel search for
#includes such as disklabel.h, disklabel_acorn.h, disklabel_gpt.h,
and bootinfo.h in a new #includes namespace, nbinclude/. That is,
they #include <nbinclude/sys/disklabel.h>, <nbinclude/machine/disklabel.h>,
<nbinclude/sparc64/disklabel.h>, instead of <sys/disklabel.h> and
such. I have also updated the system headers to #include from
nbinclude/-space when HAVE_NBTOOL_CONFIG_H is #defined.
2005-06-12 23:46:15 +04:00
|
|
|
makefs menuc mkcsmapper mkesdb mklocale mknod msgc \
|
|
|
|
pax .WAIT \
|
2005-10-04 08:27:32 +04:00
|
|
|
disklabel .WAIT \
|
2006-11-22 18:08:47 +03:00
|
|
|
paxctl .WAIT \
|
2005-10-04 08:27:32 +04:00
|
|
|
fdisk .WAIT \
|
|
|
|
installboot .WAIT \
|
2008-09-26 22:23:09 +04:00
|
|
|
pwd_mkdb stat strfile sunlabel zic
|
2001-12-12 00:17:56 +03:00
|
|
|
|
2008-10-13 22:11:15 +04:00
|
|
|
.if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no"
|
2002-03-07 21:57:18 +03:00
|
|
|
SUBDIR+= groff
|
|
|
|
.endif
|
|
|
|
|
2001-12-12 00:17:56 +03:00
|
|
|
.if ${MKMAINTAINERTOOLS:Uno} != "no"
|
2006-07-18 08:24:52 +04:00
|
|
|
SUBDIR+= autoconf .WAIT gettext
|
2004-07-28 13:17:31 +04:00
|
|
|
.endif
|
|
|
|
|
2004-11-28 14:14:41 +03:00
|
|
|
.if ${MACHINE} == "hp700"
|
2004-07-28 13:17:31 +04:00
|
|
|
SUBDIR+= hp700-mkboot
|
2001-12-12 00:17:56 +03:00
|
|
|
.endif
|
2002-01-05 10:03:30 +03:00
|
|
|
|
2004-11-28 14:14:41 +03:00
|
|
|
.if ${MACHINE} == "ibmnws"
|
2003-10-19 07:35:30 +04:00
|
|
|
SUBDIR+= ibmnws-ncdcs
|
|
|
|
.endif
|
|
|
|
|
2004-11-28 14:14:41 +03:00
|
|
|
.if ${MACHINE} == "macppc"
|
2003-12-11 03:29:33 +03:00
|
|
|
SUBDIR+= macppc-fixcoff
|
|
|
|
.endif
|
|
|
|
|
2008-05-01 01:18:17 +04:00
|
|
|
.if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox")
|
2008-05-01 01:15:33 +04:00
|
|
|
SUBDIR+= powerpc-mkbootimage
|
2002-05-04 00:35:46 +04:00
|
|
|
.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
|
|
|
|
|
2004-06-09 01:44:46 +04:00
|
|
|
.if ${MACHINE} == "acorn32"
|
|
|
|
SUBDIR+= sparkcrc
|
|
|
|
.endif
|
|
|
|
|
2002-05-29 01:56:05 +04:00
|
|
|
.if (${MACHINE} == "sparc" || ${MACHINE} == "sparc64")
|
|
|
|
SUBDIR+= fgen
|
|
|
|
.endif
|
|
|
|
|
2004-11-28 10:00:52 +03:00
|
|
|
.if ${MACHINE} == "amiga"
|
|
|
|
SUBDIR+= amiga-elf2bb
|
|
|
|
SUBDIR+= amiga-txlt
|
|
|
|
.endif
|
|
|
|
|
2004-11-28 14:14:41 +03:00
|
|
|
.if ${MACHINE} == "hp300"
|
|
|
|
SUBDIR+= hp300-mkboot
|
|
|
|
.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
|
|
|
|
2006-07-17 17:54:46 +04:00
|
|
|
.if !defined(PREVIOUSTOOLDIR)
|
|
|
|
. if exists(PREVIOUSTOOLDIR)
|
2003-07-16 16:57:57 +04:00
|
|
|
PREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR
|
2006-07-17 17:54:46 +04:00
|
|
|
. else
|
2003-07-16 16:57:57 +04:00
|
|
|
PREVIOUSTOOLDIR=
|
2006-07-17 17:54:46 +04:00
|
|
|
. endif
|
2003-07-16 16:57:57 +04:00
|
|
|
.endif
|
|
|
|
|
|
|
|
CLEANFILES+= PREVIOUSTOOLDIR
|
|
|
|
|
2006-07-17 15:02:02 +04:00
|
|
|
realall realdepend: .MAKE
|
2006-10-08 19:21:00 +04:00
|
|
|
.if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}"
|
2003-07-16 16:57:57 +04:00
|
|
|
@echo "*** WARNING: TOOLDIR has moved?"
|
|
|
|
@echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'"
|
|
|
|
@echo "*** != TOOLDIR '${TOOLDIR}'"
|
|
|
|
@echo "*** Cleaning mis-matched tools"
|
|
|
|
rm -f PREVIOUSTOOLDIR
|
2006-08-03 21:11:05 +04:00
|
|
|
(cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir)
|
2003-07-16 16:57:57 +04:00
|
|
|
.endif
|
2006-07-17 17:54:46 +04:00
|
|
|
echo ${TOOLDIR} >PREVIOUSTOOLDIR
|
2003-07-16 16:57:57 +04:00
|
|
|
|
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.
|
2006-11-18 00:54:55 +03:00
|
|
|
# (dsl: which means that with: 'a b .WAIT c' the build of 'c' waits for the
|
|
|
|
# install of 'b', but not the install of 'a'.)
|
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
|
2006-11-18 00:54:55 +03:00
|
|
|
# XXX: dsl: this is likely to generate a dependency loop since there is
|
|
|
|
# a .ORDER releation between the nodes as well.
|
|
|
|
.if !make(all) && !make(dependall) && !make(install)
|
2002-03-07 22:12:33 +03:00
|
|
|
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
|
|
|
|
2006-11-18 00:54:55 +03:00
|
|
|
# order depend/all/install targets for ${d} subdir.
|
|
|
|
.ORDER: depend-${d} all-${d} dependall-${d} install-${d}
|
2002-03-07 22:12:33 +03:00
|
|
|
|
2006-08-03 21:11:05 +04:00
|
|
|
# prevent cleandir in real{all,depend} from interfering with subdir makes
|
|
|
|
.ORDER: realdepend dependall-${d}
|
|
|
|
.ORDER: realdepend depend-${d}
|
|
|
|
.ORDER: realall all-${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}
|