[Midnightbsd-cvs] src [10241] trunk: update makefiles
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sat Jun 2 17:28:16 EDT 2018
Revision: 10241
http://svnweb.midnightbsd.org/src/?rev=10241
Author: laffer1
Date: 2018-06-02 17:28:15 -0400 (Sat, 02 Jun 2018)
Log Message:
-----------
update makefiles
Modified Paths:
--------------
trunk/Makefile
trunk/Makefile.inc1
Modified: trunk/Makefile
===================================================================
--- trunk/Makefile 2018-06-02 21:06:59 UTC (rev 10240)
+++ trunk/Makefile 2018-06-02 21:28:15 UTC (rev 10241)
@@ -1,5 +1,5 @@
-#
# $MidnightBSD$
+# $FreeBSD: stable/10/Makefile 321341 2017-07-21 17:58:06Z bdrewery $
#
# The user-driven targets are:
#
@@ -18,13 +18,15 @@
# reinstallkernel.debug
# kernel - buildkernel + installkernel.
# kernel-toolchain - Builds the subset of world necessary to build a kernel
+# kernel-toolchains - Build kernel-toolchain for all universe targets.
# doxygen - Build API documentation of the kernel, needs doxygen.
-# update - Convenient way to update your source tree (cvs).
+# update - Convenient way to update your source tree(s).
+# checkworld - Run test suite on installed world.
# check-old - List obsolete directories/files/libraries.
# check-old-dirs - List obsolete directories.
# check-old-files - List obsolete files.
# check-old-libs - List obsolete libraries.
-# delete-old - Delete obsolete directories/files/libraries.
+# delete-old - Delete obsolete directories/files.
# delete-old-dirs - Delete obsolete directories.
# delete-old-files - Delete obsolete files.
# delete-old-libs - Delete obsolete libraries.
@@ -31,6 +33,18 @@
# targets - Print a list of supported TARGET/TARGET_ARCH pairs
# for world and kernel targets.
# toolchains - Build a toolchain for all world and kernel targets.
+# xdev - xdev-build + xdev-install for the architecture
+# specified with XDEV and XDEV_ARCH.
+# xdev-build - Build cross-development tools.
+# xdev-install - Install cross-development tools.
+# native-xtools - Create host binaries that produce target objects
+# for use in qemu user-mode jails.
+#
+# "quick" way to test all kernel builds:
+# _jflag=`sysctl -n hw.ncpu`
+# _jflag=$(($_jflag * 2))
+# [ $_jflag -gt 12 ] && _jflag=12
+# make universe -DMAKE_JUST_KERNELS JFLAG=-j${_jflag}
#
# This makefile is simple by design. The MidnightBSD make automatically reads
# the /usr/share/mk/sys.mk unless the -m argument is specified on the
@@ -64,14 +78,14 @@
# 5. `reboot' (in single user mode: boot -s from the loader prompt).
# 6. `mergemaster -p'
# 7. `make installworld'
-# 8. `make delete-old'
-# 9. `mergemaster' (you may wish to use -i, along with -U or -F)
+# 8. `mergemaster' (you may wish to use -i, along with -U or -F).
+# 9. `make delete-old'
# 10. `reboot'
# 11. `make delete-old-libs' (in case no 3rd party program uses them anymore)
#
# See src/UPDATING `COMMON ITEMS' for more complete information.
#
-# If TARGET=machine (e.g. amd64, ...) is specified you can
+# If TARGET=machine (e.g. ia64, sparc64, ...) is specified you can
# cross build world for other machine types using the buildworld target,
# and once the world is built you can cross build a kernel using the
# buildkernel target.
@@ -86,26 +100,23 @@
# For more information, see the build(7) manual page.
#
TGTS= all all-man buildenv buildenvvars buildkernel buildworld \
- check-old check-old-dirs check-old-files check-old-libs \
- checkdpadd clean cleandepend cleandir \
+ check check-old check-old-dirs check-old-files check-old-libs \
+ checkdpadd checkworld clean cleandepend cleandir \
delete-old delete-old-dirs delete-old-files delete-old-libs \
depend distribute distributekernel distributekernel.debug \
distributeworld distrib-dirs distribution doxygen \
- everything hierarchy install installcheck installkernel \
+ everything hier hierarchy install installcheck installkernel \
installkernel.debug packagekernel packageworld \
reinstallkernel reinstallkernel.debug \
installworld kernel-toolchain libraries lint maninstall \
- obj objlink regress rerelease showconfig tags toolchain update \
+ obj objlink rerelease showconfig tags toolchain update \
_worldtmp _legacy _bootstrap-tools _cleanobj _obj \
_build-tools _cross-tools _includes _libraries _depend \
build32 builddtb distribute32 install32 xdev xdev-build xdev-install \
+ native-xtools \
TGTS+= ${SUBDIR_TARGETS}
-# XXX: clang integrated-as doesn't grok .codeNN directives yet
-CFLAGS.cdboot.S= ${CLANG_NO_IAS}
-CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
-
BITGTS= files includes
BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
TGTS+= ${BITGTS}
@@ -113,6 +124,8 @@
.ORDER: buildworld installworld
.ORDER: buildworld distributeworld
.ORDER: buildworld buildkernel
+.ORDER: installworld distribution
+.ORDER: installworld installkernel
.ORDER: buildkernel installkernel
.ORDER: buildkernel installkernel.debug
.ORDER: buildkernel reinstallkernel
@@ -127,19 +140,61 @@
.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\
(in make.conf(5)) or command-line variable.
.endif
-MAKEPATH= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}
-BINMAKE= \
- `if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \
+
+# We often need to use the tree's version of make to build it.
+# Choices add to complexity though.
+# We cannot blindly use a make which may not be the one we want
+# so be exlicit - until all choice is removed.
+.if !defined(WITHOUT_BMAKE)
+WANT_MAKE= bmake
+.else
+WANT_MAKE= fmake
+.endif
+MYMAKE= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}/${WANT_MAKE}
+.if defined(.PARSEDIR)
+HAVE_MAKE= bmake
+.else
+HAVE_MAKE= fmake
+.endif
+.if defined(ALWAYS_BOOTSTRAP_MAKE) || \
+ ${HAVE_MAKE} != ${WANT_MAKE} || \
+ (defined(WANT_MAKE_VERSION) && ${MAKE_VERSION} < ${WANT_MAKE_VERSION})
+NEED_MAKE_UPGRADE= t
+.endif
+.if exists(${MYMAKE})
+SUB_MAKE:= ${MYMAKE} -m ${.CURDIR}/share/mk
+.elif defined(NEED_MAKE_UPGRADE) || ${WANT_MAKE} != "bmake"
+# It may not exist yet but we may cause it to.
+# In the case of fmake, upgrade_checks may cause a newer version to be built.
+SUB_MAKE= `test -x ${MYMAKE} && echo ${MYMAKE} || echo ${MAKE}` \
-m ${.CURDIR}/share/mk
-_MAKE= PATH=${PATH} ${BINMAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH}
+.else
+SUB_MAKE= ${MAKE} -m ${.CURDIR}/share/mk
+.endif
+_MAKE= PATH=${PATH} ${SUB_MAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH}
+
# Guess machine architecture from machine type, and vice versa.
.if !defined(TARGET_ARCH) && defined(TARGET)
-_TARGET_ARCH= ${TARGET}
+_TARGET_ARCH= ${TARGET:S/pc98/i386/}
.elif !defined(TARGET) && defined(TARGET_ARCH) && \
${TARGET_ARCH} != ${MACHINE_ARCH}
-_TARGET= ${TARGET_ARCH}
+_TARGET= ${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/}
.endif
+# Legacy names, for another transition period mips:mips(n32|64)?eb -> mips:mips\1
+.if defined(TARGET) && defined(TARGET_ARCH) && \
+ ${TARGET} == "mips" && ${TARGET_ARCH:Mmips*eb}
+_TARGET_ARCH= ${TARGET_ARCH:C/eb$//}
+.warning "TARGET_ARCH of ${TARGET_ARCH} is deprecated in favor of ${_TARGET_ARCH}"
+.endif
+.if defined(TARGET) && ${TARGET} == "mips" && defined(TARGET_BIG_ENDIAN)
+.warning "TARGET_BIG_ENDIAN is no longer necessary for MIPS. Big-endian is not the default."
+.endif
+# arm with TARGET_BIG_ENDIAN -> armeb
+.if defined(TARGET_ARCH) && ${TARGET_ARCH} == "arm" && defined(TARGET_BIG_ENDIAN)
+.warning "TARGET_ARCH of arm with TARGET_BIG_ENDIAN is deprecated. use armeb"
+_TARGET_ARCH=armeb
+.endif
.if defined(TARGET) && !defined(_TARGET)
_TARGET=${TARGET}
.endif
@@ -156,7 +211,7 @@
# The user can define ALWAYS_CHECK_MAKE to have this check performed
# for all targets.
#
-.if defined(ALWAYS_CHECK_MAKE)
+.if defined(ALWAYS_CHECK_MAKE) || !defined(.PARSEDIR)
${TGTS}: upgrade_checks
.else
buildworld: upgrade_checks
@@ -171,10 +226,12 @@
#
# In the following, the first 'rm' in a series will usually remove all
# files and directories. If it does not, then there are probably some
-# files with chflags set, so this unsets them and tries the 'rm' a
+# files with file flags set, so this unsets them and tries the 'rm' a
# second time. There are situations where this target will be cleaning
# some directories via more than one method, but that duplication is
-# needed to correctly handle all the possible situations.
+# needed to correctly handle all the possible situations. Removing all
+# files without file flags set in the first 'rm' instance saves time,
+# because 'chflags' will need to operate on fewer files afterwards.
#
BW_CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR}
cleanworld:
@@ -196,7 +253,14 @@
# Handle the user-driven targets, using the source relative mk files.
#
-${TGTS}:
+.if !(!empty(.MAKEFLAGS:M-n) && ${.MAKEFLAGS:M-n} == "-n")
+# skip this for -n to avoid changing previous behavior of
+# 'make -n buildworld' etc. Using -n -n will run it.
+${TGTS}: .MAKE
+tinderbox toolchains kernel-toolchains: .MAKE
+.endif
+
+${TGTS}: .PHONY
${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET}
# The historic default "all" target creates files which may cause stale
@@ -276,7 +340,9 @@
# for building the world.
#
upgrade_checks:
-.if !defined(.PARSEDIR)
+.if defined(NEED_MAKE_UPGRADE)
+ @${_+_}(cd ${.CURDIR} && ${MAKE} ${WANT_MAKE:S,^f,,})
+.elif ${WANT_MAKE} == "fmake"
@if ! (cd ${.CURDIR}/tools/build/make_check && \
PATH=${PATH} ${BINMAKE} obj >/dev/null 2>&1 && \
PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \
@@ -290,31 +356,41 @@
# headers, libraries and tools. Also, allow the location of
# the system bsdmake-like utility to be overridden.
#
-MMAKEENV= MAKEOBJDIRPREFIX=${MAKEPATH} \
+MMAKEENV= MAKEOBJDIRPREFIX=${MYMAKE:H} \
DESTDIR= \
INSTALL="sh ${.CURDIR}/tools/install.sh"
MMAKE= ${MMAKEENV} ${MAKE} \
-D_UPGRADING \
-DNOMAN -DNO_MAN -DNOSHARED -DNO_SHARED \
- -DNO_CPU_CFLAGS -DNO_WERROR
+ -DNO_CPU_CFLAGS -DNO_WERROR \
+ DESTDIR= -DNO_TESTS PROGNAME=${MYMAKE:T}
-make: .PHONY
+make bmake: .PHONY
@echo
@echo "--------------------------------------------------------------"
@echo ">>> Building an up-to-date make(1)"
@echo "--------------------------------------------------------------"
- ${_+_}@cd ${.CURDIR}/usr.bin/make; \
- ${MMAKE} obj && \
- ${MMAKE} depend && \
- ${MMAKE} all && \
- ${MMAKE} install DESTDIR=${MAKEPATH} BINDIR=
+ ${_+_}@cd ${.CURDIR}/usr.bin/${.TARGET}; \
+ ${MMAKE} obj; \
+ ${MMAKE} depend; \
+ ${MMAKE} all; \
+ ${MMAKE} install DESTDIR=${MYMAKE:H} BINDIR=
+regress: .PHONY
+ @echo "'make regress' has been renamed 'make check'" | /usr/bin/fmt
+ @false
+
+tinderbox toolchains kernel-toolchains: upgrade_checks
+
tinderbox:
- @cd ${.CURDIR} && ${MAKE} DOING_TINDERBOX=YES universe
+ @cd ${.CURDIR}; ${SUB_MAKE} DOING_TINDERBOX=YES universe
toolchains:
- @cd ${.CURDIR} && ${MAKE} UNIVERSE_TARGET=toolchain universe
+ @cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=toolchain universe
+kernel-toolchains:
+ @cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=kernel-toolchain universe
+
#
# universe
#
@@ -323,7 +399,11 @@
# existing system is.
#
.if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets)
-TARGETS?=amd64 i386
+TARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64
+TARGET_ARCHES_arm?= arm armeb armv6
+TARGET_ARCHES_mips?= mipsel mips mips64el mips64 mipsn32
+TARGET_ARCHES_powerpc?= powerpc powerpc64
+TARGET_ARCHES_pc98?= i386
.for target in ${TARGETS}
TARGET_ARCHES_${target}?= ${target}
.endfor
@@ -350,7 +430,8 @@
MAKEFAIL=cat
.endif
-universe: universe_prologue upgrade_checks
+universe_prologue: upgrade_checks
+universe: universe_prologue
universe_prologue:
@echo "--------------------------------------------------------------"
@echo ">>> make universe started on ${STARTTIME}"
@@ -360,17 +441,17 @@
.endif
.for target in ${TARGETS}
universe: universe_${target}
-.ORDER: universe_prologue upgrade_checks universe_${target}_prologue universe_${target} universe_epilogue
+universe_epilogue: universe_${target}
universe_${target}: universe_${target}_prologue
-universe_${target}_prologue:
+universe_${target}_prologue: universe_prologue
@echo ">> ${target} started on `LC_ALL=C date`"
.if !defined(MAKE_JUST_KERNELS)
.for target_arch in ${TARGET_ARCHES_${target}}
universe_${target}: universe_${target}_${target_arch}
-universe_${target}_${target_arch}: universe_${target}_prologue
+universe_${target}_${target_arch}: universe_${target}_prologue .MAKE
@echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} started on `LC_ALL=C date`"
@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
- ${MAKE} ${JFLAG} ${UNIVERSE_TARGET} \
+ ${SUB_MAKE} ${JFLAG} ${UNIVERSE_TARGET} \
TARGET=${target} \
TARGET_ARCH=${target_arch} \
> _.${target}.${target_arch}.${UNIVERSE_TARGET} 2>&1 || \
@@ -381,13 +462,21 @@
.endfor
.endif
.if !defined(MAKE_JUST_WORLDS)
+# If we are building world and kernels wait for the required worlds to finish
+.if !defined(MAKE_JUST_KERNELS)
+.for target_arch in ${TARGET_ARCHES_${target}}
+universe_${target}_kernels: universe_${target}_${target_arch}
+.endfor
+.endif
+universe_${target}: universe_${target}_kernels
+universe_${target}_kernels: universe_${target}_prologue .MAKE
.if exists(${KERNSRCDIR}/${target}/conf/NOTES)
@(cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \
- ${MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
+ ${SUB_MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
(echo "${target} 'make LINT' failed," \
"check _.${target}.makeLINT for details"| ${MAKEFAIL}))
.endif
- @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} TARGET=${target} \
+ @cd ${.CURDIR}; ${SUB_MAKE} ${.MAKEFLAGS} TARGET=${target} \
universe_kernels
.endif
@echo ">> ${target} completed on `LC_ALL=C date`"
@@ -396,9 +485,16 @@
.if !defined(TARGET)
TARGET!= uname -m
.endif
+.if defined(MAKE_ALL_KERNELS)
+_THINNER=cat
+.else
+_THINNER=xargs grep -L "^.NO_UNIVERSE" || true
+.endif
KERNCONFS!= cd ${KERNSRCDIR}/${TARGET}/conf && \
- find [A-Z0-9]*[A-Z0-9] -type f -maxdepth 0 \
- ! -name DEFAULTS ! -name NOTES
+ find [[:upper:][:digit:]]*[[:upper:][:digit:]] \
+ -type f -maxdepth 0 \
+ ! -name DEFAULTS ! -name NOTES | \
+ ${_THINNER}
universe_kernconfs:
.for kernel in ${KERNCONFS}
TARGET_ARCH_${kernel}!= cd ${KERNSRCDIR}/${TARGET}/conf && \
@@ -408,9 +504,9 @@
.error "Target architecture for ${TARGET}/conf/${kernel} unknown. config(8) likely too old."
.endif
universe_kernconfs: universe_kernconf_${TARGET}_${kernel}
-universe_kernconf_${TARGET}_${kernel}:
+universe_kernconf_${TARGET}_${kernel}: .MAKE
@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
- ${MAKE} ${JFLAG} buildkernel \
+ ${SUB_MAKE} ${JFLAG} buildkernel \
TARGET=${TARGET} \
TARGET_ARCH=${TARGET_ARCH_${kernel}} \
KERNCONF=${kernel} \
@@ -432,3 +528,14 @@
fi
.endif
.endif
+
+buildLINT:
+ ${MAKE} -C ${.CURDIR}/sys/${_TARGET}/conf LINT
+
+.if defined(.PARSEDIR)
+.if make(universe)
+# we do not want a failure of one branch abort all.
+MAKE_JOB_ERROR_TOKEN= no
+.export MAKE_JOB_ERROR_TOKEN
+.endif
+.endif
Modified: trunk/Makefile.inc1
===================================================================
--- trunk/Makefile.inc1 2018-06-02 21:06:59 UTC (rev 10240)
+++ trunk/Makefile.inc1 2018-06-02 21:28:15 UTC (rev 10241)
@@ -1,5 +1,5 @@
-#
# $MidnightBSD$
+# $FreeBSD: stable/10/Makefile.inc1 331031 2018-03-15 22:42:28Z marius $
#
# Make command line options:
# -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
@@ -17,31 +17,32 @@
# -DNO_DOCUPDATE do not update doc in ${MAKE} update
# -DNO_CTF do not run the DTrace CTF conversion tools on built objects
# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
+# LOCAL_ITOOLS="list of tools" to add additional tools to the ITOOLS list
+# LOCAL_LIB_DIRS="list of dirs" to add additional dirs to libraries target
# LOCAL_MTREE="list of mtree files" to process to allow local directories
# to be created before files are installed
+# LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools
+# list
# METALOG="path to metadata log" to write permission and ownership
# when NO_ROOT is set. (default: ${DESTDIR}/METALOG)
# TARGET="machine" to crossbuild world for a different machine type
# TARGET_ARCH= may be required when a TARGET supports multiple endians
+# BUILDENV_SHELL= shell to launch for the buildenv target (def:/bin/sh)
+# WORLD_FLAGS= additional flags to pass to make(1) during buildworld
+# KERNEL_FLAGS= additional flags to pass to make(1) during buildkernel
#
# The intended user-driven targets are:
# buildworld - rebuild *everything*, including glue to help do upgrades
# installworld- install everything built by "buildworld"
+# checkworld - run test suite on installed world
# doxygen - build API documentation of the kernel
-# update - convenient way to update your source tree (eg: cvsup/cvs)
+# update - convenient way to update your source tree (eg: svn/svnup)
#
# Standard targets (not defined here) are documented in the makefiles in
# /usr/share/mk. These include:
# obj depend all install clean cleandepend cleanobj
-# You are supposed to define both of these when calling Makefile.inc1
-# directly. However, some old scripts don't. Cope for the moment, but
-# issue a new warning for a transition period.
-.if defined(TARGET) && !defined(TARGET_ARCH)
-.warning "You must pass both TARGET and TARGET_ARCH to Makefile.inc1. Setting TARGET_ARCH=${TARGET}."
-TARGET_ARCH=${TARGET}
-.endif
.if !defined(TARGET) || !defined(TARGET_ARCH)
.error "Both TARGET and TARGET_ARCH must be defined."
.endif
@@ -50,6 +51,8 @@
.include <bsd.arch.inc.mk>
.include <bsd.compiler.mk>
+LOCALBASE?= /usr/local
+
# We must do share/info early so that installation of info `dir'
# entries works correctly. Do it first since it is less likely to
# grow dependencies on include and lib than vice versa.
@@ -59,11 +62,12 @@
# use that new version. And the new (dynamically-linked) /bin/sh
# will expect to find appropriate libraries in /lib and /libexec.
#
+SRCDIR?= ${.CURDIR}
+.if defined(SUBDIR_OVERRIDE)
+SUBDIR= ${SUBDIR_OVERRIDE}
+.else
SUBDIR= share/info lib libexec
SUBDIR+=bin
-.if ${MK_APACHE} != "no"
-SUBDIR+=apache
-.endif
.if ${MK_GAMES} != "no"
SUBDIR+=games
.endif
@@ -85,6 +89,9 @@
SUBDIR+=share
.endif
SUBDIR+=sys usr.bin usr.sbin
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
.if ${MK_OFED} != "no"
SUBDIR+=contrib/ofed
.endif
@@ -95,14 +102,11 @@
# These are last, since it is nice to at least get the base system
# rebuilt before you do them.
-.for _DIR in ${LOCAL_DIRS}
+.for _DIR in ${LOCAL_LIB_DIRS} ${LOCAL_DIRS}
.if exists(${.CURDIR}/${_DIR}/Makefile)
SUBDIR+= ${_DIR}
.endif
.endfor
-
-.if defined(SUBDIR_OVERRIDE)
-SUBDIR= ${SUBDIR_OVERRIDE}
.endif
.if defined(NOCLEAN)
@@ -114,6 +118,11 @@
CLEANDIR= cleandir
.endif
+LOCAL_TOOL_DIRS?=
+PACKAGEDIR?= ${DESTDIR}/${DISTDIR}
+
+BUILDENV_SHELL?=/bin/sh
+
SVN?= /usr/local/bin/svn
SVNFLAGS?= -r HEAD
@@ -128,12 +137,14 @@
.endif
.if !defined(VERSION)
-VERSION!= uname -srp
-VERSION+= ${OSRELDATE}
+REVISION!= ${MAKE} -C ${SRCDIR}/release -V REVISION
+BRANCH!= ${MAKE} -C ${SRCDIR}/release -V BRANCH
+SRCRELDATE!= awk '/^\#define[[:space:]]*__MidnightBSD_version/ { print $$3 }' \
+ ${SRCDIR}/sys/sys/param.h
+VERSION= MidnightBSD ${REVISION} ${TARGET_ARCH} ${SRCRELDATE}
.endif
-
-KNOWN_ARCHES?= amd64 i386
+KNOWN_ARCHES?= amd64 arm armeb/arm armv6/arm i386 i386/pc98 ia64 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64
.if ${TARGET} == ${TARGET_ARCH}
_t= ${TARGET}
.else
@@ -217,17 +228,13 @@
# Common environment for world related stages
CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
- MACHINE_INCLUDES="${WORLDTMP}/include" \
MACHINE_ARCH=${TARGET_ARCH} \
MACHINE=${TARGET} \
CPUTYPE=${TARGET_CPUTYPE}
-.if ${OSRELDATE} < 4015
-CROSSENV+= AR=gnu-ar RANLIB=gnu-ranlib
-.endif
+_BOOTSTRAP_MAKEINFO?= ${MK_INFO}
# bootstrap-tools stage
BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
- MACHINE_INCLUDES="${WORLDTMP}/include" \
PATH=${BPATH}:${PATH} \
WORLDTMP=${WORLDTMP} \
VERSION="${VERSION}" \
@@ -234,43 +241,92 @@
MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
COMPILER_TYPE=${COMPILER_TYPE}
BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
- ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
+ ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
DESTDIR= \
BOOTSTRAPPING=${OSRELDATE} \
SSP_CFLAGS= \
-DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \
- -DNO_PIC -DWITHOUT_PROFILE -DNO_SHARED \
- -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
+ -DNO_PIC -DNO_PROFILE -DNO_SHARED \
+ _BOOTSTRAP_MAKEINFO=${_BOOTSTRAP_MAKEINFO} \
+ -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD -DNO_TESTS
# build-tools stage
TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
- ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
+ ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
DESTDIR= \
BOOTSTRAPPING=${OSRELDATE} \
SSP_CFLAGS= \
-DNO_LINT \
- -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
+ -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD -DNO_TESTS
# cross-tools stage
XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
- -DWITHOUT_GDB
+ -DWITHOUT_GDB -DNO_TESTS
+# kernel-tools stage
+KTMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
+ PATH=${BPATH}:${PATH} \
+ WORLDTMP=${WORLDTMP} \
+ VERSION="${VERSION}" \
+ COMPILER_TYPE=${COMPILER_TYPE}
+KTMAKE= TOOLS_PREFIX=${WORLDTMP} MAKEOBJDIRPREFIX=${WORLDTMP} \
+ ${KTMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
+ DESTDIR= \
+ BOOTSTRAPPING=${OSRELDATE} \
+ SSP_CFLAGS= \
+ -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \
+ -DNO_PIC -DNO_PROFILE -DNO_SHARED \
+ -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
+
# world stage
WMAKEENV= ${CROSSENV} \
_SHLIBDIRPREFIX=${WORLDTMP} \
_LDSCRIPTROOT= \
- MACHINE_INCLUDES="${WORLDTMP}/include" \
VERSION="${VERSION}" \
INSTALL="sh ${.CURDIR}/tools/install.sh" \
PATH=${TMPPATH}
+
+# make hierarchy
+HMAKE= PATH=${TMPPATH} ${MAKE} LOCAL_MTREE=${LOCAL_MTREE:Q}
+.if defined(NO_ROOT)
+HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT
+.endif
+
.if ${MK_CDDL} == "no"
WMAKEENV+= NO_CTF=1
.endif
-.if ${CC:T:Mgcc} == "gcc"
+
+.if defined(CROSS_TOOLCHAIN_PREFIX)
+CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
+CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
+.endif
+XCOMPILERS= CC CXX CPP
+.for COMPILER in ${XCOMPILERS}
+.if defined(CROSS_COMPILER_PREFIX)
+X${COMPILER}?= ${CROSS_COMPILER_PREFIX}${${COMPILER}}
+.else
+X${COMPILER}?= ${${COMPILER}}
+.endif
+.endfor
+XBINUTILS= AS AR LD NM OBJCOPY OBJDUMP RANLIB STRINGS
+.for BINUTIL in ${XBINUTILS}
+.if defined(CROSS_BINUTILS_PREFIX)
+X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${${BINUTIL}}
+.else
+X${BINUTIL}?= ${${BINUTIL}}
+.endif
+.endfor
+WMAKEENV+= CC="${XCC} ${XFLAGS}" CXX="${XCXX} ${XFLAGS}" \
+ CPP="${XCPP} ${XFLAGS}" \
+ AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \
+ OBJDUMP=${XOBJDUMP} OBJCOPY="${XOBJCOPY}" \
+ RANLIB=${XRANLIB} STRINGS=${XSTRINGS}
+
+.if ${XCC:T:Mgcc} == "gcc"
WMAKE_COMPILER_TYPE= gcc
-.elif ${CC:T:Mclang} == "clang"
+.elif ${XCC:T:Mclang} == "clang"
WMAKE_COMPILER_TYPE= clang
.elif ${MK_CLANG_IS_CC} == "no"
WMAKE_COMPILER_TYPE= gcc
@@ -277,10 +333,36 @@
.else
WMAKE_COMPILER_TYPE= clang
.endif
+IMAKE_COMPILER_TYPE= COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
+
+.if ${XCC:M/*}
+XFLAGS= --sysroot=${WORLDTMP}
+.if defined(CROSS_BINUTILS_PREFIX)
+# In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a
+# directory, but the compiler will look in the right place for it's
+# tools so we don't need to tell it where to look.
+.if exists(${CROSS_BINUTILS_PREFIX})
+XFLAGS+= -B${CROSS_BINUTILS_PREFIX}
+.endif
+.else
+XFLAGS+= -B${WORLDTMP}/usr/bin
+.endif
+.if ${TARGET_ARCH} != ${MACHINE_ARCH} && ${WMAKE_COMPILER_TYPE} == "clang"
+.if (${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "armv6") && \
+${MK_ARM_EABI} != "no"
+TARGET_ABI= gnueabi
+.else
+TARGET_ABI= unknown
+.endif
+TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd10.4
+XFLAGS+= -target ${TARGET_TRIPLE}
+.endif
+.endif
+
WMAKEENV+= COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
-WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP}
+WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP}
-.if ${TARGET_ARCH} == "amd64"
+.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
# 32 bit world
LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
@@ -291,11 +373,23 @@
LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
.endif
LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \
- MACHINE_CPU="i686 mmx sse sse2"
+ MACHINE_CPU="i686 mmx sse sse2"
LIB32WMAKEFLAGS= \
- AS="${AS} --32" \
- LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32"
+ AS="${XAS} --32" \
+ LD="${XLD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
+ OBJCOPY="${XOBJCOPY}"
+
+.elif ${TARGET_ARCH} == "powerpc64"
+.if empty(TARGET_CPUTYPE)
+LIB32CPUFLAGS= -mcpu=powerpc
+.else
+LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
.endif
+LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc
+LIB32WMAKEFLAGS= \
+ LD="${XLD} -m elf32ppc_fbsd" \
+ OBJCOPY="${XOBJCOPY}"
+.endif
LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \
@@ -302,6 +396,9 @@
-isystem ${LIB32TMP}/usr/include/ \
-L${LIB32TMP}/usr/lib32 \
-B${LIB32TMP}/usr/lib32
+.if ${XCC:M/*}
+LIB32FLAGS+= --sysroot=${WORLDTMP}
+.endif
# Yes, the flags are redundant.
LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
@@ -313,22 +410,21 @@
LIBDIR=/usr/lib32 \
SHLIBDIR=/usr/lib32 \
LIBPRIVATEDIR=/usr/lib32/private \
- MACHINE_INCLUDES="${WORLDTMP}/include" \
- COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
+ COMPILER_TYPE=${WMAKE_COMPILER_TYPE} \
+ DTRACE="${DTRACE} -32"
LIB32WMAKEFLAGS+= \
- CC="${CC} ${LIB32FLAGS}" \
- CXX="${CXX} ${LIB32FLAGS}" \
+ CC="${XCC} ${LIB32FLAGS}" \
+ CXX="${XCXX} ${LIB32FLAGS}" \
DESTDIR=${LIB32TMP} \
-DCOMPAT_32BIT \
-DLIBRARIES_ONLY \
-DNO_CPU_CFLAGS \
-DNO_CTF \
- -DNO_LINT
+ -DNO_LINT \
+ -DNO_TESTS
LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \
- -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO \
- -DWITHOUT_HTML -DNO_CTF -DNO_LINT \
- DESTDIR=${LIB32TMP}
+ -DWITHOUT_MAN -DWITHOUT_INFO -DWITHOUT_HTML
LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS \
${IMAKE_INSTALL}
.endif
@@ -335,7 +431,7 @@
IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*}
IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \
- ${IMAKE_INSTALL} ${IMAKE_MTREE}
+ ${IMAKE_INSTALL} ${IMAKE_MTREE} ${IMAKE_COMPILER_TYPE}
.if empty(.MAKEFLAGS:M-n)
IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \
LD_LIBRARY_PATH=${INSTALLTMP} \
@@ -348,11 +444,12 @@
INSTALLFLAGS+= -N ${.CURDIR}/etc
MTREEFLAGS+= -N ${.CURDIR}/etc
.endif
+_INSTALL_DDIR= ${DESTDIR}/${DISTDIR}
+INSTALL_DDIR= ${_INSTALL_DDIR:S://:/:g:C:/$::}
.if defined(NO_ROOT)
METALOG?= ${DESTDIR}/${DISTDIR}/METALOG
IMAKE+= -DNO_ROOT METALOG=${METALOG}
-INSTALL_DDIR= ${DESTDIR}/${DISTDIR}
-INSTALLFLAGS+= -U -M ${METALOG} -D ${INSTALL_DDIR:S://:/:g:C:/$::}
+INSTALLFLAGS+= -U -M ${METALOG} -D ${INSTALL_DDIR}
MTREEFLAGS+= -W
.endif
.if defined(DB_FROM_SRC) || defined(NO_ROOT)
@@ -362,7 +459,7 @@
# kernel stage
KMAKEENV= ${WMAKEENV}
-KMAKE= ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME}
+KMAKE= ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME}
#
# buildworld
@@ -370,7 +467,7 @@
# Attempt to rebuild the entire system, with reasonable chance of
# success, regardless of how old your existing system is.
#
-_worldtmp:
+_worldtmp: .PHONY
.if ${.CURDIR:C/[^,]//g} != ""
# The m4 build of sendmail files doesn't like it if ',' is used
# anywhere in the path of it's files.
@@ -396,7 +493,7 @@
rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
.endif
.for _dir in \
- lib usr legacy/bin legacy/usr legacy/usr/bin legacy/usr/sbin
+ lib usr legacy/bin legacy/usr
mkdir -p ${WORLDTMP}/${_dir}
.endfor
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
@@ -406,10 +503,18 @@
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
-p ${WORLDTMP}/usr/include >/dev/null
ln -sf ${.CURDIR}/sys ${WORLDTMP}
-.if ${MK_BIND_LIBS} != "no"
- mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \
- -p ${WORLDTMP}/usr/include >/dev/null
+.if ${MK_DEBUG_FILES} != "no"
+ # We could instead disable debug files for these build stages
+ mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
+ -p ${WORLDTMP}/legacy/usr/lib >/dev/null
+ mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
+ -p ${WORLDTMP}/usr/lib >/dev/null
.endif
+.if ${MK_TESTS} != "no"
+ mkdir -p ${WORLDTMP}${TESTSBASE}
+ mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
+ -p ${WORLDTMP}${TESTSBASE} >/dev/null
+.endif
.for _mtree in ${LOCAL_MTREE}
mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null
.endfor
@@ -454,6 +559,7 @@
@echo ">>> stage 3: cross tools"
@echo "--------------------------------------------------------------"
${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
+ ${_+_}cd ${.CURDIR}; ${XMAKE} kernel-tools
_includes:
@echo
@echo "--------------------------------------------------------------"
@@ -467,7 +573,7 @@
@echo "--------------------------------------------------------------"
${_+_}cd ${.CURDIR}; \
${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
- -DWITHOUT_MAN -DWITHOUT_PROFILE libraries
+ -DWITHOUT_MAN -DNO_PROFILE -DNO_TESTS libraries
_depend:
@echo
@echo "--------------------------------------------------------------"
@@ -481,7 +587,7 @@
@echo "--------------------------------------------------------------"
${_+_}cd ${.CURDIR}; ${WMAKE} par-all
.if defined(LIB32TMP)
-build32:
+build32: .PHONY
@echo
@echo "--------------------------------------------------------------"
@echo ">>> stage 5.1: building 32 bit shim libraries"
@@ -491,60 +597,67 @@
-p ${LIB32TMP}/usr >/dev/null
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
-p ${LIB32TMP}/usr/include >/dev/null
+.if ${MK_DEBUG_FILES} != "no"
+ mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
+ -p ${LIB32TMP}/usr/lib >/dev/null
+.endif
mkdir -p ${WORLDTMP}
ln -sf ${.CURDIR}/sys ${WORLDTMP}
.for _t in obj includes
- cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t}
- cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t}
-.if ${MK_APACHE} != "no"
- cd ${.CURDIR}/apache/lib; ${LIB32WMAKE} ${_t}
-.endif
+ ${_+_}cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t}
+ ${_+_}cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t}
.if ${MK_CDDL} != "no"
- cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t}
+ ${_+_}cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t}
.endif
- cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t}
+ ${_+_}cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t}
.if ${MK_CRYPT} != "no"
- cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t}
+ ${_+_}cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t}
.endif
.if ${MK_KERBEROS} != "no"
- cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t}
+ ${_+_}cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t}
.endif
.endfor
.for _dir in usr.bin/lex/lib
- cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj
+ ${_+_}cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj
.endfor
.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
- cd ${.CURDIR}/${_dir}; \
+ ${_+_}cd ${.CURDIR}/${_dir}; \
WORLDTMP=${WORLDTMP} \
+ MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF \
-DEARLY_BUILD build-tools
.endfor
- cd ${.CURDIR}; \
- ${LIB32WMAKE} -f Makefile.inc1 libraries
+ ${_+_}cd ${.CURDIR}; \
+ ${LIB32WMAKE} -f Makefile.inc1 -DNO_FSCHG libraries
.for _t in obj depend all
- cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \
- DIRPRFX=libexec/rtld-elf/ ${_t}
- cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \
+.if !defined(NO_RTLD)
+ ${_+_}cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \
+ -DNO_FSCHG DIRPRFX=libexec/rtld-elf/ ${_t}
+.endif
+ ${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \
DIRPRFX=usr.bin/ldd ${_t}
.endfor
-distribute32 install32:
- cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
+distribute32 install32: .MAKE .PHONY
+ ${_+_}cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
.if ${MK_CDDL} != "no"
- cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
+ ${_+_}cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
.endif
- cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
+ ${_+_}cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
.if ${MK_CRYPT} != "no"
- cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
+ ${_+_}cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
.endif
.if ${MK_KERBEROS} != "no"
- cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
+ ${_+_}cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
.endif
- cd ${.CURDIR}/libexec/rtld-elf; \
+.if !defined(NO_RTLD)
+ ${_+_}cd ${.CURDIR}/libexec/rtld-elf; \
PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
- cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//}
.endif
+ ${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} \
+ ${.TARGET:S/32$//}
+.endif
WMAKE_TGTS=
.if !defined(SUBDIR_OVERRIDE)
@@ -582,9 +695,14 @@
buildenvvars:
@echo ${WMAKEENV:Q}
+.if ${.TARGETS:Mbuildenv}
+.if ${.MAKEFLAGS:M-j}
+.error The buildenv target is incompatible with -j
+.endif
+.endif
buildenv:
@echo Entering world for ${TARGET_ARCH}:${TARGET}
- @cd ${.CURDIR} && env ${WMAKEENV} sh || true
+ @cd ${.CURDIR} && env ${WMAKEENV} ${BUILDENV_SHELL} || true
TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32}
toolchain: ${TOOLCHAIN_TGTS}
@@ -595,8 +713,9 @@
#
# Checks to be sure system is ready for installworld/installkernel.
#
-installcheck:
-installcheck_UGID:
+installcheck: _installcheck_world _installcheck_kernel
+_installcheck_world:
+_installcheck_kernel:
#
# Require DESTDIR to be set if installing for a different architecture or
@@ -605,8 +724,9 @@
.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \
defined(DB_FROM_SRC)
.if !make(distributeworld)
-installcheck: installcheck_DESTDIR
-installcheck_DESTDIR:
+_installcheck_world: __installcheck_DESTDIR
+_installcheck_kernel: __installcheck_DESTDIR
+__installcheck_DESTDIR:
.if !defined(DESTDIR) || empty(DESTDIR)
@echo "ERROR: Please set DESTDIR!"; \
false
@@ -628,7 +748,12 @@
CHECK_UIDS+= proxy
CHECK_GIDS+= proxy authpf
.endif
-installcheck_UGID:
+.if ${MK_UNBOUND} != "no"
+CHECK_UIDS+= unbound
+CHECK_GIDS+= unbound
+.endif
+_installcheck_world: __installcheck_UGID
+__installcheck_UGID:
.for uid in ${CHECK_UIDS}
@if ! `id -u ${uid} >/dev/null 2>&1`; then \
echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
@@ -657,11 +782,17 @@
_nmtree_itools= nmtree
.endif
-ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
+ITOOLS= [ awk cap_mkdb cat chflags chmod chown cmp cp \
date echo egrep find grep id install ${_install-info} \
ln lockf make mkdir mtree ${_nmtree_itools} mv pwd_mkdb \
- rm sed sh sysctl test true uname wc ${_zoneinfo}
+ rm sed sh strip sysctl test true uname wc ${_zoneinfo} \
+ ${LOCAL_ITOOLS}
+# Needed for share/man
+.if ${MK_MAN} != "no"
+ITOOLS+=makewhatis
+.endif
+
#
# distributeworld
#
@@ -680,11 +811,15 @@
.if defined(LIB32TMP) && ${MK_LIB32} != "no"
EXTRA_DISTRIBUTIONS+= lib32
.endif
+.if ${MK_TESTS} != "no"
+EXTRA_DISTRIBUTIONS+= tests
+.endif
MTREE_MAGIC?= mtree 2.0
-distributeworld installworld: installcheck installcheck_UGID
+distributeworld installworld: _installcheck_world
mkdir -p ${INSTALLTMP}
+ export PATH=${BPATH}:${PATH} ; \
progs=$$(for prog in ${ITOOLS}; do \
if progpath=`which $$prog`; then \
echo $$progpath; \
@@ -717,6 +852,15 @@
-p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
-p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
+.if ${MK_DEBUG_FILES} != "no"
+ mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
+ -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null
+.endif
+.if ${MK_TESTS} != "no" && ${dist} == "tests"
+ -mkdir -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE}
+ mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
+ -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE} >/dev/null
+.endif
.if defined(NO_ROOT)
${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
sed -e 's#^\./#./${dist}/#' >> ${METALOG}
@@ -727,16 +871,16 @@
.endif
.endfor
-mkdir ${DESTDIR}/${DISTDIR}/base
- cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
+ ${_+_}cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \
DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \
- LOCAL_MTREE=${LOCAL_MTREE} distrib-dirs
+ LOCAL_MTREE=${LOCAL_MTREE:Q} distrib-dirs
.endif
${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
${IMAKEENV} rm -rf ${INSTALLTMP}
.if make(distributeworld)
.for dist in ${EXTRA_DISTRIBUTIONS}
- find ${DESTDIR}/${DISTDIR}/${dist} -empty -delete
+ find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -type d -empty -delete
.endfor
.if defined(NO_ROOT)
.for dist in base ${EXTRA_DISTRIBUTIONS}
@@ -749,21 +893,49 @@
awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
${DESTDIR}/${DISTDIR}/${dist}.meta
.endfor
+.if ${MK_DEBUG_FILES} != "no"
+. for dist in base ${EXTRA_DISTRIBUTIONS}
+ @# For each file that exists in this dist, print the corresponding
+ @# line from the METALOG. This relies on the fact that
+ @# a line containing only the filename will sort immediatly before
+ @# the relevant mtree line.
+ cd ${DESTDIR}/${DISTDIR}; \
+ find ./${dist}/usr/lib/debug | sort -u ${METALOG} - | \
+ awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
+ ${DESTDIR}/${DISTDIR}/${dist}.debug.meta
+. endfor
.endif
.endif
+.endif
packageworld:
.for dist in base ${EXTRA_DISTRIBUTIONS}
.if defined(NO_ROOT)
${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
- tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \
- @${DESTDIR}/${DISTDIR}/${dist}.meta
+ tar cvf - --exclude usr/lib/debug \
+ @${DESTDIR}/${DISTDIR}/${dist}.meta | \
+ ${XZ_CMD} > ${PACKAGEDIR}/${dist}.txz
.else
${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
- tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz .
+ tar cvf - --exclude usr/lib/debug . | \
+ ${XZ_CMD} > ${PACKAGEDIR}/${dist}.txz
.endif
.endfor
+.if ${MK_DEBUG_FILES} != "no"
+. for dist in base ${EXTRA_DISTRIBUTIONS}
+. if defined(NO_ROOT)
+ ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
+ tar cvf - @${DESTDIR}/${DISTDIR}/${dist}.debug.meta | \
+ ${XZ_CMD} > ${PACKAGEDIR}/${dist}.debug.txz
+. else
+ ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
+ tar cvLf - usr/lib/debug | \
+ ${XZ_CMD} > ${PACKAGEDIR}/${dist}-debug.txz
+. endif
+. endfor
+.endif
+
#
# reinstall
#
@@ -771,12 +943,12 @@
# and do a 'make reinstall' on the *client* to install new binaries from the
# most recent server build.
#
-reinstall:
+reinstall: .MAKE .PHONY
@echo "--------------------------------------------------------------"
@echo ">>> Making hierarchy"
@echo "--------------------------------------------------------------"
${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \
- LOCAL_MTREE=${LOCAL_MTREE} hierarchy
+ LOCAL_MTREE=${LOCAL_MTREE:Q} hierarchy
@echo
@echo "--------------------------------------------------------------"
@echo ">>> Installing everything"
@@ -786,7 +958,7 @@
${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
.endif
-redistribute:
+redistribute: .MAKE .PHONY
@echo "--------------------------------------------------------------"
@echo ">>> Distributing everything"
@echo "--------------------------------------------------------------"
@@ -796,7 +968,7 @@
DISTRIBUTION=lib32
.endif
-distrib-dirs distribution:
+distrib-dirs distribution: .MAKE .PHONY
cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET}
@@ -824,9 +996,8 @@
KERNCONF=${KERNFAST}
.endif
.endif
-.if !defined(KERNCONF) && defined(KERNEL)
-KERNCONF= ${KERNEL}
-KERNWARN=
+.if ${TARGET_ARCH} == "powerpc64"
+KERNCONF?= GENERIC64
.else
KERNCONF?= GENERIC
.endif
@@ -839,33 +1010,38 @@
BUILDKERNELS=
INSTALLKERNEL=
+NO_INSTALLEXTRAKERNELS?= yes
+.if defined(NO_INSTALLKERNEL)
+# All of the BUILDKERNELS loops start at index 1.
+BUILDKERNELS+= dummy
+.endif
.for _kernel in ${KERNCONF}
.if exists(${KERNCONFDIR}/${_kernel})
BUILDKERNELS+= ${_kernel}
-.if empty(INSTALLKERNEL)
+.if empty(INSTALLKERNEL) && !defined(NO_INSTALLKERNEL)
INSTALLKERNEL= ${_kernel}
.endif
+.else
+.if make(buildkernel)
+.error Missing KERNCONF ${KERNCONFDIR}/${_kernel}
.endif
+.endif
.endfor
+${WMAKE_TGTS:N_worldtmp:Nbuild32} ${.ALLTARGETS:M_*:N_worldtmp}: .MAKE .PHONY
+
#
# buildkernel
#
# Builds all kernels defined by BUILDKERNELS.
#
-buildkernel:
-.if empty(BUILDKERNELS)
+buildkernel: .MAKE .PHONY
+.if empty(BUILDKERNELS:Ndummy)
@echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
false
.endif
-.if defined(KERNWARN)
- @echo "--------------------------------------------------------------"
- @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
- @echo "--------------------------------------------------------------"
- @sleep 3
-.endif
@echo
-.for _kernel in ${BUILDKERNELS}
+.for _kernel in ${BUILDKERNELS:Ndummy}
@echo "--------------------------------------------------------------"
@echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
@echo "--------------------------------------------------------------"
@@ -879,7 +1055,7 @@
cd ${KRNLCONFDIR}; \
PATH=${TMPPATH} \
config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
- ${KERNCONFDIR}/${_kernel}
+ -I '${KERNCONFDIR}' '${KERNCONFDIR}/${_kernel}'
.endif
.if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
@echo
@@ -886,7 +1062,7 @@
@echo "--------------------------------------------------------------"
@echo ">>> stage 2.1: cleaning up the object tree"
@echo "--------------------------------------------------------------"
- cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
+ ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
.endif
.if !defined(NO_KERNELOBJ)
@echo
@@ -893,38 +1069,25 @@
@echo "--------------------------------------------------------------"
@echo ">>> stage 2.2: rebuilding the object tree"
@echo "--------------------------------------------------------------"
- cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
+ ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
.endif
@echo
@echo "--------------------------------------------------------------"
@echo ">>> stage 2.3: build tools"
@echo "--------------------------------------------------------------"
- cd ${KRNLOBJDIR}/${_kernel}; \
- PATH=${BPATH}:${PATH} \
- MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
- ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD \
- -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
-# XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
-.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
-.for target in obj depend all
- cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \
- PATH=${BPATH}:${PATH} \
- MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
- ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD ${target}
-.endfor
-.endif
+ ${_+_}cd ${.CURDIR}; ${KTMAKE} kernel-tools
.if !defined(NO_KERNELDEPEND)
@echo
@echo "--------------------------------------------------------------"
@echo ">>> stage 3.1: making dependencies"
@echo "--------------------------------------------------------------"
- cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
+ ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
.endif
@echo
@echo "--------------------------------------------------------------"
@echo ">>> stage 3.2: building everything"
@echo "--------------------------------------------------------------"
- cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
+ ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
@echo "--------------------------------------------------------------"
@echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
@echo "--------------------------------------------------------------"
@@ -936,7 +1099,8 @@
# Install the kernel defined by INSTALLKERNEL
#
installkernel installkernel.debug \
-reinstallkernel reinstallkernel.debug: installcheck
+reinstallkernel reinstallkernel.debug: _installcheck_kernel
+.if !defined(NO_INSTALLKERNEL)
.if empty(INSTALLKERNEL)
@echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
false
@@ -947,90 +1111,131 @@
cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
${CROSSENV} PATH=${TMPPATH} \
${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
+.endif
+.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes"
+.for _kernel in ${BUILDKERNELS:[2..-1]}
+ @echo "--------------------------------------------------------------"
+ @echo ">>> Installing kernel ${_kernel}"
+ @echo "--------------------------------------------------------------"
+ cd ${KRNLOBJDIR}/${_kernel}; \
+ ${CROSSENV} PATH=${TMPPATH} \
+ ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME}.${_kernel} ${.TARGET:S/kernel//}
+.endfor
+.endif
distributekernel distributekernel.debug:
+.if !defined(NO_INSTALLKERNEL)
.if empty(INSTALLKERNEL)
@echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
false
.endif
+ mkdir -p ${DESTDIR}/${DISTDIR}
+.if defined(NO_ROOT)
+ echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.premeta
+.endif
cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
- ${CROSSENV} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \
- DESTDIR=${DESTDIR}/${DISTDIR}/kernel \
+ ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.premeta/} \
+ ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \
+ DESTDIR=${INSTALL_DDIR}/kernel \
${.TARGET:S/distributekernel/install/}
-.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
+.if defined(NO_ROOT)
+ sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta > \
+ ${DESTDIR}/${DISTDIR}/kernel.meta
+.endif
+.endif
+.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes"
+.for _kernel in ${BUILDKERNELS:[2..-1]}
+.if defined(NO_ROOT)
+ echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta
+.endif
cd ${KRNLOBJDIR}/${_kernel}; \
- ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
+ ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.${_kernel}.premeta/} \
+ ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} \
KERNEL=${INSTKERNNAME}.${_kernel} \
- DESTDIR=${DESTDIR}/${DISTDIR}/kernel.${_kernel} \
+ DESTDIR=${INSTALL_DDIR}/kernel.${_kernel} \
${.TARGET:S/distributekernel/install/}
+.if defined(NO_ROOT)
+ sed -e 's|^./kernel|.|' \
+ ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta > \
+ ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
+.endif
.endfor
+.endif
packagekernel:
+.if defined(NO_ROOT)
+.if !defined(NO_INSTALLKERNEL)
cd ${DESTDIR}/${DISTDIR}/kernel; \
- tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz .
-.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
+ tar cvf - @${DESTDIR}/${DISTDIR}/kernel.meta | \
+ ${XZ_CMD} > ${PACKAGEDIR}/kernel.txz
+.endif
+.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes"
+.for _kernel in ${BUILDKERNELS:[2..-1]}
cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
- tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz .
+ tar cvf - @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \
+ ${XZ_CMD} > ${PACKAGEDIR}/kernel.${_kernel}.txz
.endfor
+.endif
+.else
+.if !defined(NO_INSTALLKERNEL)
+ cd ${DESTDIR}/${DISTDIR}/kernel; \
+ tar cvf - . | \
+ ${XZ_CMD} > ${PACKAGEDIR}/kernel.txz
+.endif
+.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes"
+.for _kernel in ${BUILDKERNELS:[2..-1]}
+ cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
+ tar cvf - . | \
+ ${XZ_CMD} > ${PACKAGEDIR}/kernel.${_kernel}.txz
+.endfor
+.endif
+.endif
#
+#
+# checkworld
+#
+# Run test suite on installed world.
+#
+checkworld: .PHONY
+ @if [ ! -x "${LOCALBASE}/bin/kyua" ]; then \
+ echo "You need kyua (devel/kyua) to run the test suite." | /usr/bin/fmt; \
+ exit 1; \
+ fi
+ ${_+_}PATH="$$PATH:${LOCALBASE}/bin" kyua test -k ${TESTSBASE}/Kyuafile
+
+#
+#
# doxygen
#
# Build the API documentation with doxygen
#
-doxygen:
- @if [ ! -x `/usr/bin/which doxygen` ]; then \
+doxygen: .PHONY
+ @if [ ! -x "${LOCALBASE}/bin/doxygen" ]; then \
echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
exit 1; \
fi
- cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all
+ ${_+_}cd ${.CURDIR}/tools/kerneldoc/subsys; ${MAKE} obj all
#
# update
#
-# Update the source tree(s), by running cvsup/cvs/svn to update to the
+# Update the source tree(s), by running svn/svnup to update to the
# latest copy.
#
update:
-.if defined(SUP_UPDATE)
+.if (defined(CVS_UPDATE) || defined(SUP_UPDATE)) && !defined(SVN_UPDATE)
@echo "--------------------------------------------------------------"
- @echo ">>> Running ${SUP}"
+ @echo "CVS_UPDATE and SUP_UPDATE are no longer supported."
+ @echo "Please see: https://wiki.freebsd.org/CvsIsDeprecated"
@echo "--------------------------------------------------------------"
-.if defined(SUPFILE)
- @${SUP} ${SUPFLAGS} ${SUPFILE}
+ @exit 1
.endif
-.if defined(SUPFILE1)
- @${SUP} ${SUPFLAGS} ${SUPFILE1}
-.endif
-.if defined(SUPFILE2)
- @${SUP} ${SUPFLAGS} ${SUPFILE2}
-.endif
-.if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
- @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
-.endif
-.if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
- @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
-.endif
-.endif
-.if defined(CVS_UPDATE)
- @cd ${.CURDIR} ; \
- if [ -d CVS ] ; then \
- echo "--------------------------------------------------------------" ; \
- echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT} ; \
- echo "--------------------------------------------------------------" ; \
- echo ${CVS} -R -q update ${CVSFLAGS} ; \
- ${CVS} -R -q update ${CVSFLAGS} ; \
- fi
-.endif
.if defined(SVN_UPDATE)
- @cd ${.CURDIR} ; \
- if [ -d .svn ] ; then \
- echo "--------------------------------------------------------------" ; \
- echo ">>> Updating ${.CURDIR} using Subversion" ; \
- echo "--------------------------------------------------------------" ; \
- echo ${SVN} update ${SVNFLAGS} ; \
- ${SVN} update ${SVNFLAGS} ; \
- fi
+ @echo "--------------------------------------------------------------"
+ @echo ">>> Updating ${.CURDIR} using Subversion"
+ @echo "--------------------------------------------------------------"
+ @(cd ${.CURDIR}; ${SVN} update ${SVNFLAGS})
.endif
#
@@ -1048,18 +1253,17 @@
# legacy: Build compatibility shims for the next three targets
#
legacy:
-.if ${BOOTSTRAPPING} < 7000 && ${BOOTSTRAPPING} != 0
- @echo "ERROR: Source upgrades from versions prior to 0.7 not supported."; \
+.if ${BOOTSTRAPPING} < 700055 && ${BOOTSTRAPPING} != 0
+ @echo "ERROR: Source upgrades from versions prior to 7.0 not supported."; \
false
.endif
- mkdir -p ${MAKEOBJDIRPREFIX}/legacy/usr/bin
.for _tool in tools/build
${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
- cd ${.CURDIR}/${_tool} && \
- ${MAKE} DIRPRFX=${_tool}/ obj && \
- ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes && \
- ${MAKE} DIRPRFX=${_tool}/ depend && \
- ${MAKE} DIRPRFX=${_tool}/ all && \
+ cd ${.CURDIR}/${_tool}; \
+ ${MAKE} DIRPRFX=${_tool}/ obj; \
+ ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
+ ${MAKE} DIRPRFX=${_tool}/ depend; \
+ ${MAKE} DIRPRFX=${_tool}/ all; \
${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
.endfor
@@ -1066,6 +1270,8 @@
#
# bootstrap-tools: Build tools needed for compatibility
#
+_bt= _bootstrap-tools
+
.if ${MK_GAMES} != "no"
_strfile= games/fortune/strfile
.endif
@@ -1074,47 +1280,73 @@
_gperf= gnu/usr.bin/gperf
.endif
-.if ${BOOTSTRAPPING} >= 4000 && ${BOOTSTRAPPING} < 4015
+.if ${MK_VT} != "no"
+_vtfontcvt= usr.bin/vtfontcvt
+.endif
+
+.if ${BOOTSTRAPPING} < 800022
_ar= usr.bin/ar
.endif
-.if ${BOOTSTRAPPING} < 4015
+.if ${BOOTSTRAPPING} < 800013
_mklocale= usr.bin/mklocale
.endif
-.if ${BOOTSTRAPPING} < 4015
+.if ${BOOTSTRAPPING} < 900002
_sed= usr.bin/sed
.endif
-.if ${BOOTSTRAPPING} < 7003
+.if ${BOOTSTRAPPING} < 1000033
_m4= usr.bin/m4
-.endif
+_lex= usr.bin/lex
-.if ${BOOTSTRAPPING} < 7003
-_lex= usr.bin/lex
+${_bt}-usr.bin/lex: ${_bt}-usr.bin/m4
.endif
-.if ${BOOTSTRAPPING} < 7003
+.if ${BOOTSTRAPPING} < 1001506
_yacc= lib/liby \
usr.bin/yacc
+
+${_bt}-usr.bin/yacc: ${_bt}-lib/liby
.endif
-.if ${BOOTSTRAPPING} < 9002
-_nmtree= lib/libnetbsd \
- usr.sbin/nmtree
+# crunchgen broken on head with STRIP= for a while, even
+# when building stable binaries, so bootstrap there too.
+# r284356 to r285986 is the broken range.
+.if ${BOOTSTRAPPING} < 1000014 || \
+ (${BOOTSTRAPPING} > 1100076 && ${BOOTSTRAPPING} < 1100078)
+_crunch= usr.sbin/crunch
.endif
+# r245440 mtree -N support added
+# r313404 requires sha384.h for libnetbsd, added to libmd in r292782
+.if ${BOOTSTRAPPING} < 1003512
+_nmtree= lib/libmd \
+ lib/libnetbsd \
+ usr.sbin/nmtree
-.if ${MK_BSNMP} != "no" && \
- (${BOOTSTRAPPING} < 4015 || !exists(/usr/sbin/gensnmptree))
-_gensnmptree= usr.sbin/bsnmpd/gensnmptree
+${_bt}-lib/libnetbsd: ${_bt}-lib/libmd
+${_bt}-usr.sbin/nmtree: ${_bt}-lib/libnetbsd
.endif
-.if ${MK_RESCUE} != "no" && \
- ${BOOTSTRAPPING} < 4015
-_crunchgen= usr.sbin/crunch/crunchgen
+.if ${BOOTSTRAPPING} < 1000027
+_cat= bin/cat
.endif
+.if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041
+_awk= usr.bin/awk
+.endif
+
+# r296926 -P keymap search path, MFC to stable/10 in r298297
+.if ${BOOTSTRAPPING} < 1003501 || \
+ (${BOOTSTRAPPING} >= 1100000 && ${BOOTSTRAPPING} < 1100103)
+_kbdcontrol= usr.sbin/kbdcontrol
+.endif
+
+.if ${MK_BSNMP} != "no"
+_gensnmptree= usr.sbin/bsnmpd/gensnmptree
+.endif
+
.if ${MK_CLANG} != "no"
_clang_tblgen= \
lib/clang/libllvmsupport \
@@ -1121,23 +1353,53 @@
lib/clang/libllvmtablegen \
usr.bin/clang/tblgen \
usr.bin/clang/clang-tblgen
+
+${_bt}-usr.bin/clang/clang-tblgen: ${_bt}-lib/clang/libllvmtablegen ${_bt}-lib/clang/libllvmsupport
+${_bt}-usr.bin/clang/tblgen: ${_bt}-lib/clang/libllvmtablegen ${_bt}-lib/clang/libllvmsupport
.endif
-.if ${MK_CDDL} != "no" && \
- ${BOOTSTRAPPING} < 4015 && \
- !(${BOOTSTRAPPING} >= 4000 && ${BOOTSTRAPPING} < 4015)
-_dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
+# Rebuild ctfconvert and ctfmerge to avoid difficult-to-diagnose failures
+# resulting from missing bug fixes or ELF Toolchain updates.
+.if ${MK_CDDL} != "no"
+_dtrace_tools= cddl/lib/libctf lib/libelf \
lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
+
+${_bt}-cddl/usr.bin/ctfconvert: ${_bt}-lib/libelf ${_bt}-lib/libdwarf ${_bt}-cddl/lib/libctf
+${_bt}-cddl/usr.bin/ctfmerge: ${_bt}-lib/libelf ${_bt}-lib/libdwarf ${_bt}-cddl/lib/libctf
.endif
-.if ${MK_FDT} != "no"
+# Default to building the GPL DTC, but build the BSDL one if users explicitly
+# request it.
+_dtc= usr.bin/dtc
+.if ${MK_GPL_DTC} != "no"
_dtc= gnu/usr.bin/dtc
.endif
+.if ${MK_KERBEROS} != "no"
+_kerberos5_bootstrap_tools= \
+ kerberos5/tools/make-roken \
+ kerberos5/lib/libroken \
+ kerberos5/lib/libvers \
+ kerberos5/tools/asn1_compile \
+ kerberos5/tools/slc \
+ usr.bin/compile_et
+
+.ORDER: ${_kerberos5_bootstrap_tools:C/^/${_bt}-/g}
+.endif
+
+.if ${_BOOTSTRAP_MAKEINFO} != "no"
+_texinfo= gnu/usr.bin/texinfo/libtxi \
+ gnu/usr.bin/texinfo/makeinfo \
+ gnu/usr.bin/texinfo/install-info
+
+${_bt}-gnu/usr.bin/texinfo/install-info: ${_bt}-gnu/usr.bin/texinfo/libtxi
+${_bt}-gnu/usr.bin/texinfo/makeinfo: ${_bt}-gnu/usr.bin/texinfo/libtxi
+.endif
+bootstrap-tools: .PHONY
+
# Please document (add comment) why something is in 'bootstrap-tools'.
# Try to bound the building of the bootstrap-tool to just the
# MidnightBSD versions that need the tool built at this stage of the build.
-bootstrap-tools:
.for _tool in \
${_clang_tblgen} \
${_kerberos5_bootstrap_tools} \
@@ -1148,8 +1410,9 @@
${_dtc} \
${_awk} \
${_cat} \
+ ${_kbdcontrol} \
usr.bin/lorder \
- usr.bin/mandoc \
+ usr.bin/makewhatis \
${_mklocale} \
usr.bin/rpcgen \
${_sed} \
@@ -1156,12 +1419,14 @@
${_yacc} \
${_m4} \
${_lex} \
- lib/libmd \
usr.bin/xinstall \
${_gensnmptree} \
usr.sbin/config \
- ${_crunchgen} \
- ${_nmtree}
+ ${_crunch} \
+ ${_nmtree} \
+ ${_texinfo} \
+ ${_vtfontcvt}
+${_bt}-${_tool}: .PHONY .MAKE
${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
cd ${.CURDIR}/${_tool}; \
${MAKE} DIRPRFX=${_tool}/ obj; \
@@ -1168,53 +1433,43 @@
${MAKE} DIRPRFX=${_tool}/ depend; \
${MAKE} DIRPRFX=${_tool}/ all; \
${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
+
+bootstrap-tools: ${_bt}-${_tool}
.endfor
#
# build-tools: Build special purpose build tools
#
-.if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
-_aicasm= sys/modules/aic7xxx/aicasm
-.endif
-
.if !defined(NO_SHARE)
_share= share/syscons/scrnmaps
.endif
-.if ${MK_GCC} != "no" && (${MK_CLANG_IS_CC} == "no" || ${TARGET} == "pc98")
+.if ${MK_GCC} != "no"
_gcc_tools= gnu/usr.bin/cc/cc_tools
.endif
-.if ${MK_KERBEROS} != "no"
-_kerberos5_bootstrap_tools= \
- kerberos5/tools/make-roken \
- kerberos5/lib/libroken \
- kerberos5/lib/libvers \
- kerberos5/tools/asn1_compile \
- kerberos5/tools/slc \
- usr.bin/compile_et
-
-.ORDER: ${_kerberos5_bootstrap_tools:C/^/${_bt}-/g}
-.endif
-
.if ${MK_RESCUE} != "no"
_rescue= rescue/rescue
.endif
-build-tools:
+.if ${MK_TCSH} != "no"
+_tcsh=bin/csh
+.endif
+
+build-tools: .MAKE
.for _tool in \
- bin/csh \
+ ${_tcsh} \
bin/sh \
${_rescue} \
+ ${LOCAL_TOOL_DIRS} \
lib/ncurses/ncurses \
lib/ncurses/ncursesw \
${_share} \
- ${_aicasm} \
usr.bin/awk \
lib/libmagic \
- usr.sbin/sysinstall \
usr.bin/mkesdb_static \
- usr.bin/mkcsmapper_static
+ usr.bin/mkcsmapper_static \
+ usr.bin/vi/catalog
${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
cd ${.CURDIR}/${_tool}; \
${MAKE} DIRPRFX=${_tool}/ obj; \
@@ -1221,20 +1476,30 @@
${MAKE} DIRPRFX=${_tool}/ build-tools
.endfor
.for _tool in \
- ${_gcc_tools} \
- ${_kerberos5_bootstrap_tools}
- ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
- cd ${.CURDIR}/${_tool} && \
- ${MAKE} DIRPRFX=${_tool}/ obj && \
- ${MAKE} DIRPRFX=${_tool}/ depend && \
- ${MAKE} DIRPRFX=${_tool}/ all && \
- ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${WORLDTMP}/legacy install
+ ${_gcc_tools}
+ ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
+ cd ${.CURDIR}/${_tool}; \
+ ${MAKE} DIRPRFX=${_tool}/ obj; \
+ ${MAKE} DIRPRFX=${_tool}/ depend; \
+ ${MAKE} DIRPRFX=${_tool}/ all
.endfor
+
#
+# kernel-tools: Build kernel-building tools
+#
+kernel-tools:
+ mkdir -p ${MAKEOBJDIRPREFIX}/usr
+ mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
+ -p ${MAKEOBJDIRPREFIX}/usr >/dev/null
+
+#
# cross-tools: Build cross-building tools
#
-.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 4016
+.if !defined(TARGET_ARCH) && defined(XDEV_ARCH)
+TARGET_ARCH= ${XDEV_ARCH}
+.endif
+.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 800035
.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
_btxld= usr.sbin/btxld
.endif
@@ -1248,25 +1513,32 @@
.endif
.endif
-.if ${MK_BINUTILS} != "no"
+.if ${XAS:M/*} == "" && ${MK_BINUTILS} != "no"
_binutils= gnu/usr.bin/binutils
.endif
-.if ${MK_CLANG} != "no" && (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang")
+# If an full path to an external cross compiler is given, don't build
+# a cross compiler.
+.if ${XCC:M/*} == "" && ${MK_CROSS_COMPILER} != "no"
+.if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang"
_clang= usr.bin/clang
_clang_libs= lib/clang
+.else
+_gcc= gnu/usr.bin/cc
.endif
-.if ${MK_GCC} != "no" && (${MK_CLANG_IS_CC} == "no" || ${TARGET} == "pc98")
-_cc= gnu/usr.bin/cc
+# The boot2 for pc98 requires gcc.
+.if ${TARGET} == "pc98"
+_gcc= gnu/usr.bin/cc
.endif
+.endif
-cross-tools:
+cross-tools: .MAKE .PHONY
.for _tool in \
${_clang_libs} \
${_clang} \
${_binutils} \
- ${_cc} \
+ ${_gcc} \
usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
${_btxld} \
${_crunchide} \
@@ -1279,16 +1551,98 @@
${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
.endfor
+NXBDESTDIR= ${OBJTREE}/nxb-bin
+NXBENV= MAKEOBJDIRPREFIX=${OBJTREE}/nxb \
+ INSTALL="sh ${.CURDIR}/tools/install.sh" \
+ VERSION="${VERSION}"
+NXBMAKE= ${NXBENV} ${MAKE} \
+ TBLGEN=${NXBDESTDIR}/usr/bin/tblgen \
+ CLANG_TBLGEN=${NXBDESTDIR}/usr/bin/clang-tblgen \
+ MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} \
+ -DWITHOUT_GDB -DNO_TESTS \
+ SSP_CFLAGS= \
+ -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \
+ -DNO_PIC -DNO_PROFILE -DNO_SHARED \
+ -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF \
+ -DWITHOUT_CLANG_FULL -DWITHOUT_LLDB
+
+native-xtools: .PHONY
+ mkdir -p ${NXBDESTDIR}/bin ${NXBDESTDIR}/sbin ${NXBDESTDIR}/usr
+ mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
+ -p ${NXBDESTDIR}/usr >/dev/null
+ mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
+ -p ${NXBDESTDIR}/usr/include >/dev/null
+.for _tool in \
+ bin/cat \
+ bin/chmod \
+ bin/cp \
+ ${_tcsh} \
+ bin/echo \
+ bin/expr \
+ bin/hostname \
+ bin/ln \
+ bin/ls \
+ bin/mkdir \
+ bin/mv \
+ bin/ps \
+ bin/realpath \
+ bin/rm \
+ bin/rmdir \
+ bin/sh \
+ bin/sleep \
+ ${_clang_tblgen} \
+ usr.bin/ar \
+ ${_binutils} \
+ ${_gcc} \
+ ${_gcc_tools} \
+ ${_clang_libs} \
+ ${_clang} \
+ sbin/md5 \
+ sbin/sysctl \
+ gnu/usr.bin/diff \
+ usr.bin/awk \
+ usr.bin/basename \
+ usr.bin/bmake \
+ usr.bin/bzip2 \
+ usr.bin/cmp \
+ usr.bin/dirname \
+ usr.bin/env \
+ usr.bin/fetch \
+ usr.bin/find \
+ usr.bin/grep \
+ usr.bin/gzip \
+ usr.bin/id \
+ usr.bin/lex \
+ usr.bin/lorder \
+ usr.bin/mktemp \
+ usr.bin/mt \
+ usr.bin/patch \
+ usr.bin/sed \
+ usr.bin/sort \
+ usr.bin/tar \
+ usr.bin/touch \
+ usr.bin/tr \
+ usr.bin/true \
+ usr.bin/uniq \
+ usr.bin/unzip \
+ usr.bin/xargs \
+ usr.bin/xinstall \
+ usr.bin/xz \
+ usr.bin/yacc \
+ usr.sbin/chown
+ ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
+ cd ${.CURDIR}/${_tool}; \
+ ${NXBMAKE} DIRPRFX=${_tool}/ obj; \
+ ${NXBMAKE} DIRPRFX=${_tool}/ depend; \
+ ${NXBMAKE} DIRPRFX=${_tool}/ all; \
+ ${NXBMAKE} DIRPRFX=${_tool}/ DESTDIR=${NXBDESTDIR} install
+.endfor
+
#
# hierarchy - ensure that all the needed directories are present
#
-hierarchy:
-.if defined(NO_ROOT)
- cd ${.CURDIR}/etc; ${MAKE} LOCAL_MTREE=${LOCAL_MTREE} \
- -DNO_ROOT METALOG=${METALOG} distrib-dirs
-.else
- cd ${.CURDIR}/etc; ${MAKE} LOCAL_MTREE=${LOCAL_MTREE} distrib-dirs
-.endif
+hierarchy hier: .MAKE .PHONY
+ ${_+_}cd ${.CURDIR}/etc; ${HMAKE} distrib-dirs
#
# libraries - build all libraries, and install them under ${DESTDIR}.
@@ -1297,12 +1651,12 @@
# interdependencies (__L) are built automatically by the
# ${.CURDIR}/tools/make_libdeps.sh script.
#
-libraries:
- cd ${.CURDIR}; \
+libraries: .MAKE .PHONY
+ ${_+_}cd ${.CURDIR}; \
${MAKE} -f Makefile.inc1 _prereq_libs; \
${MAKE} -f Makefile.inc1 _startup_libs; \
${MAKE} -f Makefile.inc1 _prebuild_libs; \
- ${MAKE} -f Makefile.inc1 _generic_libs;
+ ${MAKE} -f Makefile.inc1 _generic_libs
#
# static libgcc.a prerequisite for shared libc
@@ -1315,13 +1669,7 @@
# all shared libraries for ELF.
#
_startup_libs= gnu/lib/csu
-.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
-_startup_libs+= lib/csu/${MACHINE_ARCH}-elf
-.elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
-_startup_libs+= lib/csu/${MACHINE_ARCH}
-.else
-_startup_libs+= lib/csu/${MACHINE_CPUARCH}
-.endif
+_startup_libs+= lib/csu
_startup_libs+= gnu/lib/libgcc
_startup_libs+= lib/libcompiler_rt
_startup_libs+= lib/libc
@@ -1345,42 +1693,86 @@
${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
${_kerberos5_lib_libroken} \
${_kerberos5_lib_libwind} \
- lib/libbz2 lib/libcom_err lib/libcrypt \
+ ${_lib_atf} \
+ lib/libbz2 ${_libcom_err} lib/libcrypt \
lib/libelf lib/libexpat \
+ lib/libfigpar \
${_lib_libgssapi} ${_lib_libipx} \
lib/libkiconv lib/libkvm lib/liblzma lib/libmd \
lib/ncurses/ncurses lib/ncurses/ncursesw \
lib/libopie lib/libpam ${_lib_libthr} \
- lib/libradius lib/libsbuf lib/libtacplus \
+ ${_lib_libradius} lib/libsbuf lib/libtacplus \
+ lib/libgeom \
${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
+ ${_cddl_lib_libuutil} \
+ ${_cddl_lib_libavl} \
${_cddl_lib_libzfs_core} \
lib/libutil ${_lib_libypclnt} lib/libz lib/msun \
- ${_secure_lib_libcrypto} ${_secure_lib_libssh} \
- ${_secure_lib_libssl} lib/libsqlite3 \
- lib/libarchive lib/libfetch lib/libmagic \
- lib/libblocksruntime
+ ${_secure_lib_libcrypto} ${_lib_libldns} \
+ ${_secure_lib_libssh} ${_secure_lib_libssl}
+.if ${MK_GNUCXX} != no
+_prebuild_libs+= gnu/lib/libstdc++ gnu/lib/libsupc++
+gnu/lib/libstdc++__L: lib/msun__L
+.endif
+
+.if ${MK_DIALOG} != "no"
+_prebuild_libs+= gnu/lib/libdialog
+gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L
+.endif
+
+.if ${MK_LIBCPLUSPLUS} != "no"
+_prebuild_libs+= lib/libc++
+.endif
+
+lib/libgeom__L: lib/libexpat__L
+
+.if defined(WITH_ATF) || ${MK_TESTS} != "no"
+.if !defined(WITH_ATF)
+# Ensure that the ATF libraries will be built during make libraries, even
+# though they will have -DNO_TESTS
+MAKE+= -DWITH_ATF
+.endif
+_lib_atf= lib/atf
+.if ${MK_GNUCXX} != no
+lib/atf__L: gnu/lib/libstdc++__L
+.endif
+.if ${MK_LIBCPLUSPLUS} != "no"
+lib/atf__L: lib/libc++__L lib/msun__L
+.endif
+.endif
+
.if ${MK_LIBTHR} != "no"
_lib_libthr= lib/libthr
.endif
+.if ${MK_RADIUS_SUPPORT} != "no"
+_lib_libradius= lib/libradius
+.endif
+
.if ${MK_OFED} != "no"
_ofed_lib= contrib/ofed/usr.lib/
.endif
-_generic_libs= ${_apache_lib} ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib}
+lib/liblzma__L: lib/libthr__L
+_generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib}
+.for _DIR in ${LOCAL_LIB_DIRS}
+.if exists(${.CURDIR}/${_DIR}/Makefile)
+_generic_libs+= ${_DIR}
+.endif
+.endfor
+
lib/libopie__L lib/libtacplus__L: lib/libmd__L
-.if ${MK_APACHE} != "no"
-_apache_lib= apache/lib
-.endif
-
.if ${MK_CDDL} != "no"
_cddl_lib_libumem= cddl/lib/libumem
_cddl_lib_libnvpair= cddl/lib/libnvpair
+_cddl_lib_libavl= cddl/lib/libavl
+_cddl_lib_libuutil= cddl/lib/libuutil
_cddl_lib_libzfs_core= cddl/lib/libzfs_core
_cddl_lib= cddl/lib
cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L
+cddl/lib/libzfs__L: lib/libgeom__L
.endif
.if ${MK_CRYPT} != "no"
@@ -1388,10 +1780,17 @@
_secure_lib_libcrypto= secure/lib/libcrypto
_secure_lib_libssl= secure/lib/libssl
lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
+.if ${MK_LDNS} != "no"
+_lib_libldns= lib/libldns
+lib/libldns__L: secure/lib/libcrypto__L
+.endif
.if ${MK_OPENSSH} != "no"
_secure_lib_libssh= secure/lib/libssh
secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
-.if ${MK_KERBEROS_SUPPORT} != "no"
+.if ${MK_LDNS} != "no"
+secure/lib/libssh__L: lib/libldns__L
+.endif
+.if ${MK_GSSAPI} != "no" && ${MK_KERBEROS_SUPPORT} != "no"
secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
lib/libmd__L kerberos5/lib/libroken__L
@@ -1405,7 +1804,7 @@
kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L
kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \
- kerberos5/lib/libwind__L kerberos5/lib/libheimsqlite__L
+ kerberos5/lib/libwind__L kerberos5/lib/libheimsqlite__L
kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \
kerberos5/lib/libroken__L lib/libcom_err__L
kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
@@ -1430,7 +1829,7 @@
.endif
.if ${MK_KERBEROS} != "no"
-_kerberos5_lib= kerberos5/lib
+_kerberos5_lib= kerberos5/lib
_kerberos5_lib_libasn1= kerberos5/lib/libasn1
_kerberos5_lib_libhdb= kerberos5/lib/libhdb
_kerberos5_lib_libheimbase= kerberos5/lib/libheimbase
@@ -1456,23 +1855,25 @@
${_lib}__PL: .PHONY .MAKE
.if exists(${.CURDIR}/${_lib})
${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
- cd ${.CURDIR}/${_lib} && \
- ${MAKE} DIRPRFX=${_lib}/ obj && \
- ${MAKE} DIRPRFX=${_lib}/ depend && \
- ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all && \
- ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install
+ cd ${.CURDIR}/${_lib}; \
+ ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ obj; \
+ ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ depend; \
+ ${MAKE} -DNO_TESTS -DNO_PROFILE -DNO_PIC \
+ DIRPRFX=${_lib}/ all; \
+ ${MAKE} -DNO_TESTS -DNO_PROFILE -DNO_PIC \
+ DIRPRFX=${_lib}/ install
.endif
.endfor
.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
-${_lib}__L: .PHONY
+${_lib}__L: .PHONY .MAKE
.if exists(${.CURDIR}/${_lib})
${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
- cd ${.CURDIR}/${_lib} && \
- ${MAKE} DIRPRFX=${_lib}/ obj && \
- ${MAKE} DIRPRFX=${_lib}/ depend && \
- ${MAKE} DIRPRFX=${_lib}/ all && \
- ${MAKE} DIRPRFX=${_lib}/ install
+ cd ${.CURDIR}/${_lib}; \
+ ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ obj; \
+ ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ depend; \
+ ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ all; \
+ ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ install
.endif
.endfor
@@ -1479,13 +1880,15 @@
# libpam is special: we need to build static PAM modules before
# static PAM library, and dynamic PAM library before dynamic PAM
# modules.
-lib/libpam__L: .PHONY
+lib/libpam__L: .PHONY .MAKE
${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
cd ${.CURDIR}/lib/libpam; \
- ${MAKE} DIRPRFX=lib/libpam/ obj; \
- ${MAKE} DIRPRFX=lib/libpam/ depend; \
- ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
- ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
+ ${MAKE} -DNO_TESTS DIRPRFX=lib/libpam/ obj; \
+ ${MAKE} -DNO_TESTS DIRPRFX=lib/libpam/ depend; \
+ ${MAKE} -DNO_TESTS DIRPRFX=lib/libpam/ \
+ -D_NO_LIBPAM_SO_YET all; \
+ ${MAKE} -DNO_TESTS DIRPRFX=lib/libpam/ \
+ -D_NO_LIBPAM_SO_YET install
_prereq_libs: ${_prereq_libs:S/$/__PL/}
_startup_libs: ${_startup_libs:S/$/__L/}
@@ -1494,8 +1897,8 @@
.for __target in all clean cleandepend cleandir depend includes obj
.for entry in ${SUBDIR}
-${entry}.${__target}__D: .PHONY
- ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
+${entry}.${__target}__D: .PHONY .MAKE
+ ${_+_}@set -e; if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
edir=${entry}.${MACHINE_ARCH}; \
cd ${.CURDIR}/$${edir}; \
@@ -1541,6 +1944,7 @@
# argument list will get too long. Using .for/.endfor make "loops" will make
# the Makefile parser segfault.
@exec 3<&0; \
+ cd ${.CURDIR}; \
${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
-V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
while read file; do \
@@ -1548,6 +1952,13 @@
chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
fi; \
+ for ext in debug symbols; do \
+ if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \
+ "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
+ rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \
+ <&3; \
+ fi; \
+ done; \
done
# Remove catpages without corresponding manpages.
@exec 3<&0; \
@@ -1563,12 +1974,18 @@
check-old-files:
@echo ">>> Checking for old files"
- @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
+ @cd ${.CURDIR}; \
+ ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
-V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
while read file; do \
if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
echo "${DESTDIR}/$${file}"; \
fi; \
+ for ext in debug symbols; do \
+ if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
+ echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \
+ fi; \
+ done; \
done
# Check for catpages without corresponding manpages.
@find ${DESTDIR}/usr/share/man/cat* ! -type d | \
@@ -1584,6 +2001,7 @@
@echo ">>> Removing old libraries"
@echo "${OLD_LIBS_MESSAGE}" | fmt
@exec 3<&0; \
+ cd ${.CURDIR}; \
${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
-V OLD_LIBS | xargs -n1 | \
while read file; do \
@@ -1591,23 +2009,37 @@
chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
fi; \
+ for ext in debug symbols; do \
+ if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \
+ "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
+ rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \
+ <&3; \
+ fi; \
+ done; \
done
@echo ">>> Old libraries removed"
check-old-libs:
@echo ">>> Checking for old libraries"
- @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
+ @cd ${.CURDIR}; \
+ ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
-V OLD_LIBS | xargs -n1 | \
while read file; do \
if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
echo "${DESTDIR}/$${file}"; \
fi; \
+ for ext in debug symbols; do \
+ if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
+ echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \
+ fi; \
+ done; \
done
delete-old-dirs:
@echo ">>> Removing old directories"
- @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
- -V OLD_DIRS | xargs -n1 | \
+ @cd ${.CURDIR}; \
+ ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
+ -V OLD_DIRS | xargs -n1 | sort -r | \
while read dir; do \
if [ -d "${DESTDIR}/$${dir}" ]; then \
rmdir -v "${DESTDIR}/$${dir}" || true; \
@@ -1614,12 +2046,18 @@
elif [ -L "${DESTDIR}/$${dir}" ]; then \
echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
fi; \
+ if [ -d "${DESTDIR}${DEBUGDIR}/$${dir}" ]; then \
+ rmdir -v "${DESTDIR}${DEBUGDIR}/$${dir}" || true; \
+ elif [ -L "${DESTDIR}${DEBUGDIR}/$${dir}" ]; then \
+ echo "${DESTDIR}${DEBUGDIR}/$${dir} is a link, please remove everything manually."; \
+ fi; \
done
@echo ">>> Old directories removed"
check-old-dirs:
@echo ">>> Checking for old directories"
- @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
+ @cd ${.CURDIR}; \
+ ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
-V OLD_DIRS | xargs -n1 | \
while read dir; do \
if [ -d "${DESTDIR}/$${dir}" ]; then \
@@ -1627,6 +2065,11 @@
elif [ -L "${DESTDIR}/$${dir}" ]; then \
echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
fi; \
+ if [ -d "${DESTDIR}${DEBUGDIR}/$${dir}" ]; then \
+ echo "${DESTDIR}${DEBUGDIR}/$${dir}"; \
+ elif [ -L "${DESTDIR}${DEBUGDIR}/$${dir}" ]; then \
+ echo "${DESTDIR}${DEBUGDIR}/$${dir} is a link, please remove everything manually."; \
+ fi; \
done
delete-old: delete-old-files delete-old-dirs
@@ -1642,7 +2085,7 @@
# showconfig - show build configuration.
#
showconfig:
- @${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort
+ @${MAKE} -n -f bsd.own.mk -V dummy -dg1 2>&1 | grep ^MK_ | sort
.if !empty(KRNLOBJDIR) && !empty(KERNCONF)
DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
@@ -1650,7 +2093,7 @@
.if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
.if exists(${KERNCONFDIR}/${KERNCONF})
FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \
- ${KERNCONFDIR}/${KERNCONF} ; echo
+ '${KERNCONFDIR}/${KERNCONF}' ; echo
.endif
.endif
@@ -1664,23 +2107,9 @@
# Build 'standalone' Device Tree Blob
#
builddtb:
- @if [ "${FDT_DTS_FILE}" = "" ]; then \
- echo "ERROR: FDT_DTS_FILE must be specified!"; \
- exit 1; \
- fi; \
- if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} ]; then \
- echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \
- exist!"; \
- exit 1; \
- fi; \
- if [ "${DTBOUTPUTPATH}" = "${.CURDIR}" ]; then \
- echo "WARNING: DTB will be placed in the current working \
- directory"; \
- fi
- @PATH=${TMPPATH} \
- dtc -O dtb -o \
- ${DTBOUTPUTPATH}/`echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb -b 0 \
- -p 1024 ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE}
+ @PATH=${TMPPATH} MACHINE=${TARGET} \
+ ${.CURDIR}/sys/tools/fdt/make_dtb.sh ${.CURDIR}/sys \
+ "${FDT_DTS_FILE}" ${DTBOUTPUTPATH}
###############
@@ -1693,25 +2122,33 @@
.endif
NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
- -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE \
- -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS \
+ -DWITHOUT_MAN -DWITHOUT_NLS -DNO_PROFILE \
+ -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_TESTS -DNO_WARNS \
TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \
CPUTYPE=${XDEV_CPUTYPE}
-XDDIR=${XDEV_ARCH}-midnightbsd
-XDTP=/usr/${XDDIR}
+XDDIR=${XDEV_ARCH}-freebsd
+XDTP?=/usr/${XDDIR}
+.if ${XDTP:N/*}
+.error XDTP variable should be an absolute path
+.endif
+
CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \
INSTALL="sh ${.CURDIR}/tools/install.sh"
CDENV= ${CDBENV} \
- _SHLIBDIRPREFIX=${XDTP} \
+ _SHLIBDIRPREFIX=${XDDESTDIR} \
TOOLS_PREFIX=${XDTP}
-CD2ENV=${CDENV} \
+CD2CFLAGS=-isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib \
+ --sysroot=${XDDESTDIR}/ -B${XDDESTDIR}/usr/libexec \
+ -B${XDDESTDIR}/usr/bin -B${XDDESTDIR}/usr/lib
+CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" CXX="${CXX} ${CD2CFLAGS}" \
+ CPP="${CPP} ${CD2CFLAGS}" \
MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH}
-CDTMP= ${MAKEOBJDIRPREFIX}/${XDEV}/${.CURDIR}/tmp
-CDMAKE=${CDENV} ${MAKE} ${NOFUN}
-CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
-XDDESTDIR=${DESTDIR}${XDTP}
+CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp
+CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
+CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDDESTDIR}/usr/bin:${PATH} ${MAKE} ${NOFUN}
+XDDESTDIR=${DESTDIR}/${XDTP}
.if !defined(OSREL)
OSREL!= uname -r | sed -e 's/[-(].*//'
.endif
@@ -1719,18 +2156,36 @@
.ORDER: xdev-build xdev-install
xdev: xdev-build xdev-install
-.ORDER: _xb-build-tools _xb-cross-tools
-xdev-build: _xb-build-tools _xb-cross-tools
+.ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
+xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
-_xb-build-tools:
+_xb-worldtmp: .PHONY
+ mkdir -p ${CDTMP}/usr
+ mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
+ -p ${CDTMP}/usr >/dev/null
+
+_xb-bootstrap-tools: .PHONY
+.for _tool in \
+ ${_clang_tblgen}
+ ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
+ cd ${.CURDIR}/${_tool}; \
+ ${CDMAKE} DIRPRFX=${_tool}/ obj; \
+ ${CDMAKE} DIRPRFX=${_tool}/ depend; \
+ ${CDMAKE} DIRPRFX=${_tool}/ all; \
+ ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install
+.endfor
+
+_xb-build-tools: .PHONY
${_+_}@cd ${.CURDIR}; \
${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
-_xb-cross-tools:
+_xb-cross-tools: .PHONY
.for _tool in \
- gnu/usr.bin/binutils \
- gnu/usr.bin/cc \
- usr.bin/ar
+ ${_binutils} \
+ usr.bin/ar \
+ ${_clang_libs} \
+ ${_clang} \
+ ${_gcc}
${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
cd ${.CURDIR}/${_tool}; \
${CDMAKE} DIRPRFX=${_tool}/ obj; \
@@ -1738,7 +2193,7 @@
${CDMAKE} DIRPRFX=${_tool}/ all
.endfor
-_xi-mtree:
+_xi-mtree: .PHONY
${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
mkdir -p ${XDDESTDIR}
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
@@ -1747,31 +2202,39 @@
-p ${XDDESTDIR}/usr >/dev/null
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
-p ${XDDESTDIR}/usr/include >/dev/null
+.if ${MK_TESTS} != "no"
+ mkdir -p ${XDDESTDIR}${TESTSBASE}
+ mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
+ -p ${XDDESTDIR}${TESTSBASE} >/dev/null
+.endif
-.ORDER: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
-xdev-install: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
+.ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
+xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
-_xi-cross-tools:
+_xi-cross-tools: .PHONY
@echo "_xi-cross-tools"
.for _tool in \
- gnu/usr.bin/binutils \
- gnu/usr.bin/cc \
- usr.bin/ar
+ ${_binutils} \
+ usr.bin/ar \
+ ${_clang_libs} \
+ ${_clang} \
+ ${_gcc}
${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
cd ${.CURDIR}/${_tool}; \
${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
.endfor
-_xi-includes:
+_xi-includes: .PHONY
${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \
DESTDIR=${XDDESTDIR}
-_xi-libraries:
+_xi-libraries: .PHONY
${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
DESTDIR=${XDDESTDIR}
-_xi-links:
+_xi-links: .PHONY
${_+_}cd ${XDDESTDIR}/usr/bin; \
+ mkdir -p ../../../../usr/bin; \
for i in *; do \
ln -sf ../../${XDTP}/usr/bin/$$i \
../../../../usr/bin/${XDDIR}-$$i; \
@@ -1778,4 +2241,7 @@
ln -sf ../../${XDTP}/usr/bin/$$i \
../../../../usr/bin/${XDDIR}${OSREL}-$$i; \
done
+.else
+xdev xdev-build xdev-install:
+ @echo "*** Error: Both XDEV and XDEV_ARCH must be defined for \"${.TARGET}\" target"
.endif
More information about the Midnightbsd-cvs
mailing list