Deleted Added
full compact
Makefile.libcompat (276414) Makefile.libcompat (276551)
1#
1#
2# $FreeBSD: head/Makefile.inc1 276414 2014-12-30 18:42:53Z emaste $
2# $FreeBSD: head/Makefile.inc1 276551 2015-01-02 18:45:03Z bapt $
3#
4# Make command line options:
5# -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
6# -DNO_CLEAN do not clean at all
7# -DDB_FROM_SRC use the user/group databases in src/etc instead of
8# the system database when installing.
9# -DNO_SHARE do not go into share subdir
10# -DKERNFAST define NO_KERNEL{CONFIG,CLEAN,DEPEND,OBJ}
11# -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
12# -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
13# -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
14# -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel
15# -DNO_PORTSUPDATE do not update ports in ${MAKE} update
16# -DNO_ROOT install without using root privilege
17# -DNO_DOCUPDATE do not update doc in ${MAKE} update
18# -DWITHOUT_CTF do not run the DTrace CTF conversion tools on built objects
19# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
20# LOCAL_ITOOLS="list of tools" to add additional tools to the ITOOLS list
21# LOCAL_LIB_DIRS="list of dirs" to add additional dirs to libraries target
22# LOCAL_MTREE="list of mtree files" to process to allow local directories
23# to be created before files are installed
24# LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools
25# list
26# METALOG="path to metadata log" to write permission and ownership
27# when NO_ROOT is set. (default: ${DESTDIR}/METALOG)
28# TARGET="machine" to crossbuild world for a different machine type
29# TARGET_ARCH= may be required when a TARGET supports multiple endians
30# BUILDENV_SHELL= shell to launch for the buildenv target (def:/bin/sh)
31# WORLD_FLAGS= additional flags to pass to make(1) during buildworld
32# KERNEL_FLAGS= additional flags to pass to make(1) during buildkernel
33
34#
35# The intended user-driven targets are:
36# buildworld - rebuild *everything*, including glue to help do upgrades
37# installworld- install everything built by "buildworld"
38# doxygen - build API documentation of the kernel
39# update - convenient way to update your source tree (eg: svn/svnup)
40#
41# Standard targets (not defined here) are documented in the makefiles in
42# /usr/share/mk. These include:
43# obj depend all install clean cleandepend cleanobj
44
45.if !defined(TARGET) || !defined(TARGET_ARCH)
46.error "Both TARGET and TARGET_ARCH must be defined."
47.endif
48
49.include "share/mk/src.opts.mk"
50.include <bsd.arch.inc.mk>
51.include <bsd.compiler.mk>
52
53# We must do share/info early so that installation of info `dir'
54# entries works correctly. Do it first since it is less likely to
55# grow dependencies on include and lib than vice versa.
56#
57# We must do lib/ and libexec/ before bin/, because if installworld
58# installs a new /bin/sh, the 'make' command will *immediately*
59# use that new version. And the new (dynamically-linked) /bin/sh
60# will expect to find appropriate libraries in /lib and /libexec.
61#
62SRCDIR?= ${.CURDIR}
63.if defined(SUBDIR_OVERRIDE)
64SUBDIR= ${SUBDIR_OVERRIDE}
65.else
66SUBDIR= share/info lib libexec
67SUBDIR+=bin
68.if ${MK_GAMES} != "no"
69SUBDIR+=games
70.endif
71.if ${MK_CDDL} != "no"
72SUBDIR+=cddl
73.endif
74SUBDIR+=gnu include
75.if ${MK_KERBEROS} != "no"
76SUBDIR+=kerberos5
77.endif
78.if ${MK_RESCUE} != "no"
79SUBDIR+=rescue
80.endif
81SUBDIR+=sbin
82.if ${MK_CRYPT} != "no"
83SUBDIR+=secure
84.endif
85.if !defined(NO_SHARE)
86SUBDIR+=share
87.endif
88SUBDIR+=sys usr.bin usr.sbin
89.if ${MK_TESTS} != "no"
90SUBDIR+= tests
91.endif
92.if ${MK_OFED} != "no"
93SUBDIR+=contrib/ofed
94.endif
95#
96# We must do etc/ last for install/distribute to work.
97#
98SUBDIR+=etc
99
100# Local directories are last, since it is nice to at least get the base
101# system rebuilt before you do them.
102.for _DIR in ${LOCAL_DIRS}
103.if exists(${.CURDIR}/${_DIR}/Makefile)
104SUBDIR+= ${_DIR}
105.endif
106.endfor
107# Add LOCAL_LIB_DIRS, but only if they will not be picked up as a SUBDIR
108# of a LOCAL_DIRS directory. This allows LOCAL_DIRS=foo and
109# LOCAL_LIB_DIRS=foo/lib to behave as expected.
110.for _DIR in ${LOCAL_DIRS:M*/} ${LOCAL_DIRS:N*/:S|$|/|}
111_REDUNDENT_LIB_DIRS+= ${LOCAL_LIB_DIRS:M${_DIR}*}
112.endfor
113.for _DIR in ${LOCAL_LIB_DIRS}
114.if empty(_REDUNDENT_LIB_DIRS:M${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile)
115SUBDIR+= ${_DIR}
116.else
117.warning ${_DIR} not added to SUBDIR list. See UPDATING 20141121.
118.endif
119.endfor
120.endif
121
122.if defined(NOCLEAN)
123NO_CLEAN= ${NOCLEAN}
124.endif
125.if defined(NO_CLEANDIR)
126CLEANDIR= clean cleandepend
127.else
128CLEANDIR= cleandir
129.endif
130
131LOCAL_TOOL_DIRS?=
132
133BUILDENV_SHELL?=/bin/sh
134
135SVN?= /usr/local/bin/svn
136SVNFLAGS?= -r HEAD
137
138MAKEOBJDIRPREFIX?= /usr/obj
139.if !defined(OSRELDATE)
140.if exists(/usr/include/osreldate.h)
141OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
142 /usr/include/osreldate.h
143.else
144OSRELDATE= 0
145.endif
146.endif
147
148.if !defined(VERSION)
149REVISION!= ${MAKE} -C ${SRCDIR}/release -V REVISION
150BRANCH!= ${MAKE} -C ${SRCDIR}/release -V BRANCH
151SRCRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
152 ${SRCDIR}/sys/sys/param.h
153VERSION= FreeBSD ${REVISION}-${BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} ${SRCRELDATE}
154.endif
155
156KNOWN_ARCHES?= amd64 arm armeb/arm armv6/arm armv6hf/arm i386 i386/pc98 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64
157.if ${TARGET} == ${TARGET_ARCH}
158_t= ${TARGET}
159.else
160_t= ${TARGET_ARCH}/${TARGET}
161.endif
162.for _t in ${_t}
163.if empty(KNOWN_ARCHES:M${_t})
164.error Unknown target ${TARGET_ARCH}:${TARGET}.
165.endif
166.endfor
167
168.if ${TARGET} == ${MACHINE}
169TARGET_CPUTYPE?=${CPUTYPE}
170.else
171TARGET_CPUTYPE?=
172.endif
173
174.if !empty(TARGET_CPUTYPE)
175_TARGET_CPUTYPE=${TARGET_CPUTYPE}
176.else
177_TARGET_CPUTYPE=dummy
178.endif
179_CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \
180 -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE
181.if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
182.error CPUTYPE global should be set with ?=.
183.endif
184.if make(buildworld)
185BUILD_ARCH!= uname -p
186.if ${MACHINE_ARCH} != ${BUILD_ARCH}
187.error To cross-build, set TARGET_ARCH.
188.endif
189.endif
190.if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING)
191OBJTREE= ${MAKEOBJDIRPREFIX}
192.else
193OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH}
194.endif
195WORLDTMP= ${OBJTREE}${.CURDIR}/tmp
196# /usr/games added for fortune which depend on strfile
197BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games:${WORLDTMP}/legacy/bin
198XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
199STRICTTMPPATH= ${BPATH}:${XPATH}
200TMPPATH= ${STRICTTMPPATH}:${PATH}
201
202#
203# Avoid running mktemp(1) unless actually needed.
204# It may not be functional, e.g., due to new ABI
205# when in the middle of installing over this system.
206#
207.if make(distributeworld) || make(installworld)
208INSTALLTMP!= /usr/bin/mktemp -d -u -t install
209.endif
210
211#
212# Building a world goes through the following stages
213#
214# 1. legacy stage [BMAKE]
215# This stage is responsible for creating compatibility
216# shims that are needed by the bootstrap-tools,
217# build-tools and cross-tools stages.
218# 1. bootstrap-tools stage [BMAKE]
219# This stage is responsible for creating programs that
220# are needed for backward compatibility reasons. They
221# are not built as cross-tools.
222# 2. build-tools stage [TMAKE]
223# This stage is responsible for creating the object
224# tree and building any tools that are needed during
225# the build process.
226# 3. cross-tools stage [XMAKE]
227# This stage is responsible for creating any tools that
228# are needed for cross-builds. A cross-compiler is one
229# of them.
230# 4. world stage [WMAKE]
231# This stage actually builds the world.
232# 5. install stage (optional) [IMAKE]
233# This stage installs a previously built world.
234#
235
236BOOTSTRAPPING?= 0
237
238# Common environment for world related stages
239CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
240 MACHINE_ARCH=${TARGET_ARCH} \
241 MACHINE=${TARGET} \
242 CPUTYPE=${TARGET_CPUTYPE}
243.if ${MK_GROFF} != "no"
244CROSSENV+= GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
245 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
246 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
247.endif
248.if defined(TARGET_CFLAGS)
249CROSSENV+= ${TARGET_CFLAGS}
250.endif
251
252# bootstrap-tools stage
253BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
254 PATH=${BPATH}:${PATH} \
255 WORLDTMP=${WORLDTMP} \
256 VERSION="${VERSION}" \
257 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
258BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
259 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
260 DESTDIR= \
261 BOOTSTRAPPING=${OSRELDATE} \
262 SSP_CFLAGS= \
3#
4# Make command line options:
5# -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
6# -DNO_CLEAN do not clean at all
7# -DDB_FROM_SRC use the user/group databases in src/etc instead of
8# the system database when installing.
9# -DNO_SHARE do not go into share subdir
10# -DKERNFAST define NO_KERNEL{CONFIG,CLEAN,DEPEND,OBJ}
11# -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
12# -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
13# -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
14# -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel
15# -DNO_PORTSUPDATE do not update ports in ${MAKE} update
16# -DNO_ROOT install without using root privilege
17# -DNO_DOCUPDATE do not update doc in ${MAKE} update
18# -DWITHOUT_CTF do not run the DTrace CTF conversion tools on built objects
19# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
20# LOCAL_ITOOLS="list of tools" to add additional tools to the ITOOLS list
21# LOCAL_LIB_DIRS="list of dirs" to add additional dirs to libraries target
22# LOCAL_MTREE="list of mtree files" to process to allow local directories
23# to be created before files are installed
24# LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools
25# list
26# METALOG="path to metadata log" to write permission and ownership
27# when NO_ROOT is set. (default: ${DESTDIR}/METALOG)
28# TARGET="machine" to crossbuild world for a different machine type
29# TARGET_ARCH= may be required when a TARGET supports multiple endians
30# BUILDENV_SHELL= shell to launch for the buildenv target (def:/bin/sh)
31# WORLD_FLAGS= additional flags to pass to make(1) during buildworld
32# KERNEL_FLAGS= additional flags to pass to make(1) during buildkernel
33
34#
35# The intended user-driven targets are:
36# buildworld - rebuild *everything*, including glue to help do upgrades
37# installworld- install everything built by "buildworld"
38# doxygen - build API documentation of the kernel
39# update - convenient way to update your source tree (eg: svn/svnup)
40#
41# Standard targets (not defined here) are documented in the makefiles in
42# /usr/share/mk. These include:
43# obj depend all install clean cleandepend cleanobj
44
45.if !defined(TARGET) || !defined(TARGET_ARCH)
46.error "Both TARGET and TARGET_ARCH must be defined."
47.endif
48
49.include "share/mk/src.opts.mk"
50.include <bsd.arch.inc.mk>
51.include <bsd.compiler.mk>
52
53# We must do share/info early so that installation of info `dir'
54# entries works correctly. Do it first since it is less likely to
55# grow dependencies on include and lib than vice versa.
56#
57# We must do lib/ and libexec/ before bin/, because if installworld
58# installs a new /bin/sh, the 'make' command will *immediately*
59# use that new version. And the new (dynamically-linked) /bin/sh
60# will expect to find appropriate libraries in /lib and /libexec.
61#
62SRCDIR?= ${.CURDIR}
63.if defined(SUBDIR_OVERRIDE)
64SUBDIR= ${SUBDIR_OVERRIDE}
65.else
66SUBDIR= share/info lib libexec
67SUBDIR+=bin
68.if ${MK_GAMES} != "no"
69SUBDIR+=games
70.endif
71.if ${MK_CDDL} != "no"
72SUBDIR+=cddl
73.endif
74SUBDIR+=gnu include
75.if ${MK_KERBEROS} != "no"
76SUBDIR+=kerberos5
77.endif
78.if ${MK_RESCUE} != "no"
79SUBDIR+=rescue
80.endif
81SUBDIR+=sbin
82.if ${MK_CRYPT} != "no"
83SUBDIR+=secure
84.endif
85.if !defined(NO_SHARE)
86SUBDIR+=share
87.endif
88SUBDIR+=sys usr.bin usr.sbin
89.if ${MK_TESTS} != "no"
90SUBDIR+= tests
91.endif
92.if ${MK_OFED} != "no"
93SUBDIR+=contrib/ofed
94.endif
95#
96# We must do etc/ last for install/distribute to work.
97#
98SUBDIR+=etc
99
100# Local directories are last, since it is nice to at least get the base
101# system rebuilt before you do them.
102.for _DIR in ${LOCAL_DIRS}
103.if exists(${.CURDIR}/${_DIR}/Makefile)
104SUBDIR+= ${_DIR}
105.endif
106.endfor
107# Add LOCAL_LIB_DIRS, but only if they will not be picked up as a SUBDIR
108# of a LOCAL_DIRS directory. This allows LOCAL_DIRS=foo and
109# LOCAL_LIB_DIRS=foo/lib to behave as expected.
110.for _DIR in ${LOCAL_DIRS:M*/} ${LOCAL_DIRS:N*/:S|$|/|}
111_REDUNDENT_LIB_DIRS+= ${LOCAL_LIB_DIRS:M${_DIR}*}
112.endfor
113.for _DIR in ${LOCAL_LIB_DIRS}
114.if empty(_REDUNDENT_LIB_DIRS:M${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile)
115SUBDIR+= ${_DIR}
116.else
117.warning ${_DIR} not added to SUBDIR list. See UPDATING 20141121.
118.endif
119.endfor
120.endif
121
122.if defined(NOCLEAN)
123NO_CLEAN= ${NOCLEAN}
124.endif
125.if defined(NO_CLEANDIR)
126CLEANDIR= clean cleandepend
127.else
128CLEANDIR= cleandir
129.endif
130
131LOCAL_TOOL_DIRS?=
132
133BUILDENV_SHELL?=/bin/sh
134
135SVN?= /usr/local/bin/svn
136SVNFLAGS?= -r HEAD
137
138MAKEOBJDIRPREFIX?= /usr/obj
139.if !defined(OSRELDATE)
140.if exists(/usr/include/osreldate.h)
141OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
142 /usr/include/osreldate.h
143.else
144OSRELDATE= 0
145.endif
146.endif
147
148.if !defined(VERSION)
149REVISION!= ${MAKE} -C ${SRCDIR}/release -V REVISION
150BRANCH!= ${MAKE} -C ${SRCDIR}/release -V BRANCH
151SRCRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
152 ${SRCDIR}/sys/sys/param.h
153VERSION= FreeBSD ${REVISION}-${BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} ${SRCRELDATE}
154.endif
155
156KNOWN_ARCHES?= amd64 arm armeb/arm armv6/arm armv6hf/arm i386 i386/pc98 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64
157.if ${TARGET} == ${TARGET_ARCH}
158_t= ${TARGET}
159.else
160_t= ${TARGET_ARCH}/${TARGET}
161.endif
162.for _t in ${_t}
163.if empty(KNOWN_ARCHES:M${_t})
164.error Unknown target ${TARGET_ARCH}:${TARGET}.
165.endif
166.endfor
167
168.if ${TARGET} == ${MACHINE}
169TARGET_CPUTYPE?=${CPUTYPE}
170.else
171TARGET_CPUTYPE?=
172.endif
173
174.if !empty(TARGET_CPUTYPE)
175_TARGET_CPUTYPE=${TARGET_CPUTYPE}
176.else
177_TARGET_CPUTYPE=dummy
178.endif
179_CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \
180 -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE
181.if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
182.error CPUTYPE global should be set with ?=.
183.endif
184.if make(buildworld)
185BUILD_ARCH!= uname -p
186.if ${MACHINE_ARCH} != ${BUILD_ARCH}
187.error To cross-build, set TARGET_ARCH.
188.endif
189.endif
190.if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING)
191OBJTREE= ${MAKEOBJDIRPREFIX}
192.else
193OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH}
194.endif
195WORLDTMP= ${OBJTREE}${.CURDIR}/tmp
196# /usr/games added for fortune which depend on strfile
197BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games:${WORLDTMP}/legacy/bin
198XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
199STRICTTMPPATH= ${BPATH}:${XPATH}
200TMPPATH= ${STRICTTMPPATH}:${PATH}
201
202#
203# Avoid running mktemp(1) unless actually needed.
204# It may not be functional, e.g., due to new ABI
205# when in the middle of installing over this system.
206#
207.if make(distributeworld) || make(installworld)
208INSTALLTMP!= /usr/bin/mktemp -d -u -t install
209.endif
210
211#
212# Building a world goes through the following stages
213#
214# 1. legacy stage [BMAKE]
215# This stage is responsible for creating compatibility
216# shims that are needed by the bootstrap-tools,
217# build-tools and cross-tools stages.
218# 1. bootstrap-tools stage [BMAKE]
219# This stage is responsible for creating programs that
220# are needed for backward compatibility reasons. They
221# are not built as cross-tools.
222# 2. build-tools stage [TMAKE]
223# This stage is responsible for creating the object
224# tree and building any tools that are needed during
225# the build process.
226# 3. cross-tools stage [XMAKE]
227# This stage is responsible for creating any tools that
228# are needed for cross-builds. A cross-compiler is one
229# of them.
230# 4. world stage [WMAKE]
231# This stage actually builds the world.
232# 5. install stage (optional) [IMAKE]
233# This stage installs a previously built world.
234#
235
236BOOTSTRAPPING?= 0
237
238# Common environment for world related stages
239CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
240 MACHINE_ARCH=${TARGET_ARCH} \
241 MACHINE=${TARGET} \
242 CPUTYPE=${TARGET_CPUTYPE}
243.if ${MK_GROFF} != "no"
244CROSSENV+= GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
245 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
246 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
247.endif
248.if defined(TARGET_CFLAGS)
249CROSSENV+= ${TARGET_CFLAGS}
250.endif
251
252# bootstrap-tools stage
253BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
254 PATH=${BPATH}:${PATH} \
255 WORLDTMP=${WORLDTMP} \
256 VERSION="${VERSION}" \
257 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
258BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
259 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
260 DESTDIR= \
261 BOOTSTRAPPING=${OSRELDATE} \
262 SSP_CFLAGS= \
263 MK_HTML=no MK_INFO=no NO_LINT=yes MK_MAN=no \
263 MK_HTML=no NO_LINT=yes MK_MAN=no \
264 -DNO_PIC MK_PROFILE=no -DNO_SHARED \
265 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
266 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \
267 MK_LLDB=no MK_TESTS=no
268
269# build-tools stage
270TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
271 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
272 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
273 DESTDIR= \
274 BOOTSTRAPPING=${OSRELDATE} \
275 SSP_CFLAGS= \
276 -DNO_LINT \
277 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
278 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \
279 MK_LLDB=no MK_TESTS=no
280
281# cross-tools stage
282XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
283 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
284 MK_GDB=no MK_TESTS=no
285
286# kernel-tools stage
287KTMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
288 PATH=${BPATH}:${PATH} \
289 WORLDTMP=${WORLDTMP} \
290 VERSION="${VERSION}"
291KTMAKE= TOOLS_PREFIX=${WORLDTMP} MAKEOBJDIRPREFIX=${WORLDTMP} \
292 ${KTMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
293 DESTDIR= \
294 BOOTSTRAPPING=${OSRELDATE} \
295 SSP_CFLAGS= \
264 -DNO_PIC MK_PROFILE=no -DNO_SHARED \
265 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
266 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \
267 MK_LLDB=no MK_TESTS=no
268
269# build-tools stage
270TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
271 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
272 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
273 DESTDIR= \
274 BOOTSTRAPPING=${OSRELDATE} \
275 SSP_CFLAGS= \
276 -DNO_LINT \
277 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
278 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \
279 MK_LLDB=no MK_TESTS=no
280
281# cross-tools stage
282XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
283 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
284 MK_GDB=no MK_TESTS=no
285
286# kernel-tools stage
287KTMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
288 PATH=${BPATH}:${PATH} \
289 WORLDTMP=${WORLDTMP} \
290 VERSION="${VERSION}"
291KTMAKE= TOOLS_PREFIX=${WORLDTMP} MAKEOBJDIRPREFIX=${WORLDTMP} \
292 ${KTMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
293 DESTDIR= \
294 BOOTSTRAPPING=${OSRELDATE} \
295 SSP_CFLAGS= \
296 MK_HTML=no MK_INFO=no -DNO_LINT MK_MAN=no \
296 MK_HTML=no -DNO_LINT MK_MAN=no \
297 -DNO_PIC MK_PROFILE=no -DNO_SHARED \
298 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no
299
300# world stage
301WMAKEENV= ${CROSSENV} \
302 _SHLIBDIRPREFIX=${WORLDTMP} \
303 _LDSCRIPTROOT= \
304 VERSION="${VERSION}" \
305 INSTALL="sh ${.CURDIR}/tools/install.sh" \
306 PATH=${TMPPATH}
307
308# make hierarchy
309HMAKE= PATH=${TMPPATH} ${MAKE} LOCAL_MTREE=${LOCAL_MTREE:Q}
310.if defined(NO_ROOT)
311HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT
312.endif
313
314.if ${MK_CDDL} == "no"
315WMAKEENV+= MK_CTF=no
316.endif
317
318.if defined(CROSS_TOOLCHAIN)
319LOCALBASE?= /usr/local
320.include "${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk"
321.endif
322.if defined(CROSS_TOOLCHAIN_PREFIX)
323CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
324CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
325.endif
326XCOMPILERS= CC CXX CPP
327.for COMPILER in ${XCOMPILERS}
328.if defined(CROSS_COMPILER_PREFIX)
329X${COMPILER}?= ${CROSS_COMPILER_PREFIX}${${COMPILER}}
330.else
331X${COMPILER}?= ${${COMPILER}}
332.endif
333.endfor
334XBINUTILS= AS AR LD NM OBJCOPY OBJDUMP RANLIB SIZE STRINGS
335.for BINUTIL in ${XBINUTILS}
336.if defined(CROSS_BINUTILS_PREFIX)
337X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${${BINUTIL}}
338.else
339X${BINUTIL}?= ${${BINUTIL}}
340.endif
341.endfor
342WMAKEENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCFLAGS} ${XCXXFLAGS}" \
343 DEPFLAGS="${DEPFLAGS}" \
344 CPP="${XCPP} ${XCFLAGS}" \
345 AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \
346 OBJDUMP=${XOBJDUMP} OBJCOPY="${XOBJCOPY}" \
347 RANLIB=${XRANLIB} STRINGS=${XSTRINGS} \
348 SIZE="${XSIZE}"
349
350.if ${XCC:M/*}
351XFLAGS= --sysroot=${WORLDTMP}
352.if defined(CROSS_BINUTILS_PREFIX)
353# In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a
354# directory, but the compiler will look in the right place for it's
355# tools so we don't need to tell it where to look.
356.if exists(${CROSS_BINUTILS_PREFIX})
357XFLAGS+= -B${CROSS_BINUTILS_PREFIX}
358.endif
359.else
360XFLAGS+= -B${WORLDTMP}/usr/bin
361.endif
362.if ${TARGET} == "arm"
363.if ${TARGET_ARCH:M*hf*} != ""
364TARGET_ABI= gnueabihf
365.else
366TARGET_ABI= gnueabi
367.endif
368.endif
369.if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc
370XCFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib
371XCXXFLAGS+= -I${WORLDTMP}/usr/include/c++/v1 -std=gnu++11 -L${WORLDTMP}/../lib/libc++
372DEPFLAGS+= -I${WORLDTMP}/usr/include/c++/v1
373.else
374TARGET_ABI?= unknown
375TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
376XCFLAGS+= -target ${TARGET_TRIPLE}
377.endif
378.endif
379
380WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP}
381
382.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
383# 32 bit world
384LIB32_OBJTREE= ${OBJTREE}${.CURDIR}/world32
385LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
386
387.if ${TARGET_ARCH} == "amd64"
388.if empty(TARGET_CPUTYPE)
389LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
390.else
391LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
392.endif
393LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \
394 MACHINE_CPU="i686 mmx sse sse2"
395LIB32WMAKEFLAGS= \
396 AS="${AS} --32" \
397 LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32"
398
399.elif ${TARGET_ARCH} == "powerpc64"
400.if empty(TARGET_CPUTYPE)
401LIB32CPUFLAGS= -mcpu=powerpc
402.else
403LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
404.endif
405LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc
406LIB32WMAKEFLAGS= \
407 LD="${LD} -m elf32ppc_fbsd"
408.endif
409
410
411LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \
412 -isystem ${LIB32TMP}/usr/include/ \
413 -L${LIB32TMP}/usr/lib32 \
414 -B${LIB32TMP}/usr/lib32
415.if ${XCC:M/*}
416LIB32FLAGS+= --sysroot=${WORLDTMP}
417.endif
418
419# Yes, the flags are redundant.
420LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${LIB32_OBJTREE} \
421 _SHLIBDIRPREFIX=${LIB32TMP} \
422 _LDSCRIPTROOT=${LIB32TMP} \
423 VERSION="${VERSION}" \
424 INSTALL="sh ${.CURDIR}/tools/install.sh" \
425 PATH=${TMPPATH} \
426 LIBDIR=/usr/lib32 \
427 SHLIBDIR=/usr/lib32 \
428 LIBPRIVATEDIR=/usr/lib32/private \
429 DTRACE="${DTRACE} -32"
430LIB32WMAKEFLAGS+= CC="${XCC} ${LIB32FLAGS}" \
431 CXX="${XCXX} ${LIB32FLAGS}" \
432 DESTDIR=${LIB32TMP} \
433 -DCOMPAT_32BIT \
434 -DLIBRARIES_ONLY \
435 -DNO_CPU_CFLAGS \
436 MK_CTF=no \
437 -DNO_LINT \
438 MK_TESTS=no
439
440LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \
297 -DNO_PIC MK_PROFILE=no -DNO_SHARED \
298 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no
299
300# world stage
301WMAKEENV= ${CROSSENV} \
302 _SHLIBDIRPREFIX=${WORLDTMP} \
303 _LDSCRIPTROOT= \
304 VERSION="${VERSION}" \
305 INSTALL="sh ${.CURDIR}/tools/install.sh" \
306 PATH=${TMPPATH}
307
308# make hierarchy
309HMAKE= PATH=${TMPPATH} ${MAKE} LOCAL_MTREE=${LOCAL_MTREE:Q}
310.if defined(NO_ROOT)
311HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT
312.endif
313
314.if ${MK_CDDL} == "no"
315WMAKEENV+= MK_CTF=no
316.endif
317
318.if defined(CROSS_TOOLCHAIN)
319LOCALBASE?= /usr/local
320.include "${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk"
321.endif
322.if defined(CROSS_TOOLCHAIN_PREFIX)
323CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
324CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
325.endif
326XCOMPILERS= CC CXX CPP
327.for COMPILER in ${XCOMPILERS}
328.if defined(CROSS_COMPILER_PREFIX)
329X${COMPILER}?= ${CROSS_COMPILER_PREFIX}${${COMPILER}}
330.else
331X${COMPILER}?= ${${COMPILER}}
332.endif
333.endfor
334XBINUTILS= AS AR LD NM OBJCOPY OBJDUMP RANLIB SIZE STRINGS
335.for BINUTIL in ${XBINUTILS}
336.if defined(CROSS_BINUTILS_PREFIX)
337X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${${BINUTIL}}
338.else
339X${BINUTIL}?= ${${BINUTIL}}
340.endif
341.endfor
342WMAKEENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCFLAGS} ${XCXXFLAGS}" \
343 DEPFLAGS="${DEPFLAGS}" \
344 CPP="${XCPP} ${XCFLAGS}" \
345 AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \
346 OBJDUMP=${XOBJDUMP} OBJCOPY="${XOBJCOPY}" \
347 RANLIB=${XRANLIB} STRINGS=${XSTRINGS} \
348 SIZE="${XSIZE}"
349
350.if ${XCC:M/*}
351XFLAGS= --sysroot=${WORLDTMP}
352.if defined(CROSS_BINUTILS_PREFIX)
353# In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a
354# directory, but the compiler will look in the right place for it's
355# tools so we don't need to tell it where to look.
356.if exists(${CROSS_BINUTILS_PREFIX})
357XFLAGS+= -B${CROSS_BINUTILS_PREFIX}
358.endif
359.else
360XFLAGS+= -B${WORLDTMP}/usr/bin
361.endif
362.if ${TARGET} == "arm"
363.if ${TARGET_ARCH:M*hf*} != ""
364TARGET_ABI= gnueabihf
365.else
366TARGET_ABI= gnueabi
367.endif
368.endif
369.if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc
370XCFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib
371XCXXFLAGS+= -I${WORLDTMP}/usr/include/c++/v1 -std=gnu++11 -L${WORLDTMP}/../lib/libc++
372DEPFLAGS+= -I${WORLDTMP}/usr/include/c++/v1
373.else
374TARGET_ABI?= unknown
375TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
376XCFLAGS+= -target ${TARGET_TRIPLE}
377.endif
378.endif
379
380WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP}
381
382.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
383# 32 bit world
384LIB32_OBJTREE= ${OBJTREE}${.CURDIR}/world32
385LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
386
387.if ${TARGET_ARCH} == "amd64"
388.if empty(TARGET_CPUTYPE)
389LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
390.else
391LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
392.endif
393LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \
394 MACHINE_CPU="i686 mmx sse sse2"
395LIB32WMAKEFLAGS= \
396 AS="${AS} --32" \
397 LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32"
398
399.elif ${TARGET_ARCH} == "powerpc64"
400.if empty(TARGET_CPUTYPE)
401LIB32CPUFLAGS= -mcpu=powerpc
402.else
403LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
404.endif
405LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc
406LIB32WMAKEFLAGS= \
407 LD="${LD} -m elf32ppc_fbsd"
408.endif
409
410
411LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \
412 -isystem ${LIB32TMP}/usr/include/ \
413 -L${LIB32TMP}/usr/lib32 \
414 -B${LIB32TMP}/usr/lib32
415.if ${XCC:M/*}
416LIB32FLAGS+= --sysroot=${WORLDTMP}
417.endif
418
419# Yes, the flags are redundant.
420LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${LIB32_OBJTREE} \
421 _SHLIBDIRPREFIX=${LIB32TMP} \
422 _LDSCRIPTROOT=${LIB32TMP} \
423 VERSION="${VERSION}" \
424 INSTALL="sh ${.CURDIR}/tools/install.sh" \
425 PATH=${TMPPATH} \
426 LIBDIR=/usr/lib32 \
427 SHLIBDIR=/usr/lib32 \
428 LIBPRIVATEDIR=/usr/lib32/private \
429 DTRACE="${DTRACE} -32"
430LIB32WMAKEFLAGS+= CC="${XCC} ${LIB32FLAGS}" \
431 CXX="${XCXX} ${LIB32FLAGS}" \
432 DESTDIR=${LIB32TMP} \
433 -DCOMPAT_32BIT \
434 -DLIBRARIES_ONLY \
435 -DNO_CPU_CFLAGS \
436 MK_CTF=no \
437 -DNO_LINT \
438 MK_TESTS=no
439
440LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \
441 MK_MAN=no MK_INFO=no MK_HTML=no
441 MK_MAN=no MK_HTML=no
442LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} \
443 MK_TOOLCHAIN=no ${IMAKE_INSTALL}
444.endif
445
446IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*}
447IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \
448 ${IMAKE_INSTALL} ${IMAKE_MTREE}
449.if empty(.MAKEFLAGS:M-n)
450IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \
451 LD_LIBRARY_PATH=${INSTALLTMP} \
452 PATH_LOCALE=${INSTALLTMP}/locale
453IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh
454.else
455IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
456.endif
457.if defined(DB_FROM_SRC)
458INSTALLFLAGS+= -N ${.CURDIR}/etc
459MTREEFLAGS+= -N ${.CURDIR}/etc
460.endif
461_INSTALL_DDIR= ${DESTDIR}/${DISTDIR}
462INSTALL_DDIR= ${_INSTALL_DDIR:S://:/:g:C:/$::}
463.if defined(NO_ROOT)
464METALOG?= ${DESTDIR}/${DISTDIR}/METALOG
465IMAKE+= -DNO_ROOT METALOG=${METALOG}
466INSTALLFLAGS+= -U -M ${METALOG} -D ${INSTALL_DDIR}
467MTREEFLAGS+= -W
468.endif
469.if defined(DB_FROM_SRC) || defined(NO_ROOT)
470IMAKE_INSTALL= INSTALL="install ${INSTALLFLAGS}"
471IMAKE_MTREE= MTREE_CMD="mtree ${MTREEFLAGS}"
472.endif
473
474# kernel stage
475KMAKEENV= ${WMAKEENV}
476KMAKE= ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME}
477
478#
479# buildworld
480#
481# Attempt to rebuild the entire system, with reasonable chance of
482# success, regardless of how old your existing system is.
483#
484_worldtmp:
485.if ${.CURDIR:C/[^,]//g} != ""
486# The m4 build of sendmail files doesn't like it if ',' is used
487# anywhere in the path of it's files.
488 @echo
489 @echo "*** Error: path to source tree contains a comma ','"
490 @echo
491 false
492.endif
493 @echo
494 @echo "--------------------------------------------------------------"
495 @echo ">>> Rebuilding the temporary build tree"
496 @echo "--------------------------------------------------------------"
497.if !defined(NO_CLEAN)
498 rm -rf ${WORLDTMP}
499.if defined(LIB32TMP)
500 rm -rf ${LIB32TMP}
501.endif
502.else
503 rm -rf ${WORLDTMP}/legacy/usr/include
504# XXX - These three can depend on any header file.
505 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
506 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c
507 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
508.endif
509.for _dir in \
510 lib usr legacy/bin legacy/usr
511 mkdir -p ${WORLDTMP}/${_dir}
512.endfor
513 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
514 -p ${WORLDTMP}/legacy/usr >/dev/null
515.if ${MK_GROFF} != "no"
516 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \
517 -p ${WORLDTMP}/legacy/usr >/dev/null
518.endif
519 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
520 -p ${WORLDTMP}/usr >/dev/null
521 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
522 -p ${WORLDTMP}/usr/include >/dev/null
523 ln -sf ${.CURDIR}/sys ${WORLDTMP}
524.if ${MK_DEBUG_FILES} != "no"
525 # We could instead disable debug files for these build stages
526 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
527 -p ${WORLDTMP}/legacy/usr/lib >/dev/null
528 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
529 -p ${WORLDTMP}/usr/lib >/dev/null
530.endif
531.if ${MK_TESTS} != "no"
532 mkdir -p ${WORLDTMP}${TESTSBASE}
533 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
534 -p ${WORLDTMP}${TESTSBASE} >/dev/null
535.endif
536.for _mtree in ${LOCAL_MTREE}
537 mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null
538.endfor
539_legacy:
540 @echo
541 @echo "--------------------------------------------------------------"
542 @echo ">>> stage 1.1: legacy release compatibility shims"
543 @echo "--------------------------------------------------------------"
544 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
545_bootstrap-tools:
546 @echo
547 @echo "--------------------------------------------------------------"
548 @echo ">>> stage 1.2: bootstrap tools"
549 @echo "--------------------------------------------------------------"
550 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
551_cleanobj:
552.if !defined(NO_CLEAN)
553 @echo
554 @echo "--------------------------------------------------------------"
555 @echo ">>> stage 2.1: cleaning up the object tree"
556 @echo "--------------------------------------------------------------"
557 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
558.if defined(LIB32TMP)
559 ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
560.endif
561.endif
562_obj:
563 @echo
564 @echo "--------------------------------------------------------------"
565 @echo ">>> stage 2.2: rebuilding the object tree"
566 @echo "--------------------------------------------------------------"
567 ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj
568_build-tools:
569 @echo
570 @echo "--------------------------------------------------------------"
571 @echo ">>> stage 2.3: build tools"
572 @echo "--------------------------------------------------------------"
573 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
574_cross-tools:
575 @echo
576 @echo "--------------------------------------------------------------"
577 @echo ">>> stage 3: cross tools"
578 @echo "--------------------------------------------------------------"
579 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
580 ${_+_}cd ${.CURDIR}; ${XMAKE} kernel-tools
581_includes:
582 @echo
583 @echo "--------------------------------------------------------------"
584 @echo ">>> stage 4.1: building includes"
585 @echo "--------------------------------------------------------------"
586 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
587_libraries:
588 @echo
589 @echo "--------------------------------------------------------------"
590 @echo ">>> stage 4.2: building libraries"
591 @echo "--------------------------------------------------------------"
592 ${_+_}cd ${.CURDIR}; \
442LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} \
443 MK_TOOLCHAIN=no ${IMAKE_INSTALL}
444.endif
445
446IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*}
447IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \
448 ${IMAKE_INSTALL} ${IMAKE_MTREE}
449.if empty(.MAKEFLAGS:M-n)
450IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \
451 LD_LIBRARY_PATH=${INSTALLTMP} \
452 PATH_LOCALE=${INSTALLTMP}/locale
453IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh
454.else
455IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
456.endif
457.if defined(DB_FROM_SRC)
458INSTALLFLAGS+= -N ${.CURDIR}/etc
459MTREEFLAGS+= -N ${.CURDIR}/etc
460.endif
461_INSTALL_DDIR= ${DESTDIR}/${DISTDIR}
462INSTALL_DDIR= ${_INSTALL_DDIR:S://:/:g:C:/$::}
463.if defined(NO_ROOT)
464METALOG?= ${DESTDIR}/${DISTDIR}/METALOG
465IMAKE+= -DNO_ROOT METALOG=${METALOG}
466INSTALLFLAGS+= -U -M ${METALOG} -D ${INSTALL_DDIR}
467MTREEFLAGS+= -W
468.endif
469.if defined(DB_FROM_SRC) || defined(NO_ROOT)
470IMAKE_INSTALL= INSTALL="install ${INSTALLFLAGS}"
471IMAKE_MTREE= MTREE_CMD="mtree ${MTREEFLAGS}"
472.endif
473
474# kernel stage
475KMAKEENV= ${WMAKEENV}
476KMAKE= ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME}
477
478#
479# buildworld
480#
481# Attempt to rebuild the entire system, with reasonable chance of
482# success, regardless of how old your existing system is.
483#
484_worldtmp:
485.if ${.CURDIR:C/[^,]//g} != ""
486# The m4 build of sendmail files doesn't like it if ',' is used
487# anywhere in the path of it's files.
488 @echo
489 @echo "*** Error: path to source tree contains a comma ','"
490 @echo
491 false
492.endif
493 @echo
494 @echo "--------------------------------------------------------------"
495 @echo ">>> Rebuilding the temporary build tree"
496 @echo "--------------------------------------------------------------"
497.if !defined(NO_CLEAN)
498 rm -rf ${WORLDTMP}
499.if defined(LIB32TMP)
500 rm -rf ${LIB32TMP}
501.endif
502.else
503 rm -rf ${WORLDTMP}/legacy/usr/include
504# XXX - These three can depend on any header file.
505 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
506 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c
507 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
508.endif
509.for _dir in \
510 lib usr legacy/bin legacy/usr
511 mkdir -p ${WORLDTMP}/${_dir}
512.endfor
513 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
514 -p ${WORLDTMP}/legacy/usr >/dev/null
515.if ${MK_GROFF} != "no"
516 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \
517 -p ${WORLDTMP}/legacy/usr >/dev/null
518.endif
519 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
520 -p ${WORLDTMP}/usr >/dev/null
521 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
522 -p ${WORLDTMP}/usr/include >/dev/null
523 ln -sf ${.CURDIR}/sys ${WORLDTMP}
524.if ${MK_DEBUG_FILES} != "no"
525 # We could instead disable debug files for these build stages
526 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
527 -p ${WORLDTMP}/legacy/usr/lib >/dev/null
528 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
529 -p ${WORLDTMP}/usr/lib >/dev/null
530.endif
531.if ${MK_TESTS} != "no"
532 mkdir -p ${WORLDTMP}${TESTSBASE}
533 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
534 -p ${WORLDTMP}${TESTSBASE} >/dev/null
535.endif
536.for _mtree in ${LOCAL_MTREE}
537 mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null
538.endfor
539_legacy:
540 @echo
541 @echo "--------------------------------------------------------------"
542 @echo ">>> stage 1.1: legacy release compatibility shims"
543 @echo "--------------------------------------------------------------"
544 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
545_bootstrap-tools:
546 @echo
547 @echo "--------------------------------------------------------------"
548 @echo ">>> stage 1.2: bootstrap tools"
549 @echo "--------------------------------------------------------------"
550 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
551_cleanobj:
552.if !defined(NO_CLEAN)
553 @echo
554 @echo "--------------------------------------------------------------"
555 @echo ">>> stage 2.1: cleaning up the object tree"
556 @echo "--------------------------------------------------------------"
557 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
558.if defined(LIB32TMP)
559 ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
560.endif
561.endif
562_obj:
563 @echo
564 @echo "--------------------------------------------------------------"
565 @echo ">>> stage 2.2: rebuilding the object tree"
566 @echo "--------------------------------------------------------------"
567 ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj
568_build-tools:
569 @echo
570 @echo "--------------------------------------------------------------"
571 @echo ">>> stage 2.3: build tools"
572 @echo "--------------------------------------------------------------"
573 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
574_cross-tools:
575 @echo
576 @echo "--------------------------------------------------------------"
577 @echo ">>> stage 3: cross tools"
578 @echo "--------------------------------------------------------------"
579 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
580 ${_+_}cd ${.CURDIR}; ${XMAKE} kernel-tools
581_includes:
582 @echo
583 @echo "--------------------------------------------------------------"
584 @echo ">>> stage 4.1: building includes"
585 @echo "--------------------------------------------------------------"
586 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
587_libraries:
588 @echo
589 @echo "--------------------------------------------------------------"
590 @echo ">>> stage 4.2: building libraries"
591 @echo "--------------------------------------------------------------"
592 ${_+_}cd ${.CURDIR}; \
593 ${WMAKE} -DNO_FSCHG MK_HTML=no MK_INFO=no -DNO_LINT MK_MAN=no \
593 ${WMAKE} -DNO_FSCHG MK_HTML=no -DNO_LINT MK_MAN=no \
594 MK_PROFILE=no MK_TESTS=no MK_TESTS_SUPPORT=${MK_TESTS} libraries
595_depend:
596 @echo
597 @echo "--------------------------------------------------------------"
598 @echo ">>> stage 4.3: make dependencies"
599 @echo "--------------------------------------------------------------"
600 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend
601everything:
602 @echo
603 @echo "--------------------------------------------------------------"
604 @echo ">>> stage 4.4: building everything"
605 @echo "--------------------------------------------------------------"
606 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
607.if defined(LIB32TMP)
608build32:
609 @echo
610 @echo "--------------------------------------------------------------"
611 @echo ">>> stage 5.1: building 32 bit shim libraries"
612 @echo "--------------------------------------------------------------"
613 mkdir -p ${LIB32TMP}/usr/include
614 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
615 -p ${LIB32TMP}/usr >/dev/null
616 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
617 -p ${LIB32TMP}/usr/include >/dev/null
618.if ${MK_DEBUG_FILES} != "no"
619 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
620 -p ${LIB32TMP}/usr/lib >/dev/null
621.endif
622 mkdir -p ${WORLDTMP}
623 ln -sf ${.CURDIR}/sys ${WORLDTMP}
624.for _t in obj includes
625 cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t}
626 cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t}
627.if ${MK_CDDL} != "no"
628 cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t}
629.endif
630 cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t}
631.if ${MK_CRYPT} != "no"
632 cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t}
633.endif
634.if ${MK_KERBEROS} != "no"
635 cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t}
636.endif
637.endfor
638.for _dir in usr.bin/lex/lib
639 cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj
640.endfor
641.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
642 cd ${.CURDIR}/${_dir}; \
643 WORLDTMP=${WORLDTMP} \
644 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
645 MAKEOBJDIRPREFIX=${LIB32_OBJTREE} ${MAKE} SSP_CFLAGS= DESTDIR= \
646 DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
647 build-tools
648.endfor
649 cd ${.CURDIR}; \
650 ${LIB32WMAKE} -f Makefile.inc1 libraries
651.for _t in obj depend all
652 cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \
653 DIRPRFX=libexec/rtld-elf/ ${_t}
654 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \
655 DIRPRFX=usr.bin/ldd ${_t}
656.endfor
657
658distribute32 install32:
659 cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
660.if ${MK_CDDL} != "no"
661 cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
662.endif
663 cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
664.if ${MK_CRYPT} != "no"
665 cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
666.endif
667.if ${MK_KERBEROS} != "no"
668 cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
669.endif
670 cd ${.CURDIR}/libexec/rtld-elf; \
671 PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
672 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//}
673.endif
674
675WMAKE_TGTS=
676.if !defined(SUBDIR_OVERRIDE)
677WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
678.endif
679WMAKE_TGTS+= _cleanobj _obj _build-tools
680.if !defined(SUBDIR_OVERRIDE)
681WMAKE_TGTS+= _cross-tools
682.endif
683WMAKE_TGTS+= _includes _libraries _depend everything
684.if defined(LIB32TMP) && ${MK_LIB32} != "no"
685WMAKE_TGTS+= build32
686.endif
687
688buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
689.ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
690
691buildworld_prologue:
692 @echo "--------------------------------------------------------------"
693 @echo ">>> World build started on `LC_ALL=C date`"
694 @echo "--------------------------------------------------------------"
695
696buildworld_epilogue:
697 @echo
698 @echo "--------------------------------------------------------------"
699 @echo ">>> World build completed on `LC_ALL=C date`"
700 @echo "--------------------------------------------------------------"
701
702#
703# We need to have this as a target because the indirection between Makefile
704# and Makefile.inc1 causes the correct PATH to be used, rather than a
705# modification of the current environment's PATH. In addition, we need
706# to quote multiword values.
707#
708buildenvvars:
709 @echo ${WMAKEENV:Q}
710
711.if ${.TARGETS:Mbuildenv}
712.if ${.MAKEFLAGS:M-j}
713.error The buildenv target is incompatible with -j
714.endif
715.endif
716buildenv:
717 @echo Entering world for ${TARGET_ARCH}:${TARGET}
718 @cd ${.CURDIR} && env ${WMAKEENV} ${BUILDENV_SHELL} || true
719
720TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32}
721toolchain: ${TOOLCHAIN_TGTS}
722kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
723
724#
725# installcheck
726#
727# Checks to be sure system is ready for installworld/installkernel.
728#
729installcheck: _installcheck_world _installcheck_kernel
730_installcheck_world:
731_installcheck_kernel:
732
733#
734# Require DESTDIR to be set if installing for a different architecture or
735# using the user/group database in the source tree.
736#
737.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \
738 defined(DB_FROM_SRC)
739.if !make(distributeworld)
740_installcheck_world: __installcheck_DESTDIR
741_installcheck_kernel: __installcheck_DESTDIR
742__installcheck_DESTDIR:
743.if !defined(DESTDIR) || empty(DESTDIR)
744 @echo "ERROR: Please set DESTDIR!"; \
745 false
746.endif
747.endif
748.endif
749
750.if !defined(DB_FROM_SRC)
751#
752# Check for missing UIDs/GIDs.
753#
754CHECK_UIDS= auditdistd
755CHECK_GIDS= audit
756.if ${MK_SENDMAIL} != "no"
757CHECK_UIDS+= smmsp
758CHECK_GIDS+= smmsp
759.endif
760.if ${MK_PF} != "no"
761CHECK_UIDS+= proxy
762CHECK_GIDS+= proxy authpf
763.endif
764.if ${MK_UNBOUND} != "no"
765CHECK_UIDS+= unbound
766CHECK_GIDS+= unbound
767.endif
768_installcheck_world: __installcheck_UGID
769__installcheck_UGID:
770.for uid in ${CHECK_UIDS}
771 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
772 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
773 false; \
774 fi
775.endfor
776.for gid in ${CHECK_GIDS}
777 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
778 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
779 false; \
780 fi
781.endfor
782.endif
783
784#
785# Required install tools to be saved in a scratch dir for safety.
786#
594 MK_PROFILE=no MK_TESTS=no MK_TESTS_SUPPORT=${MK_TESTS} libraries
595_depend:
596 @echo
597 @echo "--------------------------------------------------------------"
598 @echo ">>> stage 4.3: make dependencies"
599 @echo "--------------------------------------------------------------"
600 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend
601everything:
602 @echo
603 @echo "--------------------------------------------------------------"
604 @echo ">>> stage 4.4: building everything"
605 @echo "--------------------------------------------------------------"
606 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
607.if defined(LIB32TMP)
608build32:
609 @echo
610 @echo "--------------------------------------------------------------"
611 @echo ">>> stage 5.1: building 32 bit shim libraries"
612 @echo "--------------------------------------------------------------"
613 mkdir -p ${LIB32TMP}/usr/include
614 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
615 -p ${LIB32TMP}/usr >/dev/null
616 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
617 -p ${LIB32TMP}/usr/include >/dev/null
618.if ${MK_DEBUG_FILES} != "no"
619 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
620 -p ${LIB32TMP}/usr/lib >/dev/null
621.endif
622 mkdir -p ${WORLDTMP}
623 ln -sf ${.CURDIR}/sys ${WORLDTMP}
624.for _t in obj includes
625 cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t}
626 cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t}
627.if ${MK_CDDL} != "no"
628 cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t}
629.endif
630 cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t}
631.if ${MK_CRYPT} != "no"
632 cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t}
633.endif
634.if ${MK_KERBEROS} != "no"
635 cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t}
636.endif
637.endfor
638.for _dir in usr.bin/lex/lib
639 cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj
640.endfor
641.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
642 cd ${.CURDIR}/${_dir}; \
643 WORLDTMP=${WORLDTMP} \
644 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
645 MAKEOBJDIRPREFIX=${LIB32_OBJTREE} ${MAKE} SSP_CFLAGS= DESTDIR= \
646 DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
647 build-tools
648.endfor
649 cd ${.CURDIR}; \
650 ${LIB32WMAKE} -f Makefile.inc1 libraries
651.for _t in obj depend all
652 cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \
653 DIRPRFX=libexec/rtld-elf/ ${_t}
654 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \
655 DIRPRFX=usr.bin/ldd ${_t}
656.endfor
657
658distribute32 install32:
659 cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
660.if ${MK_CDDL} != "no"
661 cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
662.endif
663 cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
664.if ${MK_CRYPT} != "no"
665 cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
666.endif
667.if ${MK_KERBEROS} != "no"
668 cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
669.endif
670 cd ${.CURDIR}/libexec/rtld-elf; \
671 PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
672 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//}
673.endif
674
675WMAKE_TGTS=
676.if !defined(SUBDIR_OVERRIDE)
677WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
678.endif
679WMAKE_TGTS+= _cleanobj _obj _build-tools
680.if !defined(SUBDIR_OVERRIDE)
681WMAKE_TGTS+= _cross-tools
682.endif
683WMAKE_TGTS+= _includes _libraries _depend everything
684.if defined(LIB32TMP) && ${MK_LIB32} != "no"
685WMAKE_TGTS+= build32
686.endif
687
688buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
689.ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
690
691buildworld_prologue:
692 @echo "--------------------------------------------------------------"
693 @echo ">>> World build started on `LC_ALL=C date`"
694 @echo "--------------------------------------------------------------"
695
696buildworld_epilogue:
697 @echo
698 @echo "--------------------------------------------------------------"
699 @echo ">>> World build completed on `LC_ALL=C date`"
700 @echo "--------------------------------------------------------------"
701
702#
703# We need to have this as a target because the indirection between Makefile
704# and Makefile.inc1 causes the correct PATH to be used, rather than a
705# modification of the current environment's PATH. In addition, we need
706# to quote multiword values.
707#
708buildenvvars:
709 @echo ${WMAKEENV:Q}
710
711.if ${.TARGETS:Mbuildenv}
712.if ${.MAKEFLAGS:M-j}
713.error The buildenv target is incompatible with -j
714.endif
715.endif
716buildenv:
717 @echo Entering world for ${TARGET_ARCH}:${TARGET}
718 @cd ${.CURDIR} && env ${WMAKEENV} ${BUILDENV_SHELL} || true
719
720TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32}
721toolchain: ${TOOLCHAIN_TGTS}
722kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
723
724#
725# installcheck
726#
727# Checks to be sure system is ready for installworld/installkernel.
728#
729installcheck: _installcheck_world _installcheck_kernel
730_installcheck_world:
731_installcheck_kernel:
732
733#
734# Require DESTDIR to be set if installing for a different architecture or
735# using the user/group database in the source tree.
736#
737.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \
738 defined(DB_FROM_SRC)
739.if !make(distributeworld)
740_installcheck_world: __installcheck_DESTDIR
741_installcheck_kernel: __installcheck_DESTDIR
742__installcheck_DESTDIR:
743.if !defined(DESTDIR) || empty(DESTDIR)
744 @echo "ERROR: Please set DESTDIR!"; \
745 false
746.endif
747.endif
748.endif
749
750.if !defined(DB_FROM_SRC)
751#
752# Check for missing UIDs/GIDs.
753#
754CHECK_UIDS= auditdistd
755CHECK_GIDS= audit
756.if ${MK_SENDMAIL} != "no"
757CHECK_UIDS+= smmsp
758CHECK_GIDS+= smmsp
759.endif
760.if ${MK_PF} != "no"
761CHECK_UIDS+= proxy
762CHECK_GIDS+= proxy authpf
763.endif
764.if ${MK_UNBOUND} != "no"
765CHECK_UIDS+= unbound
766CHECK_GIDS+= unbound
767.endif
768_installcheck_world: __installcheck_UGID
769__installcheck_UGID:
770.for uid in ${CHECK_UIDS}
771 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
772 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
773 false; \
774 fi
775.endfor
776.for gid in ${CHECK_GIDS}
777 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
778 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
779 false; \
780 fi
781.endfor
782.endif
783
784#
785# Required install tools to be saved in a scratch dir for safety.
786#
787.if ${MK_INFO} != "no"
788_install-info= install-info
789.endif
790.if ${MK_ZONEINFO} != "no"
791_zoneinfo= zic tzsetup
792.endif
793
794ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
795 date echo egrep find grep id install ${_install-info} \
796 ln lockf make mkdir mtree mv pwd_mkdb \
797 rm sed services_mkdb sh strip sysctl test true uname wc ${_zoneinfo} \
798 ${LOCAL_ITOOLS}
799
800# Needed for share/man
801.if ${MK_MAN} != "no"
802ITOOLS+=makewhatis
803.endif
804
805#
806# distributeworld
807#
808# Distributes everything compiled by a `buildworld'.
809#
810# installworld
811#
812# Installs everything compiled by a 'buildworld'.
813#
814
815# Non-base distributions produced by the base system
816EXTRA_DISTRIBUTIONS= doc
817.if ${MK_GAMES} != "no"
818EXTRA_DISTRIBUTIONS+= games
819.endif
820.if defined(LIB32TMP) && ${MK_LIB32} != "no"
821EXTRA_DISTRIBUTIONS+= lib32
822.endif
823.if ${MK_TESTS} != "no"
824EXTRA_DISTRIBUTIONS+= tests
825.endif
826
827DEBUG_DISTRIBUTIONS=
828.if ${MK_DEBUG_FILES} != "no"
829DEBUG_DISTRIBUTIONS+= base ${EXTRA_DISTRIBUTIONS:S,doc,,}
830.endif
831
832MTREE_MAGIC?= mtree 2.0
833
834distributeworld installworld: _installcheck_world
835 mkdir -p ${INSTALLTMP}
836 progs=$$(for prog in ${ITOOLS}; do \
837 if progpath=`which $$prog`; then \
838 echo $$progpath; \
839 else \
840 echo "Required tool $$prog not found in PATH." >&2; \
841 exit 1; \
842 fi; \
843 done); \
844 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
845 while read line; do \
846 set -- $$line; \
847 if [ "$$2 $$3" != "not found" ]; then \
848 echo $$2; \
849 else \
850 echo "Required library $$1 not found." >&2; \
851 exit 1; \
852 fi; \
853 done); \
854 cp $$libs $$progs ${INSTALLTMP}
855 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
856.if defined(NO_ROOT)
857 echo "#${MTREE_MAGIC}" > ${METALOG}
858.endif
859.if make(distributeworld)
860.for dist in ${EXTRA_DISTRIBUTIONS}
861 -mkdir ${DESTDIR}/${DISTDIR}/${dist}
862 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
863 -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null
864 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
865 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
866 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
867 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
868.if ${MK_DEBUG_FILES} != "no"
869 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
870 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null
871.endif
872.if ${MK_TESTS} != "no" && ${dist} == "tests"
873 -mkdir -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE}
874 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
875 -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE} >/dev/null
876.endif
877.if defined(NO_ROOT)
878 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
879 sed -e 's#^\./#./${dist}/#' >> ${METALOG}
880 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \
881 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
882 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \
883 sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG}
884.endif
885.endfor
886 -mkdir ${DESTDIR}/${DISTDIR}/base
887 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
888 METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \
889 DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \
890 LOCAL_MTREE=${LOCAL_MTREE:Q} distrib-dirs
891.endif
892 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
893 ${IMAKEENV} rm -rf ${INSTALLTMP}
894.if make(distributeworld)
895.for dist in ${EXTRA_DISTRIBUTIONS}
896 find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -empty -delete
897.endfor
898.if defined(NO_ROOT)
899.for dist in base ${EXTRA_DISTRIBUTIONS}
900 @# For each file that exists in this dist, print the corresponding
901 @# line from the METALOG. This relies on the fact that
902 @# a line containing only the filename will sort immediatly before
903 @# the relevant mtree line.
904 cd ${DESTDIR}/${DISTDIR}; \
905 find ./${dist} | sort -u ${METALOG} - | \
906 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
907 ${DESTDIR}/${DISTDIR}/${dist}.meta
908.endfor
909.for dist in ${DEBUG_DISTRIBUTIONS}
910 @# For each file that exists in this dist, print the corresponding
911 @# line from the METALOG. This relies on the fact that
912 @# a line containing only the filename will sort immediatly before
913 @# the relevant mtree line.
914 cd ${DESTDIR}/${DISTDIR}; \
915 find ./${dist}/usr/lib/debug | sort -u ${METALOG} - | \
916 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
917 ${DESTDIR}/${DISTDIR}/${dist}.debug.meta
918.endfor
919.endif
920.endif
921
922packageworld:
923.for dist in base ${EXTRA_DISTRIBUTIONS}
924.if defined(NO_ROOT)
925 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
926 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \
927 --exclude usr/lib/debug \
928 @${DESTDIR}/${DISTDIR}/${dist}.meta
929.else
930 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
931 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \
932 --exclude usr/lib/debug .
933.endif
934.endfor
935
936.for dist in ${DEBUG_DISTRIBUTIONS}
937. if defined(NO_ROOT)
938 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
939 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz \
940 @${DESTDIR}/${DISTDIR}/${dist}.debug.meta
941. else
942 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
943 tar cvJfL ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz \
944 usr/lib/debug
945. endif
946.endfor
947
948#
949# reinstall
950#
951# If you have a build server, you can NFS mount the source and obj directories
952# and do a 'make reinstall' on the *client* to install new binaries from the
953# most recent server build.
954#
955reinstall: .MAKE
956 @echo "--------------------------------------------------------------"
957 @echo ">>> Making hierarchy"
958 @echo "--------------------------------------------------------------"
959 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \
960 LOCAL_MTREE=${LOCAL_MTREE:Q} hierarchy
961 @echo
962 @echo "--------------------------------------------------------------"
963 @echo ">>> Installing everything"
964 @echo "--------------------------------------------------------------"
965 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
966.if defined(LIB32TMP) && ${MK_LIB32} != "no"
967 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
968.endif
969
970redistribute: .MAKE
971 @echo "--------------------------------------------------------------"
972 @echo ">>> Distributing everything"
973 @echo "--------------------------------------------------------------"
974 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
975.if defined(LIB32TMP) && ${MK_LIB32} != "no"
976 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \
977 DISTRIBUTION=lib32
978.endif
979
980distrib-dirs distribution: .MAKE
981 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
982 ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET}
983
984#
985# buildkernel and installkernel
986#
987# Which kernels to build and/or install is specified by setting
988# KERNCONF. If not defined a GENERIC kernel is built/installed.
989# Only the existing (depending TARGET) config files are used
990# for building kernels and only the first of these is designated
991# as the one being installed.
992#
993# Note that we have to use TARGET instead of TARGET_ARCH when
994# we're in kernel-land. Since only TARGET_ARCH is (expected) to
995# be set to cross-build, we have to make sure TARGET is set
996# properly.
997
998.if defined(KERNFAST)
999NO_KERNELCLEAN= t
1000NO_KERNELCONFIG= t
1001NO_KERNELDEPEND= t
1002NO_KERNELOBJ= t
1003# Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
1004.if !defined(KERNCONF) && ${KERNFAST} != "1"
1005KERNCONF=${KERNFAST}
1006.endif
1007.endif
1008.if ${TARGET_ARCH} == "powerpc64"
1009KERNCONF?= GENERIC64
1010.else
1011KERNCONF?= GENERIC
1012.endif
1013INSTKERNNAME?= kernel
1014
1015KERNSRCDIR?= ${.CURDIR}/sys
1016KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
1017KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
1018KERNCONFDIR?= ${KRNLCONFDIR}
1019
1020BUILDKERNELS=
1021INSTALLKERNEL=
1022.for _kernel in ${KERNCONF}
1023.if exists(${KERNCONFDIR}/${_kernel})
1024BUILDKERNELS+= ${_kernel}
1025.if empty(INSTALLKERNEL)
1026INSTALLKERNEL= ${_kernel}
1027.endif
1028.endif
1029.endfor
1030
1031buildkernel ${WMAKE_TGTS} ${.ALLTARGETS:M_*}: .MAKE
1032
1033#
1034# buildkernel
1035#
1036# Builds all kernels defined by BUILDKERNELS.
1037#
1038buildkernel:
1039.if empty(BUILDKERNELS)
1040 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
1041 false
1042.endif
1043 @echo
1044.for _kernel in ${BUILDKERNELS}
1045 @echo "--------------------------------------------------------------"
1046 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
1047 @echo "--------------------------------------------------------------"
1048 @echo "===> ${_kernel}"
1049 mkdir -p ${KRNLOBJDIR}
1050.if !defined(NO_KERNELCONFIG)
1051 @echo
1052 @echo "--------------------------------------------------------------"
1053 @echo ">>> stage 1: configuring the kernel"
1054 @echo "--------------------------------------------------------------"
1055 cd ${KRNLCONFDIR}; \
1056 PATH=${TMPPATH} \
1057 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
1058 -I '${KERNCONFDIR}' '${KERNCONFDIR}/${_kernel}'
1059.endif
1060.if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
1061 @echo
1062 @echo "--------------------------------------------------------------"
1063 @echo ">>> stage 2.1: cleaning up the object tree"
1064 @echo "--------------------------------------------------------------"
1065 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
1066.endif
1067.if !defined(NO_KERNELOBJ)
1068 @echo
1069 @echo "--------------------------------------------------------------"
1070 @echo ">>> stage 2.2: rebuilding the object tree"
1071 @echo "--------------------------------------------------------------"
1072 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
1073.endif
1074 @echo
1075 @echo "--------------------------------------------------------------"
1076 @echo ">>> stage 2.3: build tools"
1077 @echo "--------------------------------------------------------------"
1078 ${_+_}cd ${.CURDIR}; ${KTMAKE} kernel-tools
1079.if !defined(NO_KERNELDEPEND)
1080 @echo
1081 @echo "--------------------------------------------------------------"
1082 @echo ">>> stage 3.1: making dependencies"
1083 @echo "--------------------------------------------------------------"
1084 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
1085.endif
1086 @echo
1087 @echo "--------------------------------------------------------------"
1088 @echo ">>> stage 3.2: building everything"
1089 @echo "--------------------------------------------------------------"
1090 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
1091 @echo "--------------------------------------------------------------"
1092 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
1093 @echo "--------------------------------------------------------------"
1094.endfor
1095
1096#
1097# installkernel, etc.
1098#
1099# Install the kernel defined by INSTALLKERNEL
1100#
1101installkernel installkernel.debug \
1102reinstallkernel reinstallkernel.debug: _installcheck_kernel
1103.if empty(INSTALLKERNEL)
1104 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1105 false
1106.endif
1107 @echo "--------------------------------------------------------------"
1108 @echo ">>> Installing kernel ${INSTALLKERNEL}"
1109 @echo "--------------------------------------------------------------"
1110 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
1111 ${CROSSENV} PATH=${TMPPATH} \
1112 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
1113
1114distributekernel distributekernel.debug:
1115.if empty(INSTALLKERNEL)
1116 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1117 false
1118.endif
1119 mkdir -p ${DESTDIR}/${DISTDIR}
1120.if defined(NO_ROOT)
1121 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.premeta
1122.endif
1123 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
1124 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.premeta/} \
1125 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \
1126 DESTDIR=${INSTALL_DDIR}/kernel \
1127 ${.TARGET:S/distributekernel/install/}
1128.if defined(NO_ROOT)
1129 sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta > \
1130 ${DESTDIR}/${DISTDIR}/kernel.meta
1131.endif
1132.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1133.if defined(NO_ROOT)
1134 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta
1135.endif
1136 cd ${KRNLOBJDIR}/${_kernel}; \
1137 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.${_kernel}.premeta/} \
1138 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} \
1139 KERNEL=${INSTKERNNAME}.${_kernel} \
1140 DESTDIR=${INSTALL_DDIR}/kernel.${_kernel} \
1141 ${.TARGET:S/distributekernel/install/}
1142.if defined(NO_ROOT)
1143 sed -e 's|^./kernel|.|' \
1144 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta > \
1145 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
1146.endif
1147.endfor
1148
1149packagekernel:
1150.if defined(NO_ROOT)
1151 cd ${DESTDIR}/${DISTDIR}/kernel; \
1152 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz \
1153 @${DESTDIR}/${DISTDIR}/kernel.meta
1154.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1155 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1156 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz \
1157 @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
1158.endfor
1159.else
1160 cd ${DESTDIR}/${DISTDIR}/kernel; \
1161 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz .
1162.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1163 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1164 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz .
1165.endfor
1166.endif
1167
1168#
1169# doxygen
1170#
1171# Build the API documentation with doxygen
1172#
1173doxygen:
1174 @if [ ! -x `/usr/bin/which doxygen` ]; then \
1175 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
1176 exit 1; \
1177 fi
1178 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all
1179
1180#
1181# update
1182#
1183# Update the source tree(s), by running svn/svnup to update to the
1184# latest copy.
1185#
1186update:
1187.if (defined(CVS_UPDATE) || defined(SUP_UPDATE)) && !defined(SVN_UPDATE)
1188 @echo "--------------------------------------------------------------"
1189 @echo "CVS_UPDATE and SUP_UPDATE are no longer supported."
1190 @echo "Please see: https://wiki.freebsd.org/CvsIsDeprecated"
1191 @echo "--------------------------------------------------------------"
1192 @exit 1
1193.endif
1194.if defined(SVN_UPDATE)
1195 @echo "--------------------------------------------------------------"
1196 @echo ">>> Updating ${.CURDIR} using Subversion"
1197 @echo "--------------------------------------------------------------"
1198 @(cd ${.CURDIR} && ${SVN} update ${SVNFLAGS})
1199.endif
1200
1201#
1202# ------------------------------------------------------------------------
1203#
1204# From here onwards are utility targets used by the 'make world' and
1205# related targets. If your 'world' breaks, you may like to try to fix
1206# the problem and manually run the following targets to attempt to
1207# complete the build. Beware, this is *not* guaranteed to work, you
1208# need to have a pretty good grip on the current state of the system
1209# to attempt to manually finish it. If in doubt, 'make world' again.
1210#
1211
1212#
1213# legacy: Build compatibility shims for the next three targets
1214#
1215legacy:
1216.if ${BOOTSTRAPPING} < 800107 && ${BOOTSTRAPPING} != 0
1217 @echo "ERROR: Source upgrades from versions prior to 8.0 not supported."; \
1218 false
1219.endif
1220.for _tool in tools/build
1221 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
1222 cd ${.CURDIR}/${_tool} && \
1223 ${MAKE} DIRPRFX=${_tool}/ obj && \
1224 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes && \
1225 ${MAKE} DIRPRFX=${_tool}/ depend && \
1226 ${MAKE} DIRPRFX=${_tool}/ all && \
1227 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1228.endfor
1229
1230#
1231# bootstrap-tools: Build tools needed for compatibility
1232#
1233.if ${MK_GAMES} != "no"
1234_strfile= games/fortune/strfile
1235.endif
1236
1237.if ${MK_CXX} != "no"
1238_gperf= gnu/usr.bin/gperf
1239.endif
1240
1241.if ${MK_GROFF} != "no"
1242_groff= gnu/usr.bin/groff
1243.endif
1244
1245.if ${MK_VT} != "no"
1246_vtfontcvt= usr.bin/vtfontcvt
1247.endif
1248
1249.if ${BOOTSTRAPPING} < 900002
1250_sed= usr.bin/sed
1251.endif
1252
1253.if ${BOOTSTRAPPING} < 1000002
1254_m4= lib/libohash \
1255 usr.bin/m4
1256.endif
1257
1258.if ${BOOTSTRAPPING} < 1000013
1259_yacc= lib/liby \
1260 usr.bin/yacc
1261.endif
1262
1263.if ${BOOTSTRAPPING} < 1000014
1264_crunch= usr.sbin/crunch
1265.endif
1266
1267.if ${BOOTSTRAPPING} < 1000026
1268_nmtree= lib/libnetbsd \
1269 usr.sbin/nmtree
1270.endif
1271
1272.if ${BOOTSTRAPPING} < 1000027
1273_cat= bin/cat
1274.endif
1275
1276.if ${BOOTSTRAPPING} < 1000033
1277_lex= usr.bin/lex
1278.endif
1279
1280.if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041
1281_awk= usr.bin/awk
1282.endif
1283
1284.if ${MK_BSNMP} != "no"
1285_gensnmptree= usr.sbin/bsnmpd/gensnmptree
1286.endif
1287
1288# We need to build tblgen when we're building clang either as
1289# the bootstrap compiler, or as the part of the normal build.
1290.if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no"
1291_clang_tblgen= \
1292 lib/clang/libllvmsupport \
1293 lib/clang/libllvmtablegen \
1294 usr.bin/clang/tblgen \
1295 usr.bin/clang/clang-tblgen
1296.endif
1297
1298# dtrace tools are required for older bootstrap env and cross-build
1299# pre libdwarf
1300.if ${MK_CDDL} != "no" && (${BOOTSTRAPPING} < 1100006 \
1301 || (${MACHINE} != ${TARGET} || ${MACHINE_ARCH} != ${TARGET_ARCH}))
1302_dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
1303 lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
1304.endif
1305
1306# Default to building the GPL DTC, but build the BSDL one if users explicitly
1307# request it.
1308_dtc= usr.bin/dtc
1309.if ${MK_GPL_DTC} != "no"
1310_dtc= gnu/usr.bin/dtc
1311.endif
1312
1313.if ${MK_KERBEROS} != "no"
1314_kerberos5_bootstrap_tools= \
1315 kerberos5/tools/make-roken \
1316 kerberos5/lib/libroken \
1317 kerberos5/lib/libvers \
1318 kerberos5/tools/asn1_compile \
1319 kerberos5/tools/slc \
1320 usr.bin/compile_et
1321.endif
1322
1323# Please document (add comment) why something is in 'bootstrap-tools'.
1324# Try to bound the building of the bootstrap-tool to just the
1325# FreeBSD versions that need the tool built at this stage of the build.
1326bootstrap-tools: .MAKE
1327.for _tool in \
1328 ${_clang_tblgen} \
1329 ${_kerberos5_bootstrap_tools} \
1330 ${_dtrace_tools} \
1331 ${_strfile} \
1332 ${_gperf} \
1333 ${_groff} \
1334 ${_dtc} \
1335 ${_awk} \
1336 ${_cat} \
1337 usr.bin/lorder \
1338 usr.bin/makewhatis \
1339 usr.bin/rpcgen \
1340 ${_sed} \
1341 ${_yacc} \
1342 ${_m4} \
1343 ${_lex} \
1344 lib/libmd \
1345 usr.bin/xinstall \
1346 ${_gensnmptree} \
1347 usr.sbin/config \
1348 ${_crunch} \
1349 ${_nmtree} \
1350 ${_vtfontcvt}
1351 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1352 cd ${.CURDIR}/${_tool} && \
1353 ${MAKE} DIRPRFX=${_tool}/ obj && \
1354 ${MAKE} DIRPRFX=${_tool}/ depend && \
1355 ${MAKE} DIRPRFX=${_tool}/ all && \
1356 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1357.endfor
1358
1359#
1360# build-tools: Build special purpose build tools
1361#
1362.if !defined(NO_SHARE)
1363_share= share/syscons/scrnmaps
1364.endif
1365
1366.if ${MK_GCC} != "no"
1367_gcc_tools= gnu/usr.bin/cc/cc_tools
1368.endif
1369
787.if ${MK_ZONEINFO} != "no"
788_zoneinfo= zic tzsetup
789.endif
790
791ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
792 date echo egrep find grep id install ${_install-info} \
793 ln lockf make mkdir mtree mv pwd_mkdb \
794 rm sed services_mkdb sh strip sysctl test true uname wc ${_zoneinfo} \
795 ${LOCAL_ITOOLS}
796
797# Needed for share/man
798.if ${MK_MAN} != "no"
799ITOOLS+=makewhatis
800.endif
801
802#
803# distributeworld
804#
805# Distributes everything compiled by a `buildworld'.
806#
807# installworld
808#
809# Installs everything compiled by a 'buildworld'.
810#
811
812# Non-base distributions produced by the base system
813EXTRA_DISTRIBUTIONS= doc
814.if ${MK_GAMES} != "no"
815EXTRA_DISTRIBUTIONS+= games
816.endif
817.if defined(LIB32TMP) && ${MK_LIB32} != "no"
818EXTRA_DISTRIBUTIONS+= lib32
819.endif
820.if ${MK_TESTS} != "no"
821EXTRA_DISTRIBUTIONS+= tests
822.endif
823
824DEBUG_DISTRIBUTIONS=
825.if ${MK_DEBUG_FILES} != "no"
826DEBUG_DISTRIBUTIONS+= base ${EXTRA_DISTRIBUTIONS:S,doc,,}
827.endif
828
829MTREE_MAGIC?= mtree 2.0
830
831distributeworld installworld: _installcheck_world
832 mkdir -p ${INSTALLTMP}
833 progs=$$(for prog in ${ITOOLS}; do \
834 if progpath=`which $$prog`; then \
835 echo $$progpath; \
836 else \
837 echo "Required tool $$prog not found in PATH." >&2; \
838 exit 1; \
839 fi; \
840 done); \
841 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
842 while read line; do \
843 set -- $$line; \
844 if [ "$$2 $$3" != "not found" ]; then \
845 echo $$2; \
846 else \
847 echo "Required library $$1 not found." >&2; \
848 exit 1; \
849 fi; \
850 done); \
851 cp $$libs $$progs ${INSTALLTMP}
852 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
853.if defined(NO_ROOT)
854 echo "#${MTREE_MAGIC}" > ${METALOG}
855.endif
856.if make(distributeworld)
857.for dist in ${EXTRA_DISTRIBUTIONS}
858 -mkdir ${DESTDIR}/${DISTDIR}/${dist}
859 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
860 -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null
861 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
862 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
863 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
864 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
865.if ${MK_DEBUG_FILES} != "no"
866 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
867 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null
868.endif
869.if ${MK_TESTS} != "no" && ${dist} == "tests"
870 -mkdir -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE}
871 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
872 -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE} >/dev/null
873.endif
874.if defined(NO_ROOT)
875 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
876 sed -e 's#^\./#./${dist}/#' >> ${METALOG}
877 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \
878 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
879 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \
880 sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG}
881.endif
882.endfor
883 -mkdir ${DESTDIR}/${DISTDIR}/base
884 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
885 METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \
886 DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \
887 LOCAL_MTREE=${LOCAL_MTREE:Q} distrib-dirs
888.endif
889 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
890 ${IMAKEENV} rm -rf ${INSTALLTMP}
891.if make(distributeworld)
892.for dist in ${EXTRA_DISTRIBUTIONS}
893 find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -empty -delete
894.endfor
895.if defined(NO_ROOT)
896.for dist in base ${EXTRA_DISTRIBUTIONS}
897 @# For each file that exists in this dist, print the corresponding
898 @# line from the METALOG. This relies on the fact that
899 @# a line containing only the filename will sort immediatly before
900 @# the relevant mtree line.
901 cd ${DESTDIR}/${DISTDIR}; \
902 find ./${dist} | sort -u ${METALOG} - | \
903 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
904 ${DESTDIR}/${DISTDIR}/${dist}.meta
905.endfor
906.for dist in ${DEBUG_DISTRIBUTIONS}
907 @# For each file that exists in this dist, print the corresponding
908 @# line from the METALOG. This relies on the fact that
909 @# a line containing only the filename will sort immediatly before
910 @# the relevant mtree line.
911 cd ${DESTDIR}/${DISTDIR}; \
912 find ./${dist}/usr/lib/debug | sort -u ${METALOG} - | \
913 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
914 ${DESTDIR}/${DISTDIR}/${dist}.debug.meta
915.endfor
916.endif
917.endif
918
919packageworld:
920.for dist in base ${EXTRA_DISTRIBUTIONS}
921.if defined(NO_ROOT)
922 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
923 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \
924 --exclude usr/lib/debug \
925 @${DESTDIR}/${DISTDIR}/${dist}.meta
926.else
927 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
928 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \
929 --exclude usr/lib/debug .
930.endif
931.endfor
932
933.for dist in ${DEBUG_DISTRIBUTIONS}
934. if defined(NO_ROOT)
935 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
936 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz \
937 @${DESTDIR}/${DISTDIR}/${dist}.debug.meta
938. else
939 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
940 tar cvJfL ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz \
941 usr/lib/debug
942. endif
943.endfor
944
945#
946# reinstall
947#
948# If you have a build server, you can NFS mount the source and obj directories
949# and do a 'make reinstall' on the *client* to install new binaries from the
950# most recent server build.
951#
952reinstall: .MAKE
953 @echo "--------------------------------------------------------------"
954 @echo ">>> Making hierarchy"
955 @echo "--------------------------------------------------------------"
956 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \
957 LOCAL_MTREE=${LOCAL_MTREE:Q} hierarchy
958 @echo
959 @echo "--------------------------------------------------------------"
960 @echo ">>> Installing everything"
961 @echo "--------------------------------------------------------------"
962 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
963.if defined(LIB32TMP) && ${MK_LIB32} != "no"
964 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
965.endif
966
967redistribute: .MAKE
968 @echo "--------------------------------------------------------------"
969 @echo ">>> Distributing everything"
970 @echo "--------------------------------------------------------------"
971 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
972.if defined(LIB32TMP) && ${MK_LIB32} != "no"
973 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \
974 DISTRIBUTION=lib32
975.endif
976
977distrib-dirs distribution: .MAKE
978 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
979 ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET}
980
981#
982# buildkernel and installkernel
983#
984# Which kernels to build and/or install is specified by setting
985# KERNCONF. If not defined a GENERIC kernel is built/installed.
986# Only the existing (depending TARGET) config files are used
987# for building kernels and only the first of these is designated
988# as the one being installed.
989#
990# Note that we have to use TARGET instead of TARGET_ARCH when
991# we're in kernel-land. Since only TARGET_ARCH is (expected) to
992# be set to cross-build, we have to make sure TARGET is set
993# properly.
994
995.if defined(KERNFAST)
996NO_KERNELCLEAN= t
997NO_KERNELCONFIG= t
998NO_KERNELDEPEND= t
999NO_KERNELOBJ= t
1000# Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
1001.if !defined(KERNCONF) && ${KERNFAST} != "1"
1002KERNCONF=${KERNFAST}
1003.endif
1004.endif
1005.if ${TARGET_ARCH} == "powerpc64"
1006KERNCONF?= GENERIC64
1007.else
1008KERNCONF?= GENERIC
1009.endif
1010INSTKERNNAME?= kernel
1011
1012KERNSRCDIR?= ${.CURDIR}/sys
1013KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
1014KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
1015KERNCONFDIR?= ${KRNLCONFDIR}
1016
1017BUILDKERNELS=
1018INSTALLKERNEL=
1019.for _kernel in ${KERNCONF}
1020.if exists(${KERNCONFDIR}/${_kernel})
1021BUILDKERNELS+= ${_kernel}
1022.if empty(INSTALLKERNEL)
1023INSTALLKERNEL= ${_kernel}
1024.endif
1025.endif
1026.endfor
1027
1028buildkernel ${WMAKE_TGTS} ${.ALLTARGETS:M_*}: .MAKE
1029
1030#
1031# buildkernel
1032#
1033# Builds all kernels defined by BUILDKERNELS.
1034#
1035buildkernel:
1036.if empty(BUILDKERNELS)
1037 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
1038 false
1039.endif
1040 @echo
1041.for _kernel in ${BUILDKERNELS}
1042 @echo "--------------------------------------------------------------"
1043 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
1044 @echo "--------------------------------------------------------------"
1045 @echo "===> ${_kernel}"
1046 mkdir -p ${KRNLOBJDIR}
1047.if !defined(NO_KERNELCONFIG)
1048 @echo
1049 @echo "--------------------------------------------------------------"
1050 @echo ">>> stage 1: configuring the kernel"
1051 @echo "--------------------------------------------------------------"
1052 cd ${KRNLCONFDIR}; \
1053 PATH=${TMPPATH} \
1054 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
1055 -I '${KERNCONFDIR}' '${KERNCONFDIR}/${_kernel}'
1056.endif
1057.if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
1058 @echo
1059 @echo "--------------------------------------------------------------"
1060 @echo ">>> stage 2.1: cleaning up the object tree"
1061 @echo "--------------------------------------------------------------"
1062 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
1063.endif
1064.if !defined(NO_KERNELOBJ)
1065 @echo
1066 @echo "--------------------------------------------------------------"
1067 @echo ">>> stage 2.2: rebuilding the object tree"
1068 @echo "--------------------------------------------------------------"
1069 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
1070.endif
1071 @echo
1072 @echo "--------------------------------------------------------------"
1073 @echo ">>> stage 2.3: build tools"
1074 @echo "--------------------------------------------------------------"
1075 ${_+_}cd ${.CURDIR}; ${KTMAKE} kernel-tools
1076.if !defined(NO_KERNELDEPEND)
1077 @echo
1078 @echo "--------------------------------------------------------------"
1079 @echo ">>> stage 3.1: making dependencies"
1080 @echo "--------------------------------------------------------------"
1081 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
1082.endif
1083 @echo
1084 @echo "--------------------------------------------------------------"
1085 @echo ">>> stage 3.2: building everything"
1086 @echo "--------------------------------------------------------------"
1087 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
1088 @echo "--------------------------------------------------------------"
1089 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
1090 @echo "--------------------------------------------------------------"
1091.endfor
1092
1093#
1094# installkernel, etc.
1095#
1096# Install the kernel defined by INSTALLKERNEL
1097#
1098installkernel installkernel.debug \
1099reinstallkernel reinstallkernel.debug: _installcheck_kernel
1100.if empty(INSTALLKERNEL)
1101 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1102 false
1103.endif
1104 @echo "--------------------------------------------------------------"
1105 @echo ">>> Installing kernel ${INSTALLKERNEL}"
1106 @echo "--------------------------------------------------------------"
1107 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
1108 ${CROSSENV} PATH=${TMPPATH} \
1109 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
1110
1111distributekernel distributekernel.debug:
1112.if empty(INSTALLKERNEL)
1113 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1114 false
1115.endif
1116 mkdir -p ${DESTDIR}/${DISTDIR}
1117.if defined(NO_ROOT)
1118 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.premeta
1119.endif
1120 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
1121 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.premeta/} \
1122 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \
1123 DESTDIR=${INSTALL_DDIR}/kernel \
1124 ${.TARGET:S/distributekernel/install/}
1125.if defined(NO_ROOT)
1126 sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta > \
1127 ${DESTDIR}/${DISTDIR}/kernel.meta
1128.endif
1129.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1130.if defined(NO_ROOT)
1131 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta
1132.endif
1133 cd ${KRNLOBJDIR}/${_kernel}; \
1134 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.${_kernel}.premeta/} \
1135 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} \
1136 KERNEL=${INSTKERNNAME}.${_kernel} \
1137 DESTDIR=${INSTALL_DDIR}/kernel.${_kernel} \
1138 ${.TARGET:S/distributekernel/install/}
1139.if defined(NO_ROOT)
1140 sed -e 's|^./kernel|.|' \
1141 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta > \
1142 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
1143.endif
1144.endfor
1145
1146packagekernel:
1147.if defined(NO_ROOT)
1148 cd ${DESTDIR}/${DISTDIR}/kernel; \
1149 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz \
1150 @${DESTDIR}/${DISTDIR}/kernel.meta
1151.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1152 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1153 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz \
1154 @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
1155.endfor
1156.else
1157 cd ${DESTDIR}/${DISTDIR}/kernel; \
1158 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz .
1159.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1160 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1161 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz .
1162.endfor
1163.endif
1164
1165#
1166# doxygen
1167#
1168# Build the API documentation with doxygen
1169#
1170doxygen:
1171 @if [ ! -x `/usr/bin/which doxygen` ]; then \
1172 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
1173 exit 1; \
1174 fi
1175 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all
1176
1177#
1178# update
1179#
1180# Update the source tree(s), by running svn/svnup to update to the
1181# latest copy.
1182#
1183update:
1184.if (defined(CVS_UPDATE) || defined(SUP_UPDATE)) && !defined(SVN_UPDATE)
1185 @echo "--------------------------------------------------------------"
1186 @echo "CVS_UPDATE and SUP_UPDATE are no longer supported."
1187 @echo "Please see: https://wiki.freebsd.org/CvsIsDeprecated"
1188 @echo "--------------------------------------------------------------"
1189 @exit 1
1190.endif
1191.if defined(SVN_UPDATE)
1192 @echo "--------------------------------------------------------------"
1193 @echo ">>> Updating ${.CURDIR} using Subversion"
1194 @echo "--------------------------------------------------------------"
1195 @(cd ${.CURDIR} && ${SVN} update ${SVNFLAGS})
1196.endif
1197
1198#
1199# ------------------------------------------------------------------------
1200#
1201# From here onwards are utility targets used by the 'make world' and
1202# related targets. If your 'world' breaks, you may like to try to fix
1203# the problem and manually run the following targets to attempt to
1204# complete the build. Beware, this is *not* guaranteed to work, you
1205# need to have a pretty good grip on the current state of the system
1206# to attempt to manually finish it. If in doubt, 'make world' again.
1207#
1208
1209#
1210# legacy: Build compatibility shims for the next three targets
1211#
1212legacy:
1213.if ${BOOTSTRAPPING} < 800107 && ${BOOTSTRAPPING} != 0
1214 @echo "ERROR: Source upgrades from versions prior to 8.0 not supported."; \
1215 false
1216.endif
1217.for _tool in tools/build
1218 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
1219 cd ${.CURDIR}/${_tool} && \
1220 ${MAKE} DIRPRFX=${_tool}/ obj && \
1221 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes && \
1222 ${MAKE} DIRPRFX=${_tool}/ depend && \
1223 ${MAKE} DIRPRFX=${_tool}/ all && \
1224 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1225.endfor
1226
1227#
1228# bootstrap-tools: Build tools needed for compatibility
1229#
1230.if ${MK_GAMES} != "no"
1231_strfile= games/fortune/strfile
1232.endif
1233
1234.if ${MK_CXX} != "no"
1235_gperf= gnu/usr.bin/gperf
1236.endif
1237
1238.if ${MK_GROFF} != "no"
1239_groff= gnu/usr.bin/groff
1240.endif
1241
1242.if ${MK_VT} != "no"
1243_vtfontcvt= usr.bin/vtfontcvt
1244.endif
1245
1246.if ${BOOTSTRAPPING} < 900002
1247_sed= usr.bin/sed
1248.endif
1249
1250.if ${BOOTSTRAPPING} < 1000002
1251_m4= lib/libohash \
1252 usr.bin/m4
1253.endif
1254
1255.if ${BOOTSTRAPPING} < 1000013
1256_yacc= lib/liby \
1257 usr.bin/yacc
1258.endif
1259
1260.if ${BOOTSTRAPPING} < 1000014
1261_crunch= usr.sbin/crunch
1262.endif
1263
1264.if ${BOOTSTRAPPING} < 1000026
1265_nmtree= lib/libnetbsd \
1266 usr.sbin/nmtree
1267.endif
1268
1269.if ${BOOTSTRAPPING} < 1000027
1270_cat= bin/cat
1271.endif
1272
1273.if ${BOOTSTRAPPING} < 1000033
1274_lex= usr.bin/lex
1275.endif
1276
1277.if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041
1278_awk= usr.bin/awk
1279.endif
1280
1281.if ${MK_BSNMP} != "no"
1282_gensnmptree= usr.sbin/bsnmpd/gensnmptree
1283.endif
1284
1285# We need to build tblgen when we're building clang either as
1286# the bootstrap compiler, or as the part of the normal build.
1287.if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no"
1288_clang_tblgen= \
1289 lib/clang/libllvmsupport \
1290 lib/clang/libllvmtablegen \
1291 usr.bin/clang/tblgen \
1292 usr.bin/clang/clang-tblgen
1293.endif
1294
1295# dtrace tools are required for older bootstrap env and cross-build
1296# pre libdwarf
1297.if ${MK_CDDL} != "no" && (${BOOTSTRAPPING} < 1100006 \
1298 || (${MACHINE} != ${TARGET} || ${MACHINE_ARCH} != ${TARGET_ARCH}))
1299_dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
1300 lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
1301.endif
1302
1303# Default to building the GPL DTC, but build the BSDL one if users explicitly
1304# request it.
1305_dtc= usr.bin/dtc
1306.if ${MK_GPL_DTC} != "no"
1307_dtc= gnu/usr.bin/dtc
1308.endif
1309
1310.if ${MK_KERBEROS} != "no"
1311_kerberos5_bootstrap_tools= \
1312 kerberos5/tools/make-roken \
1313 kerberos5/lib/libroken \
1314 kerberos5/lib/libvers \
1315 kerberos5/tools/asn1_compile \
1316 kerberos5/tools/slc \
1317 usr.bin/compile_et
1318.endif
1319
1320# Please document (add comment) why something is in 'bootstrap-tools'.
1321# Try to bound the building of the bootstrap-tool to just the
1322# FreeBSD versions that need the tool built at this stage of the build.
1323bootstrap-tools: .MAKE
1324.for _tool in \
1325 ${_clang_tblgen} \
1326 ${_kerberos5_bootstrap_tools} \
1327 ${_dtrace_tools} \
1328 ${_strfile} \
1329 ${_gperf} \
1330 ${_groff} \
1331 ${_dtc} \
1332 ${_awk} \
1333 ${_cat} \
1334 usr.bin/lorder \
1335 usr.bin/makewhatis \
1336 usr.bin/rpcgen \
1337 ${_sed} \
1338 ${_yacc} \
1339 ${_m4} \
1340 ${_lex} \
1341 lib/libmd \
1342 usr.bin/xinstall \
1343 ${_gensnmptree} \
1344 usr.sbin/config \
1345 ${_crunch} \
1346 ${_nmtree} \
1347 ${_vtfontcvt}
1348 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1349 cd ${.CURDIR}/${_tool} && \
1350 ${MAKE} DIRPRFX=${_tool}/ obj && \
1351 ${MAKE} DIRPRFX=${_tool}/ depend && \
1352 ${MAKE} DIRPRFX=${_tool}/ all && \
1353 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1354.endfor
1355
1356#
1357# build-tools: Build special purpose build tools
1358#
1359.if !defined(NO_SHARE)
1360_share= share/syscons/scrnmaps
1361.endif
1362
1363.if ${MK_GCC} != "no"
1364_gcc_tools= gnu/usr.bin/cc/cc_tools
1365.endif
1366
1370.if ${MK_INFO} != "no"
1371_texinfo= gnu/usr.bin/texinfo/libtxi \
1372 gnu/usr.bin/texinfo/makeinfo
1373.endif
1374
1375.if ${MK_RESCUE} != "no"
1376_rescue= rescue/rescue
1377.endif
1378
1379build-tools: .MAKE
1380.for _tool in \
1381 bin/csh \
1382 bin/sh \
1383 ${_rescue} \
1384 ${LOCAL_TOOL_DIRS} \
1385 lib/ncurses/ncurses \
1386 lib/ncurses/ncursesw \
1387 ${_share} \
1388 usr.bin/awk \
1389 lib/libmagic \
1390 usr.bin/mkesdb_static \
1391 usr.bin/mkcsmapper_static \
1392 usr.bin/vi/catalog
1393 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
1394 cd ${.CURDIR}/${_tool} && \
1395 ${MAKE} DIRPRFX=${_tool}/ obj && \
1396 ${MAKE} DIRPRFX=${_tool}/ build-tools
1397.endfor
1398.for _tool in \
1399 ${_gcc_tools}
1400 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
1401 cd ${.CURDIR}/${_tool} && \
1402 ${MAKE} DIRPRFX=${_tool}/ obj && \
1403 ${MAKE} DIRPRFX=${_tool}/ depend && \
1404 ${MAKE} DIRPRFX=${_tool}/ all
1405.endfor
1367.if ${MK_RESCUE} != "no"
1368_rescue= rescue/rescue
1369.endif
1370
1371build-tools: .MAKE
1372.for _tool in \
1373 bin/csh \
1374 bin/sh \
1375 ${_rescue} \
1376 ${LOCAL_TOOL_DIRS} \
1377 lib/ncurses/ncurses \
1378 lib/ncurses/ncursesw \
1379 ${_share} \
1380 usr.bin/awk \
1381 lib/libmagic \
1382 usr.bin/mkesdb_static \
1383 usr.bin/mkcsmapper_static \
1384 usr.bin/vi/catalog
1385 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
1386 cd ${.CURDIR}/${_tool} && \
1387 ${MAKE} DIRPRFX=${_tool}/ obj && \
1388 ${MAKE} DIRPRFX=${_tool}/ build-tools
1389.endfor
1390.for _tool in \
1391 ${_gcc_tools}
1392 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
1393 cd ${.CURDIR}/${_tool} && \
1394 ${MAKE} DIRPRFX=${_tool}/ obj && \
1395 ${MAKE} DIRPRFX=${_tool}/ depend && \
1396 ${MAKE} DIRPRFX=${_tool}/ all
1397.endfor
1406.for _tool in \
1407 ${_texinfo}
1408 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1409 cd ${.CURDIR}/${_tool} && \
1410 ${MAKE} DIRPRFX=${_tool}/ obj && \
1411 ${MAKE} DIRPRFX=${_tool}/ depend && \
1412 ${MAKE} DIRPRFX=${_tool}/ all && \
1413 ${MAKE} DIRPRFX=${_tool}/ install DESTDIR=${WORLDTMP}
1414.endfor
1415
1398
1416
1417#
1418# kernel-tools: Build kernel-building tools
1419#
1420kernel-tools: .MAKE
1421 mkdir -p ${MAKEOBJDIRPREFIX}/usr
1422 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1423 -p ${MAKEOBJDIRPREFIX}/usr >/dev/null
1424
1425#
1426# cross-tools: Build cross-building tools
1427#
1428.if ${TARGET_ARCH} != ${MACHINE_ARCH}
1429.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
1430_btxld= usr.sbin/btxld
1431.endif
1432.endif
1433.if ${TARGET_ARCH} != ${MACHINE_ARCH}
1434.if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
1435_crunchide= usr.sbin/crunch/crunchide
1436.endif
1437.if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR)
1438_kgzip= usr.sbin/kgzip
1439.endif
1440.endif
1441
1442# If we're given an XAS, don't build binutils.
1443.if ${XAS:M/*} == ""
1444.if ${MK_BINUTILS_BOOTSTRAP} != "no"
1445_binutils= gnu/usr.bin/binutils
1446.endif
1447.if ${MK_ELFTOOLCHAIN_TOOLS} != "no"
1448_elftctools= lib/libelftc \
1449 usr.bin/addr2line \
1450 usr.bin/elfcopy \
1451 usr.bin/nm \
1452 usr.bin/size \
1453 usr.bin/strings
1454.endif
1455.endif
1456
1457# If an full path to an external cross compiler is given, don't build
1458# a cross compiler.
1459.if ${XCC:M/*} == "" && ${MK_CROSS_COMPILER} != "no"
1460.if ${MK_CLANG_BOOTSTRAP} != "no"
1461_clang= usr.bin/clang
1462_clang_libs= lib/clang
1463.endif
1464.if ${MK_GCC_BOOTSTRAP} != "no"
1465_cc= gnu/usr.bin/cc
1466.endif
1467.endif
1468
1469cross-tools: .MAKE
1470.for _tool in \
1471 ${_clang_libs} \
1472 ${_clang} \
1473 ${_binutils} \
1474 ${_elftctools} \
1475 ${_cc} \
1476 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
1477 ${_btxld} \
1478 ${_crunchide} \
1479 ${_kgzip} \
1480 sys/boot/usb/tools
1481 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1482 cd ${.CURDIR}/${_tool} && \
1483 ${MAKE} DIRPRFX=${_tool}/ obj && \
1484 ${MAKE} DIRPRFX=${_tool}/ depend && \
1485 ${MAKE} DIRPRFX=${_tool}/ all && \
1486 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
1487.endfor
1488
1489NXBENV= MAKEOBJDIRPREFIX=${OBJTREE}/nxb \
1490 INSTALL="sh ${.CURDIR}/tools/install.sh" \
1491 VERSION="${VERSION}"
1492NXBMAKE= ${NXBENV} ${MAKE} \
1493 TBLGEN=${OBJTREE}/nxb-bin/usr/bin/tblgen \
1494 CLANG_TBLGEN=${OBJTREE}/nxb-bin/usr/bin/clang-tblgen \
1495 MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} \
1496 MK_GDB=no MK_TESTS=no \
1497 SSP_CFLAGS= \
1399#
1400# kernel-tools: Build kernel-building tools
1401#
1402kernel-tools: .MAKE
1403 mkdir -p ${MAKEOBJDIRPREFIX}/usr
1404 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1405 -p ${MAKEOBJDIRPREFIX}/usr >/dev/null
1406
1407#
1408# cross-tools: Build cross-building tools
1409#
1410.if ${TARGET_ARCH} != ${MACHINE_ARCH}
1411.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
1412_btxld= usr.sbin/btxld
1413.endif
1414.endif
1415.if ${TARGET_ARCH} != ${MACHINE_ARCH}
1416.if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
1417_crunchide= usr.sbin/crunch/crunchide
1418.endif
1419.if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR)
1420_kgzip= usr.sbin/kgzip
1421.endif
1422.endif
1423
1424# If we're given an XAS, don't build binutils.
1425.if ${XAS:M/*} == ""
1426.if ${MK_BINUTILS_BOOTSTRAP} != "no"
1427_binutils= gnu/usr.bin/binutils
1428.endif
1429.if ${MK_ELFTOOLCHAIN_TOOLS} != "no"
1430_elftctools= lib/libelftc \
1431 usr.bin/addr2line \
1432 usr.bin/elfcopy \
1433 usr.bin/nm \
1434 usr.bin/size \
1435 usr.bin/strings
1436.endif
1437.endif
1438
1439# If an full path to an external cross compiler is given, don't build
1440# a cross compiler.
1441.if ${XCC:M/*} == "" && ${MK_CROSS_COMPILER} != "no"
1442.if ${MK_CLANG_BOOTSTRAP} != "no"
1443_clang= usr.bin/clang
1444_clang_libs= lib/clang
1445.endif
1446.if ${MK_GCC_BOOTSTRAP} != "no"
1447_cc= gnu/usr.bin/cc
1448.endif
1449.endif
1450
1451cross-tools: .MAKE
1452.for _tool in \
1453 ${_clang_libs} \
1454 ${_clang} \
1455 ${_binutils} \
1456 ${_elftctools} \
1457 ${_cc} \
1458 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
1459 ${_btxld} \
1460 ${_crunchide} \
1461 ${_kgzip} \
1462 sys/boot/usb/tools
1463 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1464 cd ${.CURDIR}/${_tool} && \
1465 ${MAKE} DIRPRFX=${_tool}/ obj && \
1466 ${MAKE} DIRPRFX=${_tool}/ depend && \
1467 ${MAKE} DIRPRFX=${_tool}/ all && \
1468 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
1469.endfor
1470
1471NXBENV= MAKEOBJDIRPREFIX=${OBJTREE}/nxb \
1472 INSTALL="sh ${.CURDIR}/tools/install.sh" \
1473 VERSION="${VERSION}"
1474NXBMAKE= ${NXBENV} ${MAKE} \
1475 TBLGEN=${OBJTREE}/nxb-bin/usr/bin/tblgen \
1476 CLANG_TBLGEN=${OBJTREE}/nxb-bin/usr/bin/clang-tblgen \
1477 MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} \
1478 MK_GDB=no MK_TESTS=no \
1479 SSP_CFLAGS= \
1498 MK_HTML=no MK_INFO=no NO_LINT=yes MK_MAN=no \
1480 MK_HTML=no NO_LINT=yes MK_MAN=no \
1499 -DNO_PIC MK_PROFILE=no -DNO_SHARED \
1500 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
1501 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \
1502 MK_LLDB=no
1503
1504native-xtools: .MAKE
1505 mkdir -p ${OBJTREE}/nxb-bin/bin
1506 mkdir -p ${OBJTREE}/nxb-bin/sbin
1507 mkdir -p ${OBJTREE}/nxb-bin/usr
1508 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1509 -p ${OBJTREE}/nxb-bin/usr >/dev/null
1510 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1511 -p ${OBJTREE}/nxb-bin/usr/include >/dev/null
1512.for _tool in \
1513 bin/cat \
1514 bin/chmod \
1515 bin/cp \
1516 bin/csh \
1517 bin/echo \
1518 bin/expr \
1519 bin/hostname \
1520 bin/ln \
1521 bin/ls \
1522 bin/mkdir \
1523 bin/mv \
1524 bin/ps \
1525 bin/realpath \
1526 bin/rm \
1527 bin/rmdir \
1528 bin/sh \
1529 bin/sleep \
1530 ${_clang_tblgen} \
1531 usr.bin/ar \
1532 ${_binutils} \
1533 ${_elftctools} \
1534 ${_cc} \
1535 ${_gcc_tools} \
1536 ${_clang_libs} \
1537 ${_clang} \
1538 sbin/md5 \
1539 sbin/sysctl \
1540 gnu/usr.bin/diff \
1541 usr.bin/awk \
1542 usr.bin/basename \
1543 usr.bin/bmake \
1544 usr.bin/bzip2 \
1545 usr.bin/cmp \
1546 usr.bin/dirname \
1547 usr.bin/env \
1548 usr.bin/fetch \
1549 usr.bin/find \
1550 usr.bin/grep \
1551 usr.bin/gzip \
1552 usr.bin/id \
1553 usr.bin/lex \
1554 usr.bin/lorder \
1555 usr.bin/mktemp \
1556 usr.bin/mt \
1557 usr.bin/patch \
1558 usr.bin/sed \
1559 usr.bin/sort \
1560 usr.bin/tar \
1561 usr.bin/touch \
1562 usr.bin/tr \
1563 usr.bin/true \
1564 usr.bin/uniq \
1565 usr.bin/unzip \
1566 usr.bin/xargs \
1567 usr.bin/xinstall \
1568 usr.bin/xz \
1569 usr.bin/yacc \
1570 usr.sbin/chown
1571 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1572 cd ${.CURDIR}/${_tool} && \
1573 ${NXBMAKE} DIRPRFX=${_tool}/ obj && \
1574 ${NXBMAKE} DIRPRFX=${_tool}/ depend && \
1575 ${NXBMAKE} DIRPRFX=${_tool}/ all && \
1576 ${NXBMAKE} DIRPRFX=${_tool}/ DESTDIR=${OBJTREE}/nxb-bin install
1577.endfor
1578
1579#
1580# hierarchy - ensure that all the needed directories are present
1581#
1582hierarchy hier: .MAKE
1583 cd ${.CURDIR}/etc && ${HMAKE} distrib-dirs
1584
1585#
1586# libraries - build all libraries, and install them under ${DESTDIR}.
1587#
1588# The list of libraries with dependents (${_prebuild_libs}) and their
1589# interdependencies (__L) are built automatically by the
1590# ${.CURDIR}/tools/make_libdeps.sh script.
1591#
1592libraries: .MAKE
1593 cd ${.CURDIR} && \
1594 ${MAKE} -f Makefile.inc1 _prereq_libs && \
1595 ${MAKE} -f Makefile.inc1 _startup_libs && \
1596 ${MAKE} -f Makefile.inc1 _prebuild_libs && \
1597 ${MAKE} -f Makefile.inc1 _generic_libs
1598
1599#
1600# static libgcc.a prerequisite for shared libc
1601#
1602_prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt
1603
1604# These dependencies are not automatically generated:
1605#
1606# gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
1607# all shared libraries for ELF.
1608#
1609_startup_libs= gnu/lib/csu
1610.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
1611_startup_libs+= lib/csu/${MACHINE_ARCH}-elf
1612.elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
1613_startup_libs+= lib/csu/${MACHINE_ARCH}
1614.else
1615_startup_libs+= lib/csu/${MACHINE_CPUARCH}
1616.endif
1617_startup_libs+= gnu/lib/libgcc
1618_startup_libs+= lib/libcompiler_rt
1619_startup_libs+= lib/libc
1620_startup_libs+= lib/libc_nonshared
1621.if ${MK_LIBCPLUSPLUS} != "no"
1622_startup_libs+= lib/libcxxrt
1623.endif
1624
1625gnu/lib/libgcc__L: lib/libc__L
1626gnu/lib/libgcc__L: lib/libc_nonshared__L
1627.if ${MK_LIBCPLUSPLUS} != "no"
1628lib/libcxxrt__L: gnu/lib/libgcc__L
1629.endif
1630
1631_prebuild_libs= ${_kerberos5_lib_libasn1} \
1632 ${_kerberos5_lib_libhdb} \
1633 ${_kerberos5_lib_libheimbase} \
1634 ${_kerberos5_lib_libheimntlm} \
1635 ${_kerberos5_lib_libheimsqlite} \
1636 ${_kerberos5_lib_libheimipcc} \
1637 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
1638 ${_kerberos5_lib_libroken} \
1639 ${_kerberos5_lib_libwind} \
1640 lib/libbz2 ${_libcom_err} lib/libcrypt \
1641 lib/libelf lib/libexpat \
1642 lib/libfigpar \
1643 ${_lib_libgssapi} \
1644 lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \
1645 ${_lib_libcapsicum} \
1646 lib/ncurses/ncurses lib/ncurses/ncursesw \
1647 lib/libopie lib/libpam ${_lib_libthr} \
1648 lib/libradius lib/libsbuf lib/libtacplus \
1649 lib/libgeom \
1650 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
1651 ${_cddl_lib_libuutil} \
1652 ${_cddl_lib_libavl} \
1653 ${_cddl_lib_libzfs_core} \
1654 ${_cddl_lib_libctf} \
1655 lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \
1656 ${_secure_lib_libcrypto} ${_lib_libldns} \
1657 ${_secure_lib_libssh} ${_secure_lib_libssl} \
1658 gnu/lib/libdialog
1659.if ${MK_GNUCXX} != "no"
1660_prebuild_libs+= gnu/lib/libstdc++ gnu/lib/libsupc++
1661gnu/lib/libstdc++__L: lib/msun__L
1662gnu/lib/libsupc++__L: gnu/lib/libstdc++__L
1663.endif
1664
1665lib/libgeom__L: lib/libexpat__L
1666
1667.if ${MK_LIBTHR} != "no"
1668_lib_libthr= lib/libthr
1669.endif
1670
1671.if ${MK_OFED} != "no"
1672_ofed_lib= contrib/ofed/usr.lib/
1673.endif
1674
1675.if ${MK_CASPER} != "no"
1676_lib_libcapsicum=lib/libcapsicum
1677.endif
1678
1679lib/libcapsicum__L: lib/libnv__L
1680lib/libpjdlog__L: lib/libutil__L
1681
1682_generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib}
1683.for _DIR in ${LOCAL_LIB_DIRS}
1684.if exists(${.CURDIR}/${_DIR}/Makefile)
1685_generic_libs+= ${_DIR}
1686.endif
1687.endfor
1688
1689lib/libopie__L lib/libtacplus__L: lib/libmd__L
1690
1691.if ${MK_CDDL} != "no"
1692_cddl_lib_libumem= cddl/lib/libumem
1693_cddl_lib_libnvpair= cddl/lib/libnvpair
1694_cddl_lib_libavl= cddl/lib/libavl
1695_cddl_lib_libuutil= cddl/lib/libuutil
1696_cddl_lib_libzfs_core= cddl/lib/libzfs_core
1697_cddl_lib_libctf= cddl/lib/libctf
1698_cddl_lib= cddl/lib
1699cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L
1700cddl/lib/libzfs__L: lib/libgeom__L
1701cddl/lib/libctf__L: lib/libz__L
1702.endif
1703
1704.if ${MK_CRYPT} != "no"
1705.if ${MK_OPENSSL} != "no"
1706_secure_lib_libcrypto= secure/lib/libcrypto
1707_secure_lib_libssl= secure/lib/libssl
1708lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
1709.if ${MK_LDNS} != "no"
1710_lib_libldns= lib/libldns
1711lib/libldns__L: secure/lib/libcrypto__L
1712.endif
1713.if ${MK_OPENSSH} != "no"
1714_secure_lib_libssh= secure/lib/libssh
1715secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1716.if ${MK_LDNS} != "no"
1717secure/lib/libssh__L: lib/libldns__L
1718.endif
1719.if ${MK_KERBEROS_SUPPORT} != "no"
1720secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1721 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
1722 lib/libmd__L kerberos5/lib/libroken__L
1723.endif
1724.endif
1725.endif
1726_secure_lib= secure/lib
1727.endif
1728
1729.if ${MK_KERBEROS} != "no"
1730kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L
1731kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1732 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \
1733 kerberos5/lib/libwind__L kerberos5/lib/libheimsqlite__L
1734kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \
1735 kerberos5/lib/libroken__L lib/libcom_err__L
1736kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1737 secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L
1738kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1739 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \
1740 kerberos5/lib/libroken__L kerberos5/lib/libwind__L \
1741 kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L
1742kerberos5/lib/libroken__L: lib/libcrypt__L
1743kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L
1744kerberos5/lib/libheimbase__L: lib/libthr__L
1745kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L
1746kerberos5/lib/libheimsqlite__L: lib/libthr__L
1747.endif
1748
1749.if ${MK_GSSAPI} != "no"
1750_lib_libgssapi= lib/libgssapi
1751.endif
1752
1753.if ${MK_KERBEROS} != "no"
1754_kerberos5_lib= kerberos5/lib
1755_kerberos5_lib_libasn1= kerberos5/lib/libasn1
1756_kerberos5_lib_libhdb= kerberos5/lib/libhdb
1757_kerberos5_lib_libheimbase= kerberos5/lib/libheimbase
1758_kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1759_kerberos5_lib_libhx509= kerberos5/lib/libhx509
1760_kerberos5_lib_libroken= kerberos5/lib/libroken
1761_kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
1762_kerberos5_lib_libheimsqlite= kerberos5/lib/libheimsqlite
1763_kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc
1764_kerberos5_lib_libwind= kerberos5/lib/libwind
1765_libcom_err= lib/libcom_err
1766.endif
1767
1768.if ${MK_NIS} != "no"
1769_lib_libypclnt= lib/libypclnt
1770.endif
1771
1772.if ${MK_OPENSSL} == "no"
1773lib/libradius__L: lib/libmd__L
1774.endif
1775
1776gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L
1777
1778.for _lib in ${_prereq_libs}
1779${_lib}__PL: .PHONY .MAKE
1780.if exists(${.CURDIR}/${_lib})
1781 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1782 cd ${.CURDIR}/${_lib} && \
1783 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj && \
1784 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ depend && \
1785 ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \
1786 DIRPRFX=${_lib}/ all && \
1787 ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \
1788 DIRPRFX=${_lib}/ install
1789.endif
1790.endfor
1791
1792.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1793${_lib}__L: .PHONY .MAKE
1794.if exists(${.CURDIR}/${_lib})
1795 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1796 cd ${.CURDIR}/${_lib} && \
1797 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj && \
1798 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ depend && \
1799 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ all && \
1800 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ install
1801.endif
1802.endfor
1803
1804# libpam is special: we need to build static PAM modules before
1805# static PAM library, and dynamic PAM library before dynamic PAM
1806# modules.
1807lib/libpam__L: .PHONY .MAKE
1808 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
1809 cd ${.CURDIR}/lib/libpam && \
1810 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ obj && \
1811 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ depend && \
1812 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ \
1813 -D_NO_LIBPAM_SO_YET all && \
1814 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ \
1815 -D_NO_LIBPAM_SO_YET install
1816
1817_prereq_libs: ${_prereq_libs:S/$/__PL/}
1818_startup_libs: ${_startup_libs:S/$/__L/}
1819_prebuild_libs: ${_prebuild_libs:S/$/__L/}
1820_generic_libs: ${_generic_libs:S/$/__L/}
1821
1822.for __target in all clean cleandepend cleandir depend includes obj
1823.for entry in ${SUBDIR}
1824${entry}.${__target}__D: .PHONY .MAKE
1825 ${_+_}@set -e; if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1826 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
1827 edir=${entry}.${MACHINE_ARCH}; \
1828 cd ${.CURDIR}/$${edir}; \
1829 else \
1830 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
1831 edir=${entry}; \
1832 cd ${.CURDIR}/$${edir}; \
1833 fi; \
1834 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1835.endfor
1836par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1837.endfor
1838
1839.include <bsd.subdir.mk>
1840
1841.if make(check-old) || make(check-old-dirs) || \
1842 make(check-old-files) || make(check-old-libs) || \
1843 make(delete-old) || make(delete-old-dirs) || \
1844 make(delete-old-files) || make(delete-old-libs)
1845
1846#
1847# check for / delete old files section
1848#
1849
1850.include "ObsoleteFiles.inc"
1851
1852OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
1853else you can not start such an application. Consult UPDATING for more \
1854information regarding how to cope with the removal/revision bump of a \
1855specific library."
1856
1857.if !defined(BATCH_DELETE_OLD_FILES)
1858RM_I=-i
1859.else
1860RM_I=-v
1861.endif
1862
1863delete-old-files:
1864 @echo ">>> Removing old files (only deletes safe to delete libs)"
1865# Ask for every old file if the user really wants to remove it.
1866# It's annoying, but better safe than sorry.
1867# NB: We cannot pass the list of OLD_FILES as a parameter because the
1868# argument list will get too long. Using .for/.endfor make "loops" will make
1869# the Makefile parser segfault.
1870 @exec 3<&0; \
1871 cd ${.CURDIR}; \
1872 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1873 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1874 while read file; do \
1875 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1876 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1877 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1878 fi; \
1879 done
1880# Remove catpages without corresponding manpages.
1881 @exec 3<&0; \
1882 find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1883 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1884 while read catpage; do \
1885 read manpage; \
1886 if [ ! -e "$${manpage}" ]; then \
1887 rm ${RM_I} $${catpage} <&3; \
1888 fi; \
1889 done
1890 @echo ">>> Old files removed"
1891
1892check-old-files:
1893 @echo ">>> Checking for old files"
1894 @cd ${.CURDIR}; \
1895 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1896 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1897 while read file; do \
1898 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1899 echo "${DESTDIR}/$${file}"; \
1900 fi; \
1901 done
1902# Check for catpages without corresponding manpages.
1903 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1904 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1905 while read catpage; do \
1906 read manpage; \
1907 if [ ! -e "$${manpage}" ]; then \
1908 echo $${catpage}; \
1909 fi; \
1910 done
1911
1912delete-old-libs:
1913 @echo ">>> Removing old libraries"
1914 @echo "${OLD_LIBS_MESSAGE}" | fmt
1915 @exec 3<&0; \
1916 cd ${.CURDIR}; \
1917 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1918 -V OLD_LIBS | xargs -n1 | \
1919 while read file; do \
1920 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1921 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1922 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1923 fi; \
1924 for ext in debug symbols; do \
1925 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \
1926 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
1927 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \
1928 <&3; \
1929 fi; \
1930 done; \
1931 done
1932 @echo ">>> Old libraries removed"
1933
1934check-old-libs:
1935 @echo ">>> Checking for old libraries"
1936 @cd ${.CURDIR}; \
1937 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1938 -V OLD_LIBS | xargs -n1 | \
1939 while read file; do \
1940 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1941 echo "${DESTDIR}/$${file}"; \
1942 fi; \
1943 for ext in debug symbols; do \
1944 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
1945 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \
1946 fi; \
1947 done; \
1948 done
1949
1950delete-old-dirs:
1951 @echo ">>> Removing old directories"
1952 @cd ${.CURDIR}; \
1953 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1954 -V OLD_DIRS | xargs -n1 | sort -r | \
1955 while read dir; do \
1956 if [ -d "${DESTDIR}/$${dir}" ]; then \
1957 rmdir -v "${DESTDIR}/$${dir}" || true; \
1958 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1959 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1960 fi; \
1961 done
1962 @echo ">>> Old directories removed"
1963
1964check-old-dirs:
1965 @echo ">>> Checking for old directories"
1966 @cd ${.CURDIR}; \
1967 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1968 -V OLD_DIRS | xargs -n1 | \
1969 while read dir; do \
1970 if [ -d "${DESTDIR}/$${dir}" ]; then \
1971 echo "${DESTDIR}/$${dir}"; \
1972 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1973 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1974 fi; \
1975 done
1976
1977delete-old: delete-old-files delete-old-dirs
1978 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1979
1980check-old: check-old-files check-old-libs check-old-dirs
1981 @echo "To remove old files and directories run '${MAKE} delete-old'."
1982 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1983
1984.endif
1985
1986#
1987# showconfig - show build configuration.
1988#
1989showconfig:
1990 @(${MAKE} -n -f ${.CURDIR}/sys/conf/kern.opts.mk -V dummy -dg1; \
1991 ${MAKE} -n -f ${.CURDIR}/share/mk/src.opts.mk -V dummy -dg1) 2>&1 | grep ^MK_ | sort -u
1992
1993.if !empty(KRNLOBJDIR) && !empty(KERNCONF)
1994DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
1995
1996.if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
1997.if exists(${KERNCONFDIR}/${KERNCONF})
1998FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \
1999 '${KERNCONFDIR}/${KERNCONF}' ; echo
2000.endif
2001.endif
2002
2003.endif
2004
2005.if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH})
2006DTBOUTPUTPATH= ${.CURDIR}
2007.endif
2008
2009#
2010# Build 'standalone' Device Tree Blob
2011#
2012builddtb:
2013 @PATH=${TMPPATH} MACHINE=${TARGET} \
2014 ${.CURDIR}/sys/tools/fdt/make_dtb.sh ${.CURDIR}/sys \
2015 "${FDT_DTS_FILE}" ${DTBOUTPUTPATH}
2016
2017###############
2018
2019.if defined(TARGET) && defined(TARGET_ARCH)
2020
2021.if ${TARGET} == ${MACHINE} && ${TARGET_ARCH} == ${MACHINE_ARCH}
2022XDEV_CPUTYPE?=${CPUTYPE}
2023.else
2024XDEV_CPUTYPE?=${TARGET_CPUTYPE}
2025.endif
2026
1481 -DNO_PIC MK_PROFILE=no -DNO_SHARED \
1482 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
1483 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \
1484 MK_LLDB=no
1485
1486native-xtools: .MAKE
1487 mkdir -p ${OBJTREE}/nxb-bin/bin
1488 mkdir -p ${OBJTREE}/nxb-bin/sbin
1489 mkdir -p ${OBJTREE}/nxb-bin/usr
1490 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1491 -p ${OBJTREE}/nxb-bin/usr >/dev/null
1492 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1493 -p ${OBJTREE}/nxb-bin/usr/include >/dev/null
1494.for _tool in \
1495 bin/cat \
1496 bin/chmod \
1497 bin/cp \
1498 bin/csh \
1499 bin/echo \
1500 bin/expr \
1501 bin/hostname \
1502 bin/ln \
1503 bin/ls \
1504 bin/mkdir \
1505 bin/mv \
1506 bin/ps \
1507 bin/realpath \
1508 bin/rm \
1509 bin/rmdir \
1510 bin/sh \
1511 bin/sleep \
1512 ${_clang_tblgen} \
1513 usr.bin/ar \
1514 ${_binutils} \
1515 ${_elftctools} \
1516 ${_cc} \
1517 ${_gcc_tools} \
1518 ${_clang_libs} \
1519 ${_clang} \
1520 sbin/md5 \
1521 sbin/sysctl \
1522 gnu/usr.bin/diff \
1523 usr.bin/awk \
1524 usr.bin/basename \
1525 usr.bin/bmake \
1526 usr.bin/bzip2 \
1527 usr.bin/cmp \
1528 usr.bin/dirname \
1529 usr.bin/env \
1530 usr.bin/fetch \
1531 usr.bin/find \
1532 usr.bin/grep \
1533 usr.bin/gzip \
1534 usr.bin/id \
1535 usr.bin/lex \
1536 usr.bin/lorder \
1537 usr.bin/mktemp \
1538 usr.bin/mt \
1539 usr.bin/patch \
1540 usr.bin/sed \
1541 usr.bin/sort \
1542 usr.bin/tar \
1543 usr.bin/touch \
1544 usr.bin/tr \
1545 usr.bin/true \
1546 usr.bin/uniq \
1547 usr.bin/unzip \
1548 usr.bin/xargs \
1549 usr.bin/xinstall \
1550 usr.bin/xz \
1551 usr.bin/yacc \
1552 usr.sbin/chown
1553 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1554 cd ${.CURDIR}/${_tool} && \
1555 ${NXBMAKE} DIRPRFX=${_tool}/ obj && \
1556 ${NXBMAKE} DIRPRFX=${_tool}/ depend && \
1557 ${NXBMAKE} DIRPRFX=${_tool}/ all && \
1558 ${NXBMAKE} DIRPRFX=${_tool}/ DESTDIR=${OBJTREE}/nxb-bin install
1559.endfor
1560
1561#
1562# hierarchy - ensure that all the needed directories are present
1563#
1564hierarchy hier: .MAKE
1565 cd ${.CURDIR}/etc && ${HMAKE} distrib-dirs
1566
1567#
1568# libraries - build all libraries, and install them under ${DESTDIR}.
1569#
1570# The list of libraries with dependents (${_prebuild_libs}) and their
1571# interdependencies (__L) are built automatically by the
1572# ${.CURDIR}/tools/make_libdeps.sh script.
1573#
1574libraries: .MAKE
1575 cd ${.CURDIR} && \
1576 ${MAKE} -f Makefile.inc1 _prereq_libs && \
1577 ${MAKE} -f Makefile.inc1 _startup_libs && \
1578 ${MAKE} -f Makefile.inc1 _prebuild_libs && \
1579 ${MAKE} -f Makefile.inc1 _generic_libs
1580
1581#
1582# static libgcc.a prerequisite for shared libc
1583#
1584_prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt
1585
1586# These dependencies are not automatically generated:
1587#
1588# gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
1589# all shared libraries for ELF.
1590#
1591_startup_libs= gnu/lib/csu
1592.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
1593_startup_libs+= lib/csu/${MACHINE_ARCH}-elf
1594.elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
1595_startup_libs+= lib/csu/${MACHINE_ARCH}
1596.else
1597_startup_libs+= lib/csu/${MACHINE_CPUARCH}
1598.endif
1599_startup_libs+= gnu/lib/libgcc
1600_startup_libs+= lib/libcompiler_rt
1601_startup_libs+= lib/libc
1602_startup_libs+= lib/libc_nonshared
1603.if ${MK_LIBCPLUSPLUS} != "no"
1604_startup_libs+= lib/libcxxrt
1605.endif
1606
1607gnu/lib/libgcc__L: lib/libc__L
1608gnu/lib/libgcc__L: lib/libc_nonshared__L
1609.if ${MK_LIBCPLUSPLUS} != "no"
1610lib/libcxxrt__L: gnu/lib/libgcc__L
1611.endif
1612
1613_prebuild_libs= ${_kerberos5_lib_libasn1} \
1614 ${_kerberos5_lib_libhdb} \
1615 ${_kerberos5_lib_libheimbase} \
1616 ${_kerberos5_lib_libheimntlm} \
1617 ${_kerberos5_lib_libheimsqlite} \
1618 ${_kerberos5_lib_libheimipcc} \
1619 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
1620 ${_kerberos5_lib_libroken} \
1621 ${_kerberos5_lib_libwind} \
1622 lib/libbz2 ${_libcom_err} lib/libcrypt \
1623 lib/libelf lib/libexpat \
1624 lib/libfigpar \
1625 ${_lib_libgssapi} \
1626 lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \
1627 ${_lib_libcapsicum} \
1628 lib/ncurses/ncurses lib/ncurses/ncursesw \
1629 lib/libopie lib/libpam ${_lib_libthr} \
1630 lib/libradius lib/libsbuf lib/libtacplus \
1631 lib/libgeom \
1632 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
1633 ${_cddl_lib_libuutil} \
1634 ${_cddl_lib_libavl} \
1635 ${_cddl_lib_libzfs_core} \
1636 ${_cddl_lib_libctf} \
1637 lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \
1638 ${_secure_lib_libcrypto} ${_lib_libldns} \
1639 ${_secure_lib_libssh} ${_secure_lib_libssl} \
1640 gnu/lib/libdialog
1641.if ${MK_GNUCXX} != "no"
1642_prebuild_libs+= gnu/lib/libstdc++ gnu/lib/libsupc++
1643gnu/lib/libstdc++__L: lib/msun__L
1644gnu/lib/libsupc++__L: gnu/lib/libstdc++__L
1645.endif
1646
1647lib/libgeom__L: lib/libexpat__L
1648
1649.if ${MK_LIBTHR} != "no"
1650_lib_libthr= lib/libthr
1651.endif
1652
1653.if ${MK_OFED} != "no"
1654_ofed_lib= contrib/ofed/usr.lib/
1655.endif
1656
1657.if ${MK_CASPER} != "no"
1658_lib_libcapsicum=lib/libcapsicum
1659.endif
1660
1661lib/libcapsicum__L: lib/libnv__L
1662lib/libpjdlog__L: lib/libutil__L
1663
1664_generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib}
1665.for _DIR in ${LOCAL_LIB_DIRS}
1666.if exists(${.CURDIR}/${_DIR}/Makefile)
1667_generic_libs+= ${_DIR}
1668.endif
1669.endfor
1670
1671lib/libopie__L lib/libtacplus__L: lib/libmd__L
1672
1673.if ${MK_CDDL} != "no"
1674_cddl_lib_libumem= cddl/lib/libumem
1675_cddl_lib_libnvpair= cddl/lib/libnvpair
1676_cddl_lib_libavl= cddl/lib/libavl
1677_cddl_lib_libuutil= cddl/lib/libuutil
1678_cddl_lib_libzfs_core= cddl/lib/libzfs_core
1679_cddl_lib_libctf= cddl/lib/libctf
1680_cddl_lib= cddl/lib
1681cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L
1682cddl/lib/libzfs__L: lib/libgeom__L
1683cddl/lib/libctf__L: lib/libz__L
1684.endif
1685
1686.if ${MK_CRYPT} != "no"
1687.if ${MK_OPENSSL} != "no"
1688_secure_lib_libcrypto= secure/lib/libcrypto
1689_secure_lib_libssl= secure/lib/libssl
1690lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
1691.if ${MK_LDNS} != "no"
1692_lib_libldns= lib/libldns
1693lib/libldns__L: secure/lib/libcrypto__L
1694.endif
1695.if ${MK_OPENSSH} != "no"
1696_secure_lib_libssh= secure/lib/libssh
1697secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1698.if ${MK_LDNS} != "no"
1699secure/lib/libssh__L: lib/libldns__L
1700.endif
1701.if ${MK_KERBEROS_SUPPORT} != "no"
1702secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1703 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
1704 lib/libmd__L kerberos5/lib/libroken__L
1705.endif
1706.endif
1707.endif
1708_secure_lib= secure/lib
1709.endif
1710
1711.if ${MK_KERBEROS} != "no"
1712kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L
1713kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1714 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \
1715 kerberos5/lib/libwind__L kerberos5/lib/libheimsqlite__L
1716kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \
1717 kerberos5/lib/libroken__L lib/libcom_err__L
1718kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1719 secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L
1720kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1721 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \
1722 kerberos5/lib/libroken__L kerberos5/lib/libwind__L \
1723 kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L
1724kerberos5/lib/libroken__L: lib/libcrypt__L
1725kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L
1726kerberos5/lib/libheimbase__L: lib/libthr__L
1727kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L
1728kerberos5/lib/libheimsqlite__L: lib/libthr__L
1729.endif
1730
1731.if ${MK_GSSAPI} != "no"
1732_lib_libgssapi= lib/libgssapi
1733.endif
1734
1735.if ${MK_KERBEROS} != "no"
1736_kerberos5_lib= kerberos5/lib
1737_kerberos5_lib_libasn1= kerberos5/lib/libasn1
1738_kerberos5_lib_libhdb= kerberos5/lib/libhdb
1739_kerberos5_lib_libheimbase= kerberos5/lib/libheimbase
1740_kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1741_kerberos5_lib_libhx509= kerberos5/lib/libhx509
1742_kerberos5_lib_libroken= kerberos5/lib/libroken
1743_kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
1744_kerberos5_lib_libheimsqlite= kerberos5/lib/libheimsqlite
1745_kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc
1746_kerberos5_lib_libwind= kerberos5/lib/libwind
1747_libcom_err= lib/libcom_err
1748.endif
1749
1750.if ${MK_NIS} != "no"
1751_lib_libypclnt= lib/libypclnt
1752.endif
1753
1754.if ${MK_OPENSSL} == "no"
1755lib/libradius__L: lib/libmd__L
1756.endif
1757
1758gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L
1759
1760.for _lib in ${_prereq_libs}
1761${_lib}__PL: .PHONY .MAKE
1762.if exists(${.CURDIR}/${_lib})
1763 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1764 cd ${.CURDIR}/${_lib} && \
1765 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj && \
1766 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ depend && \
1767 ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \
1768 DIRPRFX=${_lib}/ all && \
1769 ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \
1770 DIRPRFX=${_lib}/ install
1771.endif
1772.endfor
1773
1774.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1775${_lib}__L: .PHONY .MAKE
1776.if exists(${.CURDIR}/${_lib})
1777 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1778 cd ${.CURDIR}/${_lib} && \
1779 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj && \
1780 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ depend && \
1781 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ all && \
1782 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ install
1783.endif
1784.endfor
1785
1786# libpam is special: we need to build static PAM modules before
1787# static PAM library, and dynamic PAM library before dynamic PAM
1788# modules.
1789lib/libpam__L: .PHONY .MAKE
1790 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
1791 cd ${.CURDIR}/lib/libpam && \
1792 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ obj && \
1793 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ depend && \
1794 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ \
1795 -D_NO_LIBPAM_SO_YET all && \
1796 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ \
1797 -D_NO_LIBPAM_SO_YET install
1798
1799_prereq_libs: ${_prereq_libs:S/$/__PL/}
1800_startup_libs: ${_startup_libs:S/$/__L/}
1801_prebuild_libs: ${_prebuild_libs:S/$/__L/}
1802_generic_libs: ${_generic_libs:S/$/__L/}
1803
1804.for __target in all clean cleandepend cleandir depend includes obj
1805.for entry in ${SUBDIR}
1806${entry}.${__target}__D: .PHONY .MAKE
1807 ${_+_}@set -e; if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1808 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
1809 edir=${entry}.${MACHINE_ARCH}; \
1810 cd ${.CURDIR}/$${edir}; \
1811 else \
1812 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
1813 edir=${entry}; \
1814 cd ${.CURDIR}/$${edir}; \
1815 fi; \
1816 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1817.endfor
1818par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1819.endfor
1820
1821.include <bsd.subdir.mk>
1822
1823.if make(check-old) || make(check-old-dirs) || \
1824 make(check-old-files) || make(check-old-libs) || \
1825 make(delete-old) || make(delete-old-dirs) || \
1826 make(delete-old-files) || make(delete-old-libs)
1827
1828#
1829# check for / delete old files section
1830#
1831
1832.include "ObsoleteFiles.inc"
1833
1834OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
1835else you can not start such an application. Consult UPDATING for more \
1836information regarding how to cope with the removal/revision bump of a \
1837specific library."
1838
1839.if !defined(BATCH_DELETE_OLD_FILES)
1840RM_I=-i
1841.else
1842RM_I=-v
1843.endif
1844
1845delete-old-files:
1846 @echo ">>> Removing old files (only deletes safe to delete libs)"
1847# Ask for every old file if the user really wants to remove it.
1848# It's annoying, but better safe than sorry.
1849# NB: We cannot pass the list of OLD_FILES as a parameter because the
1850# argument list will get too long. Using .for/.endfor make "loops" will make
1851# the Makefile parser segfault.
1852 @exec 3<&0; \
1853 cd ${.CURDIR}; \
1854 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1855 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1856 while read file; do \
1857 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1858 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1859 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1860 fi; \
1861 done
1862# Remove catpages without corresponding manpages.
1863 @exec 3<&0; \
1864 find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1865 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1866 while read catpage; do \
1867 read manpage; \
1868 if [ ! -e "$${manpage}" ]; then \
1869 rm ${RM_I} $${catpage} <&3; \
1870 fi; \
1871 done
1872 @echo ">>> Old files removed"
1873
1874check-old-files:
1875 @echo ">>> Checking for old files"
1876 @cd ${.CURDIR}; \
1877 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1878 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1879 while read file; do \
1880 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1881 echo "${DESTDIR}/$${file}"; \
1882 fi; \
1883 done
1884# Check for catpages without corresponding manpages.
1885 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1886 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1887 while read catpage; do \
1888 read manpage; \
1889 if [ ! -e "$${manpage}" ]; then \
1890 echo $${catpage}; \
1891 fi; \
1892 done
1893
1894delete-old-libs:
1895 @echo ">>> Removing old libraries"
1896 @echo "${OLD_LIBS_MESSAGE}" | fmt
1897 @exec 3<&0; \
1898 cd ${.CURDIR}; \
1899 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1900 -V OLD_LIBS | xargs -n1 | \
1901 while read file; do \
1902 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1903 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1904 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1905 fi; \
1906 for ext in debug symbols; do \
1907 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \
1908 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
1909 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \
1910 <&3; \
1911 fi; \
1912 done; \
1913 done
1914 @echo ">>> Old libraries removed"
1915
1916check-old-libs:
1917 @echo ">>> Checking for old libraries"
1918 @cd ${.CURDIR}; \
1919 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1920 -V OLD_LIBS | xargs -n1 | \
1921 while read file; do \
1922 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1923 echo "${DESTDIR}/$${file}"; \
1924 fi; \
1925 for ext in debug symbols; do \
1926 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
1927 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \
1928 fi; \
1929 done; \
1930 done
1931
1932delete-old-dirs:
1933 @echo ">>> Removing old directories"
1934 @cd ${.CURDIR}; \
1935 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1936 -V OLD_DIRS | xargs -n1 | sort -r | \
1937 while read dir; do \
1938 if [ -d "${DESTDIR}/$${dir}" ]; then \
1939 rmdir -v "${DESTDIR}/$${dir}" || true; \
1940 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1941 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1942 fi; \
1943 done
1944 @echo ">>> Old directories removed"
1945
1946check-old-dirs:
1947 @echo ">>> Checking for old directories"
1948 @cd ${.CURDIR}; \
1949 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1950 -V OLD_DIRS | xargs -n1 | \
1951 while read dir; do \
1952 if [ -d "${DESTDIR}/$${dir}" ]; then \
1953 echo "${DESTDIR}/$${dir}"; \
1954 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1955 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1956 fi; \
1957 done
1958
1959delete-old: delete-old-files delete-old-dirs
1960 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1961
1962check-old: check-old-files check-old-libs check-old-dirs
1963 @echo "To remove old files and directories run '${MAKE} delete-old'."
1964 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1965
1966.endif
1967
1968#
1969# showconfig - show build configuration.
1970#
1971showconfig:
1972 @(${MAKE} -n -f ${.CURDIR}/sys/conf/kern.opts.mk -V dummy -dg1; \
1973 ${MAKE} -n -f ${.CURDIR}/share/mk/src.opts.mk -V dummy -dg1) 2>&1 | grep ^MK_ | sort -u
1974
1975.if !empty(KRNLOBJDIR) && !empty(KERNCONF)
1976DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
1977
1978.if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
1979.if exists(${KERNCONFDIR}/${KERNCONF})
1980FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \
1981 '${KERNCONFDIR}/${KERNCONF}' ; echo
1982.endif
1983.endif
1984
1985.endif
1986
1987.if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH})
1988DTBOUTPUTPATH= ${.CURDIR}
1989.endif
1990
1991#
1992# Build 'standalone' Device Tree Blob
1993#
1994builddtb:
1995 @PATH=${TMPPATH} MACHINE=${TARGET} \
1996 ${.CURDIR}/sys/tools/fdt/make_dtb.sh ${.CURDIR}/sys \
1997 "${FDT_DTS_FILE}" ${DTBOUTPUTPATH}
1998
1999###############
2000
2001.if defined(TARGET) && defined(TARGET_ARCH)
2002
2003.if ${TARGET} == ${MACHINE} && ${TARGET_ARCH} == ${MACHINE_ARCH}
2004XDEV_CPUTYPE?=${CPUTYPE}
2005.else
2006XDEV_CPUTYPE?=${TARGET_CPUTYPE}
2007.endif
2008
2027NOFUN=-DNO_FSCHG MK_HTML=no MK_INFO=no -DNO_LINT \
2009NOFUN=-DNO_FSCHG MK_HTML=no -DNO_LINT \
2028 MK_MAN=no MK_NLS=no MK_PROFILE=no \
2029 MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no MK_WARNS=no \
2030 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
2031 CPUTYPE=${XDEV_CPUTYPE}
2032
2033XDDIR=${TARGET_ARCH}-freebsd
2034XDTP?=/usr/${XDDIR}
2035.if ${XDTP:N/*}
2036.error XDTP variable should be an absolute path
2037.endif
2038
2039CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \
2040 INSTALL="sh ${.CURDIR}/tools/install.sh"
2041CDENV= ${CDBENV} \
2042 _SHLIBDIRPREFIX=${XDDESTDIR} \
2043 TOOLS_PREFIX=${XDTP}
2044CD2CFLAGS=-isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib \
2045 --sysroot=${XDDESTDIR}/ -B${XDDESTDIR}/usr/libexec \
2046 -B${XDDESTDIR}/usr/bin -B${XDDESTDIR}/usr/lib
2047CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" CXX="${CXX} ${CD2CFLAGS}" \
2048 CPP="${CPP} ${CD2CFLAGS}" \
2049 MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH}
2050
2051CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp
2052CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
2053CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDDESTDIR}/usr/bin:${PATH} ${MAKE} ${NOFUN}
2054XDDESTDIR=${DESTDIR}/${XDTP}
2055.if !defined(OSREL)
2056OSREL!= uname -r | sed -e 's/[-(].*//'
2057.endif
2058
2059.ORDER: xdev-build xdev-install xdev-links
2060xdev: xdev-build xdev-install
2061
2062.ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
2063xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
2064
2065_xb-worldtmp:
2066 mkdir -p ${CDTMP}/usr
2067 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
2068 -p ${CDTMP}/usr >/dev/null
2069
2070_xb-bootstrap-tools:
2071.for _tool in \
2072 ${_clang_tblgen} \
2073 ${_gperf}
2074 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
2075 cd ${.CURDIR}/${_tool} && \
2076 ${CDMAKE} DIRPRFX=${_tool}/ obj && \
2077 ${CDMAKE} DIRPRFX=${_tool}/ depend && \
2078 ${CDMAKE} DIRPRFX=${_tool}/ all && \
2079 ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install
2080.endfor
2081
2082_xb-build-tools:
2083 ${_+_}@cd ${.CURDIR}; \
2084 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
2085
2086_xb-cross-tools:
2087.for _tool in \
2088 ${_binutils} \
2089 ${_elftctools} \
2090 usr.bin/ar \
2091 ${_clang_libs} \
2092 ${_clang} \
2093 ${_cc}
2094 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
2095 cd ${.CURDIR}/${_tool} && \
2096 ${CDMAKE} DIRPRFX=${_tool}/ obj && \
2097 ${CDMAKE} DIRPRFX=${_tool}/ depend && \
2098 ${CDMAKE} DIRPRFX=${_tool}/ all
2099.endfor
2100
2101_xi-mtree:
2102 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
2103 mkdir -p ${XDDESTDIR}
2104 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
2105 -p ${XDDESTDIR} >/dev/null
2106 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
2107 -p ${XDDESTDIR}/usr >/dev/null
2108 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
2109 -p ${XDDESTDIR}/usr/include >/dev/null
2110.if ${MK_TESTS} != "no"
2111 mkdir -p ${XDDESTDIR}${TESTSBASE}
2112 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
2113 -p ${XDDESTDIR}${TESTSBASE} >/dev/null
2114.endif
2115
2116.ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries
2117xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries
2118
2119_xi-cross-tools:
2120 @echo "_xi-cross-tools"
2121.for _tool in \
2122 ${_binutils} \
2123 ${_elftctools} \
2124 usr.bin/ar \
2125 ${_clang_libs} \
2126 ${_clang} \
2127 ${_cc}
2128 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
2129 cd ${.CURDIR}/${_tool}; \
2130 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
2131.endfor
2132
2133_xi-includes:
2134 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \
2135 DESTDIR=${XDDESTDIR}
2136
2137_xi-libraries:
2138 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
2139 DESTDIR=${XDDESTDIR}
2140
2141xdev-links:
2142 ${_+_}cd ${XDDESTDIR}/usr/bin; \
2143 mkdir -p ../../../../usr/bin; \
2144 for i in *; do \
2145 ln -sf ../../${XDTP}/usr/bin/$$i \
2146 ../../../../usr/bin/${XDDIR}-$$i; \
2147 ln -sf ../../${XDTP}/usr/bin/$$i \
2148 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \
2149 done
2150.else
2151xdev xdev-build xdev-install xdev-links:
2152 @echo "*** Error: Both TARGET and TARGET_ARCH must be defined for \"${.TARGET}\" target"
2153.endif
2010 MK_MAN=no MK_NLS=no MK_PROFILE=no \
2011 MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no MK_WARNS=no \
2012 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
2013 CPUTYPE=${XDEV_CPUTYPE}
2014
2015XDDIR=${TARGET_ARCH}-freebsd
2016XDTP?=/usr/${XDDIR}
2017.if ${XDTP:N/*}
2018.error XDTP variable should be an absolute path
2019.endif
2020
2021CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \
2022 INSTALL="sh ${.CURDIR}/tools/install.sh"
2023CDENV= ${CDBENV} \
2024 _SHLIBDIRPREFIX=${XDDESTDIR} \
2025 TOOLS_PREFIX=${XDTP}
2026CD2CFLAGS=-isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib \
2027 --sysroot=${XDDESTDIR}/ -B${XDDESTDIR}/usr/libexec \
2028 -B${XDDESTDIR}/usr/bin -B${XDDESTDIR}/usr/lib
2029CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" CXX="${CXX} ${CD2CFLAGS}" \
2030 CPP="${CPP} ${CD2CFLAGS}" \
2031 MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH}
2032
2033CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp
2034CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
2035CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDDESTDIR}/usr/bin:${PATH} ${MAKE} ${NOFUN}
2036XDDESTDIR=${DESTDIR}/${XDTP}
2037.if !defined(OSREL)
2038OSREL!= uname -r | sed -e 's/[-(].*//'
2039.endif
2040
2041.ORDER: xdev-build xdev-install xdev-links
2042xdev: xdev-build xdev-install
2043
2044.ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
2045xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
2046
2047_xb-worldtmp:
2048 mkdir -p ${CDTMP}/usr
2049 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
2050 -p ${CDTMP}/usr >/dev/null
2051
2052_xb-bootstrap-tools:
2053.for _tool in \
2054 ${_clang_tblgen} \
2055 ${_gperf}
2056 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
2057 cd ${.CURDIR}/${_tool} && \
2058 ${CDMAKE} DIRPRFX=${_tool}/ obj && \
2059 ${CDMAKE} DIRPRFX=${_tool}/ depend && \
2060 ${CDMAKE} DIRPRFX=${_tool}/ all && \
2061 ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install
2062.endfor
2063
2064_xb-build-tools:
2065 ${_+_}@cd ${.CURDIR}; \
2066 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
2067
2068_xb-cross-tools:
2069.for _tool in \
2070 ${_binutils} \
2071 ${_elftctools} \
2072 usr.bin/ar \
2073 ${_clang_libs} \
2074 ${_clang} \
2075 ${_cc}
2076 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
2077 cd ${.CURDIR}/${_tool} && \
2078 ${CDMAKE} DIRPRFX=${_tool}/ obj && \
2079 ${CDMAKE} DIRPRFX=${_tool}/ depend && \
2080 ${CDMAKE} DIRPRFX=${_tool}/ all
2081.endfor
2082
2083_xi-mtree:
2084 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
2085 mkdir -p ${XDDESTDIR}
2086 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
2087 -p ${XDDESTDIR} >/dev/null
2088 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
2089 -p ${XDDESTDIR}/usr >/dev/null
2090 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
2091 -p ${XDDESTDIR}/usr/include >/dev/null
2092.if ${MK_TESTS} != "no"
2093 mkdir -p ${XDDESTDIR}${TESTSBASE}
2094 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
2095 -p ${XDDESTDIR}${TESTSBASE} >/dev/null
2096.endif
2097
2098.ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries
2099xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries
2100
2101_xi-cross-tools:
2102 @echo "_xi-cross-tools"
2103.for _tool in \
2104 ${_binutils} \
2105 ${_elftctools} \
2106 usr.bin/ar \
2107 ${_clang_libs} \
2108 ${_clang} \
2109 ${_cc}
2110 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
2111 cd ${.CURDIR}/${_tool}; \
2112 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
2113.endfor
2114
2115_xi-includes:
2116 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \
2117 DESTDIR=${XDDESTDIR}
2118
2119_xi-libraries:
2120 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
2121 DESTDIR=${XDDESTDIR}
2122
2123xdev-links:
2124 ${_+_}cd ${XDDESTDIR}/usr/bin; \
2125 mkdir -p ../../../../usr/bin; \
2126 for i in *; do \
2127 ln -sf ../../${XDTP}/usr/bin/$$i \
2128 ../../../../usr/bin/${XDDIR}-$$i; \
2129 ln -sf ../../${XDTP}/usr/bin/$$i \
2130 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \
2131 done
2132.else
2133xdev xdev-build xdev-install xdev-links:
2134 @echo "*** Error: Both TARGET and TARGET_ARCH must be defined for \"${.TARGET}\" target"
2135.endif