NetBSD/tools/Makefile
apb e95f6bc055 Make tools/Makefile build host-mkdep, compat, and binstall in that order,
before installing any of them.  It installs them in any order relative
to each other.  The .WAIT points that used to be between these three
tools are replaced by .ORDER and dependencies.

This is needed in preparation for making tools/compat install
some files into TOOLDIR.
2012-12-02 12:25:25 +00:00

236 lines
5.6 KiB
Makefile

# $NetBSD: Makefile,v 1.165 2012/12/02 12:25:25 apb Exp $
.include <bsd.own.mk>
# Make sure that the ordered build/install processing applies when using
# plain make.
.MAIN: build_install
# TOOLDIR must be valid, unless MKTOOLS=no
.if ${MKTOOLS:Uyes} != "no"
.if "${TOOLDIR}" == ""
.error "TOOLDIR is undefined or empty"
.elif "${TOOLDIR:tW:M/*}" == ""
.error "TOOLDIR is not an absolute path: ${TOOLDIR}"
#.elif !exists(TOOLDIR) # XXX .exists fails for directories
#.error "TOOLDIR does not exist: ${TOOLDIR}"
.endif
.endif # MKTOOLS != no
.if ${TOOLCHAIN_MISSING} == "no"
.if defined(HAVE_GCC)
TOOLCHAIN_BITS= gmake .WAIT
.endif
.if defined(HAVE_GCC)
.if ${HAVE_GCC} >= 45
TOOLCHAIN_BITS+= gmp .WAIT
TOOLCHAIN_BITS+= mpfr .WAIT
TOOLCHAIN_BITS+= mpc .WAIT
.endif
.endif
.endif
.if ${TOOLCHAIN_MISSING} == "no"
TOOLCHAIN_BITS+= binutils .WAIT
.endif
.if defined(HAVE_GCC)
.if ${TOOLCHAIN_MISSING} == "no"
TOOLCHAIN_BITS+= gcc
. if ${MKCROSSGDB:Uno} != "no"
TOOLCHAIN_BITS+= gdb
. endif
TOOLCHAIN_BITS+= .WAIT
.endif
.endif
.if defined(HAVE_PCC)
.if ${TOOLCHAIN_MISSING} == "no"
TOOLCHAIN_BITS+= pcc
.endif
.endif
.if ${TOOLCHAIN_MISSING} == "no"
# XXX Eventually, we want to be able to build dbsym and mdsetimage
# XXX if EXTERNAL_TOOLCHAIN is set.
TOOLCHAIN_BITS+= dbsym mdsetimage
.endif
DTRACE_BITS=
.if ${MKDTRACE} != "no"
DTRACE_BITS+= .WAIT libelf
DTRACE_BITS+= .WAIT libdwarf
DTRACE_BITS+= .WAIT libctf
DTRACE_BITS+= .WAIT ctfconvert ctfmerge
.endif
LINT_BITS=
.if ${MKLINT} != "no"
LINT_BITS= lint lint2
.endif
# All of host-mkdep, compat, and binstall are needed before anything
# else. Within this group, they must be built in a specific order, and
# all of them must be built before any of them is installed. They may
# be installed in any order. This can't be expressed using the .WAIT
# notation inside the SUBDIR list.
#
# XXX .ORDER does not work when multiple targets are passed on the
# make command line without "-j", so use dependencies in addition to .ORDER.
#
.ORDER: dependall-host-mkdep dependall-compat dependall-binstall
.if make(dependall-host-mkdep) && make(dependall-compat)
dependall-compat: dependall-host-mkdep
.endif
.if make(dependall-compat) && make(dependall-binstall)
dependall-binstall: dependall-compat
.endif
# Dependencies in SUBDIR below ordered to maximize parallel ability.
# See above for special treatment for host-mkdep, compat, and binstall.
#
SUBDIR= host-mkdep compat binstall \
.WAIT mktemp .WAIT sed .WAIT \
cap_mkdb crunchgen ctags genassym gencat hexdump join \
${LINT_BITS} \
lorder makewhatis mkdep mtree nbperf .WAIT rpcgen tsort \
uudecode m4 \
.WAIT texinfo \
.WAIT yacc \
.WAIT awk \
.WAIT tic \
.WAIT lex \
.WAIT pax \
.WAIT ${TOOLCHAIN_BITS} \
${DTRACE_BITS} \
asn1_compile cat cksum compile_et config db \
file lint1 slc \
makefs .WAIT menuc mkcsmapper mkesdb mklocale mknod msgc \
.WAIT disklabel \
.WAIT paxctl \
.WAIT fdisk \
.WAIT installboot \
pwd_mkdb stat strfile sunlabel zic
.if ${MKLLVM} != "no"
SUBDIR+= \
llvm .WAIT \
llvm-lib/libLLVMSupport llvm-lib/libLLVMTableGen .WAIT \
llvm-tblgen llvm-clang-tblgen .WAIT \
llvm-include .WAIT \
llvm-lib .WAIT \
llvm-clang
.endif
.if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no"
. if ${MKGROFF} != "no"
SUBDIR+= groff
. endif
SUBDIR+= mandoc
.endif
.if ${MKMAINTAINERTOOLS:Uno} != "no"
SUBDIR+= autoconf .WAIT gettext
.endif
.if ${USE_PIGZGZIP} != "no"
SUBDIR+= pigz
.endif
.if ${MACHINE} == "hp700"
SUBDIR+= hp700-mkboot
.endif
.if ${MACHINE} == "ibmnws"
SUBDIR+= ibmnws-ncdcs
.endif
.if ${MACHINE} == "macppc"
SUBDIR+= macppc-fixcoff
.endif
.if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox")
SUBDIR+= powerpc-mkbootimage
.endif
.if ${MACHINE_ARCH} == "m68k"
SUBDIR+= m68k-elf2aout
.endif
.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb")
SUBDIR+= mips-elf2ecoff
.endif
.if (${MACHINE} == "sgimips")
SUBDIR+= sgivol
.endif
.if ${MACHINE} == "acorn32"
SUBDIR+= sparkcrc
.endif
.if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64")
SUBDIR+= fgen
.endif
.if ${MACHINE} == "amiga"
SUBDIR+= amiga-elf2bb
SUBDIR+= amiga-txlt
.endif
.if ${MACHINE} == "hp300"
SUBDIR+= hp300-mkboot
.endif
.if ${MACHINE} == "evbarm" && ${MACHINE_ARCH} == "arm"
SUBDIR+= elftosb
.endif
.if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \
${MACHINE} == "evbppc" || ${MACHINE} == "sandpoint"
SUBDIR+= mkubootimage
.endif
check_MKTOOLS: .PHONY .NOTMAIN
.if ${MKTOOLS:Uyes} == "no"
@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'
@echo '*** in version skew and build errors over time!'
.endif
.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # {
SUBDIR= # empty
realall realdepend install: check_MKTOOLS
.endif # }
.include <bsd.subdir.mk>
.include <bsd.buildinstall.mk>
.include <bsd.obj.mk>
.if !defined(PREVIOUSTOOLDIR)
. if exists(PREVIOUSTOOLDIR)
PREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR
. else
PREVIOUSTOOLDIR=
. endif
.endif
CLEANFILES+= PREVIOUSTOOLDIR
realall realdepend: .MAKE
.if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}"
@echo "*** WARNING: TOOLDIR has moved?"
@echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'"
@echo "*** != TOOLDIR '${TOOLDIR}'"
@echo "*** Cleaning mis-matched tools"
rm -f PREVIOUSTOOLDIR
(cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir)
.endif
echo ${TOOLDIR} >PREVIOUSTOOLDIR
cleandir:
rm -f ${CLEANFILES}