NetBSD/tools/Makefile

286 lines
6.8 KiB
Makefile
Raw Normal View History

2024-05-31 23:52:58 +03:00
# $NetBSD: Makefile,v 1.221 2024/05/31 20:52:58 tsutsui Exp $
.include <bsd.own.mk>
.include <bsd.endian.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 '${TOOLDIR}' is not an absolute path
. endif
.endif # MKTOOLS != no
# TOOLS_BUILDRUMP == yes builds only the subset of the tools required
# for building rump kernels and the hypervisor. It is typically used
# when building rump kernels targeted for non-NetBSD systems (via
# buildrump.sh), and should not be set for a regular "make build".
TOOLS_BUILDRUMP?=no
.if ${TOOLCHAIN_MISSING} == "no"
. if (defined(HAVE_GCC) && ${HAVE_GCC} > 0) || \
(defined(HAVE_GDB) && ${HAVE_GDB} > 0 && ${MKCROSSGDB:Uno} != "no")
TOOLCHAIN_BITS+= gmake .WAIT
TOOLCHAIN_BITS+= gmp .WAIT
TOOLCHAIN_BITS+= mpfr .WAIT
TOOLCHAIN_BITS+= mpc .WAIT
2024-02-23 08:34:41 +03:00
. if (defined(HAVE_GCC) && ${HAVE_GCC} >= 12)
TOOLCHAIN_BITS+= isl .WAIT
. endif
. endif
TOOLCHAIN_BITS+= binutils .WAIT
. if defined(HAVE_GCC) && ${HAVE_GCC} > 0
2003-12-04 13:08:58 +03:00
TOOLCHAIN_BITS+= gcc
. endif
. if defined(HAVE_GDB) && ${HAVE_GDB} > 0 && ${MKCROSSGDB:Uno} != "no"
TOOLCHAIN_BITS+= gdb
. endif
TOOLCHAIN_BITS+= .WAIT
2008-08-24 09:53:36 +04:00
.endif
.if defined(HAVE_PCC)
. if ${TOOLCHAIN_MISSING} == "no"
2008-08-24 09:53:36 +04:00
TOOLCHAIN_BITS+= pcc
. endif
2008-08-24 09:53:36 +04:00
.endif
.if ${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN)
TOOLCHAIN_BITS+= dbsym mdsetimage
2012-09-20 19:50:20 +04:00
.endif
DTRACE_BITS=
.if ${MKDTRACE} != "no" || ${MKCTF} != "no"
DTRACE_BITS+= .WAIT elftoolchain/common
DTRACE_BITS+= .WAIT elftoolchain/libelf
DTRACE_BITS+= .WAIT elftoolchain/libdwarf
2012-12-02 15:19:45 +04:00
DTRACE_BITS+= .WAIT libctf
.endif
.if ${MKCTF} != "no"
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 \
dependall-date
.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
.if make(dependall-date)
dependall-date: dependall-host-mkdep dependall-compat
.endif
# Dependencies in SUBDIR below ordered to maximize parallel ability.
# See above for special treatment for host-mkdep, compat, and binstall.
#
2021-05-26 23:19:15 +03:00
SUBDIR= host-mkdep compat binstall date \
2014-12-05 04:50:47 +03:00
.WAIT mktemp .WAIT sed .WAIT genassym
.if ${TOOLS_BUILDRUMP} == "no"
2014-12-05 04:50:47 +03:00
SUBDIR+= cap_mkdb crunchgen ctags gencat hexdump \
${LINT_BITS} \
makewhatis mtree nbperf .WAIT uudecode
.endif
SUBDIR+= cat gzip rpcgen join lorder m4 mkdep tsort .WAIT yacc .WAIT awk .WAIT lex
.if ${TOOLS_BUILDRUMP} == "no"
SUBDIR+= xz-include .WAIT grep xz-lib pax .WAIT libprop
SUBDIR += .WAIT texinfo \
.WAIT tic \
.WAIT ${TOOLCHAIN_BITS} \
${DTRACE_BITS} \
asn1_compile cksum compile_et db \
file lint1 slc \
2015-12-19 04:10:31 +03:00
makefs sortinfo \
.WAIT menuc mkcsmapper mkesdb mklocale mknod msgc \
2014-09-30 23:38:25 +04:00
.WAIT disklabel gpt \
.WAIT paxctl \
.WAIT fdisk \
.WAIT installboot \
2014-07-15 17:19:44 +04:00
pwd_mkdb strfile sunlabel vgrind zic
.endif
SUBDIR+= stat .WAIT config
.if ${TOOLS_BUILDRUMP} == "no"
SUBDIR+= xz-bin
.endif
.if ${MKLLVM} != "no" || ${MKLLVMRT} != "no"
SUBDIR+= \
llvm .WAIT \
llvm-lib/libLLVMDemangle llvm-lib/libLLVMSupport llvm-lib/libLLVMTableGen .WAIT \
llvm-tblgen
.endif
.if ${MKLLVM} != "no"
SUBDIR+= \
llvm-clang-tblgen
.endif
.if ${MKLLVM} != "no" && !defined(EXTERNAL_TOOLCHAIN)
SUBDIR+= \
.WAIT llvm-include .WAIT \
2019-04-03 18:12:44 +03:00
llvm-lib .WAIT \
llvm-clang
.endif
.if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no"
. if ${MKGROFF} != "no"
SUBDIR+= groff
. endif
SUBDIR+= mandoc
.endif
.if ${TOOLS_BUILDRUMP} == "no"
.if ${MKMAINTAINERTOOLS:Uno} != "no"
SUBDIR+= autoconf .WAIT gettext
.endif
.if ${USE_PIGZGZIP} != "no"
SUBDIR+= pigz
.endif
.if ${MACHINE} == "hppa"
SUBDIR+= hppa-mkboot
.endif
.if ${MACHINE} == "ibmnws"
2003-10-19 07:35:30 +04:00
SUBDIR+= ibmnws-ncdcs
.endif
.if ${MACHINE} == "macppc"
2003-12-11 03:29:33 +03:00
SUBDIR+= macppc-fixcoff
.endif
.if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox")
SUBDIR+= powerpc-mkbootimage
.endif
2019-01-02 16:29:22 +03:00
.if ${MACHINE_CPU} == "arm"
SUBDIR+= arm-elf2aout
.endif
2019-01-02 16:29:22 +03:00
.if ${MACHINE_CPU} == "m68k"
SUBDIR+= m68k-elf2aout
.endif
.if !empty(MACHINE_ARCH:Mmips*)
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_CPU} == "arm" \
&& ${TARGET_ENDIANNESS} == "1234"
SUBDIR+= elftosb
.endif
2021-11-14 18:48:02 +03:00
.if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \
${MACHINE} == "evbppc" || ${MACHINE} == "evbsh3" || \
${MACHINE} == "sandpoint" || \
${MACHINE_CPU} == "riscv"
2024-05-23 05:50:47 +03:00
SUBDIR+= mkubootimage
SUBDIR+= libfdt .WAIT
SUBDIR+= dtc
2010-06-18 22:57:27 +04:00
.endif
.if ${MACHINE} == "mvme68k"
SUBDIR+= mvme68k-wrtvid
.endif
2024-05-31 23:52:58 +03:00
.if ${MACHINE} == "mac68k" || ${MACHINE} == "macppc"
SUBDIR+= mkhybrid
.endif
.if ${MKX11} != "no"
SUBDIR+= makestrs
SUBDIR+= makekeys
.endif
2016-01-25 01:49:08 +03:00
SUBDIR+= cvslatest
.endif # TOOLS_BUILDRUMP == no
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'
2001-12-29 18:45:52 +03:00
@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
2012-12-02 15:19:45 +04:00
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
2003-07-24 17:00:52 +04:00
cleandir:
rm -f ${CLEANFILES}