Deleted Added
full compact
Makefile (217125) Makefile (217273)
1#
1#
2# $FreeBSD: head/Makefile 217125 2011-01-07 20:36:27Z imp $
2# $FreeBSD: head/Makefile 217273 2011-01-11 18:32:05Z imp $
3#
4# The user-driven targets are:
5#
6# universe - *Really* build *everything* (buildworld and
7# all kernels on all architectures).
3#
4# The user-driven targets are:
5#
6# universe - *Really* build *everything* (buildworld and
7# all kernels on all architectures).
8# tinderbox - Same as universe, but stop on first failure.
8# buildworld - Rebuild *everything*, including glue to help do
9# upgrades.
10# installworld - Install everything built by "buildworld".
11# world - buildworld + installworld, no kernel.
12# buildkernel - Rebuild the kernel and the kernel-modules.
13# installkernel - Install the kernel and the kernel-modules.
14# installkernel.debug
15# reinstallkernel - Reinstall the kernel and the kernel-modules.
16# reinstallkernel.debug
17# kernel - buildkernel + installkernel.
18# kernel-toolchain - Builds the subset of world necessary to build a kernel
19# doxygen - Build API documentation of the kernel, needs doxygen.
20# update - Convenient way to update your source tree (cvs).
21# check-old - List obsolete directories/files/libraries.
22# check-old-dirs - List obsolete directories.
23# check-old-files - List obsolete files.
24# check-old-libs - List obsolete libraries.
25# delete-old - Delete obsolete directories/files/libraries.
26# delete-old-dirs - Delete obsolete directories.
27# delete-old-files - Delete obsolete files.
28# delete-old-libs - Delete obsolete libraries.
29# targets - Print a list of supported TARGET/TARGET_ARCH pairs.
30#
31# This makefile is simple by design. The FreeBSD make automatically reads
32# the /usr/share/mk/sys.mk unless the -m argument is specified on the
33# command line. By keeping this makefile simple, it doesn't matter too
34# much how different the installed mk files are from those in the source
35# tree. This makefile executes a child make process, forcing it to use
36# the mk files from the source tree which are supposed to DTRT.
37#
9# buildworld - Rebuild *everything*, including glue to help do
10# upgrades.
11# installworld - Install everything built by "buildworld".
12# world - buildworld + installworld, no kernel.
13# buildkernel - Rebuild the kernel and the kernel-modules.
14# installkernel - Install the kernel and the kernel-modules.
15# installkernel.debug
16# reinstallkernel - Reinstall the kernel and the kernel-modules.
17# reinstallkernel.debug
18# kernel - buildkernel + installkernel.
19# kernel-toolchain - Builds the subset of world necessary to build a kernel
20# doxygen - Build API documentation of the kernel, needs doxygen.
21# update - Convenient way to update your source tree (cvs).
22# check-old - List obsolete directories/files/libraries.
23# check-old-dirs - List obsolete directories.
24# check-old-files - List obsolete files.
25# check-old-libs - List obsolete libraries.
26# delete-old - Delete obsolete directories/files/libraries.
27# delete-old-dirs - Delete obsolete directories.
28# delete-old-files - Delete obsolete files.
29# delete-old-libs - Delete obsolete libraries.
30# targets - Print a list of supported TARGET/TARGET_ARCH pairs.
31#
32# This makefile is simple by design. The FreeBSD make automatically reads
33# the /usr/share/mk/sys.mk unless the -m argument is specified on the
34# command line. By keeping this makefile simple, it doesn't matter too
35# much how different the installed mk files are from those in the source
36# tree. This makefile executes a child make process, forcing it to use
37# the mk files from the source tree which are supposed to DTRT.
38#
38# The user-driven targets (as listed above) are implemented in Makefile.inc1.
39# Most of the user-driven targets (as listed above) are implemented in
40# Makefile.inc1. The exceptions are universe, tingerbox and targets.
39#
40# If you want to build your system from source be sure that /usr/obj has
41# at least 800MB of diskspace available.
42#
43# For individuals wanting to build from the sources currently on their
44# system, the simple instructions are:
45#
46# 1. `cd /usr/src' (or to the directory containing your source tree).
47# 2. Define `HISTORICAL_MAKE_WORLD' variable (see README).
48# 3. `make world'
49#
50# For individuals wanting to upgrade their sources (even if only a
51# delta of a few days):
52#
53# 1. `cd /usr/src' (or to the directory containing your source tree).
54# 2. `make buildworld'
55# 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC).
56# 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC).
57# [steps 3. & 4. can be combined by using the "kernel" target]
58# 5. `reboot' (in single user mode: boot -s from the loader prompt).
59# 6. `mergemaster -p'
60# 7. `make installworld'
61# 8. `make delete-old'
62# 9. `mergemaster' (you may wish to use -U or -ai).
63# 10. `reboot'
64# 11. `make delete-old-libs' (in case no 3rd party program uses them anymore)
65#
66# See src/UPDATING `COMMON ITEMS' for more complete information.
67#
68# If TARGET=machine (e.g. ia64, sparc64, ...) is specified you can
69# cross build world for other machine types using the buildworld target,
70# and once the world is built you can cross build a kernel using the
71# buildkernel target.
72#
73# Define the user-driven targets. These are listed here in alphabetical
74# order, but that's not important.
75#
76# Targets that begin with underscore are internal targets intended for
77# developer convenience only. They are intentionally not documented and
78# completely subject to change without notice.
79#
80# For more information, see the build(7) manual page.
81#
82TGTS= all all-man buildenv buildenvvars buildkernel buildworld \
83 check-old check-old-dirs check-old-files check-old-libs \
84 checkdpadd clean cleandepend cleandir \
85 delete-old delete-old-dirs delete-old-files delete-old-libs \
86 depend distribute distributeworld distrib-dirs distribution doxygen \
87 everything hierarchy install installcheck installkernel \
88 installkernel.debug reinstallkernel reinstallkernel.debug \
89 installworld kernel-toolchain libraries lint maninstall \
90 obj objlink regress rerelease showconfig tags toolchain update \
91 _worldtmp _legacy _bootstrap-tools _cleanobj _obj \
92 _build-tools _cross-tools _includes _libraries _depend \
93 build32 builddtb distribute32 install32 xdev xdev-build xdev-install \
94
95TGTS+= ${SUBDIR_TARGETS}
96
97BITGTS= files includes
98BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
99TGTS+= ${BITGTS}
100
101.ORDER: buildworld installworld
102.ORDER: buildworld distributeworld
103.ORDER: buildworld buildkernel
104.ORDER: buildkernel installkernel
105.ORDER: buildkernel installkernel.debug
106.ORDER: buildkernel reinstallkernel
107.ORDER: buildkernel reinstallkernel.debug
108
109PATH= /sbin:/bin:/usr/sbin:/usr/bin
110MAKEOBJDIRPREFIX?= /usr/obj
111_MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} \
112 ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \
113 -f /dev/null -V MAKEOBJDIRPREFIX dummy
114.if !empty(_MAKEOBJDIRPREFIX)
115.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\
116 (in make.conf(5)) or command-line variable.
117.endif
118MAKEPATH= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}
119BINMAKE= \
120 `if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \
121 -m ${.CURDIR}/share/mk
122_MAKE= PATH=${PATH} ${BINMAKE} -f Makefile.inc1
123
124#
125# Make sure we have an up-to-date make(1). Only world and buildworld
126# should do this as those are the initial targets used for upgrades.
127# The user can define ALWAYS_CHECK_MAKE to have this check performed
128# for all targets.
129#
130.if defined(ALWAYS_CHECK_MAKE)
131${TGTS}: upgrade_checks
132.else
133buildworld: upgrade_checks
134.endif
135
136#
137# This 'cleanworld' target is not included in TGTS, because it is not a
138# recursive target. All of the work for it is done right here. It is
139# expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be
140# created by bsd.obj.mk, except that we don't want to .include that file
141# in this makefile.
142#
143# In the following, the first 'rm' in a series will usually remove all
144# files and directories. If it does not, then there are probably some
145# files with chflags set, so this unsets them and tries the 'rm' a
146# second time. There are situations where this target will be cleaning
147# some directories via more than one method, but that duplication is
148# needed to correctly handle all the possible situations.
149#
150BW_CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR}
151cleanworld:
152.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR}
153.if exists(${BW_CANONICALOBJDIR}/)
154 -rm -rf ${BW_CANONICALOBJDIR}/*
155 -chflags -R 0 ${BW_CANONICALOBJDIR}
156 rm -rf ${BW_CANONICALOBJDIR}/*
157.endif
158 # To be safe in this case, fall back to a 'make cleandir'
159 ${_+_}@cd ${.CURDIR}; ${_MAKE} cleandir
160.else
161 -rm -rf ${.OBJDIR}/*
162 -chflags -R 0 ${.OBJDIR}
163 rm -rf ${.OBJDIR}/*
164.endif
165
166#
167# Handle the user-driven targets, using the source relative mk files.
168#
169
170${TGTS}:
171 ${_+_}@cd ${.CURDIR}; \
172 ${_MAKE} ${.TARGET}
173
174# Set a reasonable default
175.MAIN: all
176
177STARTTIME!= LC_ALL=C date
178CHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0
179.if !empty(CHECK_TIME)
180.error check your date/time: ${STARTTIME}
181.endif
182
183.if defined(HISTORICAL_MAKE_WORLD) || defined(DESTDIR)
184#
185# world
186#
187# Attempt to rebuild and reinstall everything. This target is not to be
188# used for upgrading an existing FreeBSD system, because the kernel is
189# not included. One can argue that this target doesn't build everything
190# then.
191#
192world: upgrade_checks
193 @echo "--------------------------------------------------------------"
194 @echo ">>> make world started on ${STARTTIME}"
195 @echo "--------------------------------------------------------------"
196.if target(pre-world)
197 @echo
198 @echo "--------------------------------------------------------------"
199 @echo ">>> Making 'pre-world' target"
200 @echo "--------------------------------------------------------------"
201 ${_+_}@cd ${.CURDIR}; ${_MAKE} pre-world
202.endif
203 ${_+_}@cd ${.CURDIR}; ${_MAKE} buildworld
204 ${_+_}@cd ${.CURDIR}; ${_MAKE} -B installworld
205.if target(post-world)
206 @echo
207 @echo "--------------------------------------------------------------"
208 @echo ">>> Making 'post-world' target"
209 @echo "--------------------------------------------------------------"
210 ${_+_}@cd ${.CURDIR}; ${_MAKE} post-world
211.endif
212 @echo
213 @echo "--------------------------------------------------------------"
214 @echo ">>> make world completed on `LC_ALL=C date`"
215 @echo " (started ${STARTTIME})"
216 @echo "--------------------------------------------------------------"
217.else
218world:
219 @echo "WARNING: make world will overwrite your existing FreeBSD"
220 @echo "installation without also building and installing a new"
221 @echo "kernel. This can be dangerous. Please read the handbook,"
222 @echo "'Rebuilding world', for how to upgrade your system."
223 @echo "Define DESTDIR to where you want to install FreeBSD,"
224 @echo "including /, to override this warning and proceed as usual."
225 @echo ""
226 @echo "Bailing out now..."
227 @false
228.endif
229
230#
231# kernel
232#
233# Short hand for `make buildkernel installkernel'
234#
235kernel: buildkernel installkernel
236
237#
238# Perform a few tests to determine if the installed tools are adequate
239# for building the world.
240#
241upgrade_checks:
242 @if ! (cd ${.CURDIR}/tools/build/make_check && \
243 PATH=${PATH} ${BINMAKE} obj >/dev/null 2>&1 && \
244 PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \
245 then \
246 (cd ${.CURDIR} && ${MAKE} make); \
247 fi
248
249#
250# Upgrade make(1) to the current version using the installed
251# headers, libraries and tools. Also, allow the location of
252# the system bsdmake-like utility to be overridden.
253#
254MMAKEENV= MAKEOBJDIRPREFIX=${MAKEPATH} \
255 DESTDIR= \
256 INSTALL="sh ${.CURDIR}/tools/install.sh"
257MMAKE= ${MMAKEENV} ${MAKE} \
258 -D_UPGRADING \
259 -DNOMAN -DNO_MAN -DNOSHARED -DNO_SHARED \
260 -DNO_CPU_CFLAGS -DNO_WERROR
261
262make: .PHONY
263 @echo
264 @echo "--------------------------------------------------------------"
265 @echo ">>> Building an up-to-date make(1)"
266 @echo "--------------------------------------------------------------"
267 ${_+_}@cd ${.CURDIR}/usr.bin/make; \
268 ${MMAKE} obj && \
269 ${MMAKE} depend && \
270 ${MMAKE} all && \
271 ${MMAKE} install DESTDIR=${MAKEPATH} BINDIR=
272
273tinderbox:
274 cd ${.CURDIR} && \
275 DOING_TINDERBOX=YES ${MAKE} JFLAG=${JFLAG} universe
276
277#
278# universe
279#
280# Attempt to rebuild *everything* for all supported architectures,
281# with a reasonable chance of success, regardless of how old your
282# existing system is.
283#
284.if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets)
285TARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64 sun4v
286TARGET_ARCHES_arm?= arm armeb
287TARGET_ARCHES_mips?= mipsel mipseb mips64el mips64eb
288TARGET_ARCHES_powerpc?= powerpc powerpc64
289TARGET_ARCHES_pc98?= i386
290TARGET_ARCHES_sun4v?= sparc64
291.for target in ${TARGETS}
292TARGET_ARCHES_${target}?= ${target}
293.endfor
294
295targets:
296 @echo "Supported TARGET/TARGET_ARCH pairs"
297.for target in ${TARGETS}
298.for target_arch in ${TARGET_ARCHES_${target}}
299 @echo " ${target}/${target_arch}"
300.endfor
301.endfor
302
303.if defined(DOING_TINDERBOX)
304FAILFILE=tinderbox.failed
305MAKEFAIL=tee -a ${FAILFILE}
306.else
307MAKEFAIL=cat
308.endif
309
310universe: universe_prologue
311universe_prologue:
312 @echo "--------------------------------------------------------------"
313 @echo ">>> make universe started on ${STARTTIME}"
314 @echo "--------------------------------------------------------------"
315.if defined(DOING_TINDERBOX)
316 rm -f ${FAILFILE}
317.endif
318.for target in ${TARGETS}
319universe: universe_${target}
320.ORDER: universe_prologue universe_${target} universe_epilogue
321universe_${target}: universe_${target}_prologue
322universe_${target}_prologue:
323 @echo ">> ${target} started on `LC_ALL=C date`"
324.if !defined(MAKE_JUST_KERNELS)
325.for target_arch in ${TARGET_ARCHES_${target}}
326universe_${target}: universe_${target}_${target_arch}
327universe_${target}_${target_arch}: universe_${target}_prologue
328 @echo ">> ${target}.${target_arch} buildworld started on `LC_ALL=C date`"
329 @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
330 ${MAKE} ${JFLAG} buildworld \
331 TARGET=${target} \
332 TARGET_ARCH=${target_arch} \
333 > _.${target}.${target_arch}.buildworld 2>&1 || \
334 (echo "${target}.${target_arch} world failed," \
335 "check _.${target}.${target_arch}.buildworld for details" | \
336 ${MAKEFAIL}))
337 @echo ">> ${target}.${target_arch} buildworld completed on `LC_ALL=C date`"
338.endfor
339.endif
340.if !defined(MAKE_JUST_WORLDS)
341.if exists(${.CURDIR}/sys/${target}/conf/NOTES)
342 @(cd ${.CURDIR}/sys/${target}/conf && env __MAKE_CONF=/dev/null \
343 ${MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
344 (echo "${target} 'make LINT' failed," \
345 "check _.${target}.makeLINT for details"| ${MAKEFAIL}))
346.endif
347 @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} TARGET=${target} \
348 universe_kernels
349.endif
350 @echo ">> ${target} completed on `LC_ALL=C date`"
351.endfor
352universe_kernels: universe_kernconfs
353.if !defined(TARGET)
354TARGET!= uname -m
355.endif
356KERNCONFS!= cd ${.CURDIR}/sys/${TARGET}/conf && \
357 find [A-Z0-9]*[A-Z0-9] -type f -maxdepth 0 \
358 ! -name DEFAULTS ! -name NOTES
359universe_kernconfs:
360.for kernel in ${KERNCONFS}
361TARGET_ARCH_${kernel}!= cd ${.CURDIR}/sys/${TARGET}/conf && \
362 config -m ${.CURDIR}/sys/${TARGET}/conf/${kernel} 2> /dev/null | \
363 grep -v WARNING: | cut -f 2
364.if empty(TARGET_ARCH_${kernel})
365.error "Target architecture for ${TARGET}/conf/${kernel} unknown. config(8) likely too old."
366.endif
367universe_kernconfs: universe_kernconf_${TARGET}_${kernel}
368universe_kernconf_${TARGET}_${kernel}:
369 @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
370 ${MAKE} ${JFLAG} buildkernel \
371 TARGET=${TARGET} \
372 TARGET_ARCH=${TARGET_ARCH_${kernel}} \
373 KERNCONF=${kernel} \
374 > _.${TARGET}.${kernel} 2>&1 || \
375 (echo "${TARGET} ${kernel} kernel failed," \
376 "check _.${TARGET}.${kernel} for details"| ${MAKEFAIL}))
377.endfor
378universe: universe_epilogue
379universe_epilogue:
380 @echo "--------------------------------------------------------------"
381 @echo ">>> make universe completed on `LC_ALL=C date`"
382 @echo " (started ${STARTTIME})"
383 @echo "--------------------------------------------------------------"
384.if defined(DOING_TINDERBOX)
385 @if [ -e ${FAILFILE} ] ; then \
386 echo "Tinderbox failed:" ;\
387 cat ${FAILFILE} ;\
388 exit 1 ;\
389 fi
390.endif
391.endif
41#
42# If you want to build your system from source be sure that /usr/obj has
43# at least 800MB of diskspace available.
44#
45# For individuals wanting to build from the sources currently on their
46# system, the simple instructions are:
47#
48# 1. `cd /usr/src' (or to the directory containing your source tree).
49# 2. Define `HISTORICAL_MAKE_WORLD' variable (see README).
50# 3. `make world'
51#
52# For individuals wanting to upgrade their sources (even if only a
53# delta of a few days):
54#
55# 1. `cd /usr/src' (or to the directory containing your source tree).
56# 2. `make buildworld'
57# 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC).
58# 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC).
59# [steps 3. & 4. can be combined by using the "kernel" target]
60# 5. `reboot' (in single user mode: boot -s from the loader prompt).
61# 6. `mergemaster -p'
62# 7. `make installworld'
63# 8. `make delete-old'
64# 9. `mergemaster' (you may wish to use -U or -ai).
65# 10. `reboot'
66# 11. `make delete-old-libs' (in case no 3rd party program uses them anymore)
67#
68# See src/UPDATING `COMMON ITEMS' for more complete information.
69#
70# If TARGET=machine (e.g. ia64, sparc64, ...) is specified you can
71# cross build world for other machine types using the buildworld target,
72# and once the world is built you can cross build a kernel using the
73# buildkernel target.
74#
75# Define the user-driven targets. These are listed here in alphabetical
76# order, but that's not important.
77#
78# Targets that begin with underscore are internal targets intended for
79# developer convenience only. They are intentionally not documented and
80# completely subject to change without notice.
81#
82# For more information, see the build(7) manual page.
83#
84TGTS= all all-man buildenv buildenvvars buildkernel buildworld \
85 check-old check-old-dirs check-old-files check-old-libs \
86 checkdpadd clean cleandepend cleandir \
87 delete-old delete-old-dirs delete-old-files delete-old-libs \
88 depend distribute distributeworld distrib-dirs distribution doxygen \
89 everything hierarchy install installcheck installkernel \
90 installkernel.debug reinstallkernel reinstallkernel.debug \
91 installworld kernel-toolchain libraries lint maninstall \
92 obj objlink regress rerelease showconfig tags toolchain update \
93 _worldtmp _legacy _bootstrap-tools _cleanobj _obj \
94 _build-tools _cross-tools _includes _libraries _depend \
95 build32 builddtb distribute32 install32 xdev xdev-build xdev-install \
96
97TGTS+= ${SUBDIR_TARGETS}
98
99BITGTS= files includes
100BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
101TGTS+= ${BITGTS}
102
103.ORDER: buildworld installworld
104.ORDER: buildworld distributeworld
105.ORDER: buildworld buildkernel
106.ORDER: buildkernel installkernel
107.ORDER: buildkernel installkernel.debug
108.ORDER: buildkernel reinstallkernel
109.ORDER: buildkernel reinstallkernel.debug
110
111PATH= /sbin:/bin:/usr/sbin:/usr/bin
112MAKEOBJDIRPREFIX?= /usr/obj
113_MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} \
114 ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \
115 -f /dev/null -V MAKEOBJDIRPREFIX dummy
116.if !empty(_MAKEOBJDIRPREFIX)
117.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\
118 (in make.conf(5)) or command-line variable.
119.endif
120MAKEPATH= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}
121BINMAKE= \
122 `if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \
123 -m ${.CURDIR}/share/mk
124_MAKE= PATH=${PATH} ${BINMAKE} -f Makefile.inc1
125
126#
127# Make sure we have an up-to-date make(1). Only world and buildworld
128# should do this as those are the initial targets used for upgrades.
129# The user can define ALWAYS_CHECK_MAKE to have this check performed
130# for all targets.
131#
132.if defined(ALWAYS_CHECK_MAKE)
133${TGTS}: upgrade_checks
134.else
135buildworld: upgrade_checks
136.endif
137
138#
139# This 'cleanworld' target is not included in TGTS, because it is not a
140# recursive target. All of the work for it is done right here. It is
141# expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be
142# created by bsd.obj.mk, except that we don't want to .include that file
143# in this makefile.
144#
145# In the following, the first 'rm' in a series will usually remove all
146# files and directories. If it does not, then there are probably some
147# files with chflags set, so this unsets them and tries the 'rm' a
148# second time. There are situations where this target will be cleaning
149# some directories via more than one method, but that duplication is
150# needed to correctly handle all the possible situations.
151#
152BW_CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR}
153cleanworld:
154.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR}
155.if exists(${BW_CANONICALOBJDIR}/)
156 -rm -rf ${BW_CANONICALOBJDIR}/*
157 -chflags -R 0 ${BW_CANONICALOBJDIR}
158 rm -rf ${BW_CANONICALOBJDIR}/*
159.endif
160 # To be safe in this case, fall back to a 'make cleandir'
161 ${_+_}@cd ${.CURDIR}; ${_MAKE} cleandir
162.else
163 -rm -rf ${.OBJDIR}/*
164 -chflags -R 0 ${.OBJDIR}
165 rm -rf ${.OBJDIR}/*
166.endif
167
168#
169# Handle the user-driven targets, using the source relative mk files.
170#
171
172${TGTS}:
173 ${_+_}@cd ${.CURDIR}; \
174 ${_MAKE} ${.TARGET}
175
176# Set a reasonable default
177.MAIN: all
178
179STARTTIME!= LC_ALL=C date
180CHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0
181.if !empty(CHECK_TIME)
182.error check your date/time: ${STARTTIME}
183.endif
184
185.if defined(HISTORICAL_MAKE_WORLD) || defined(DESTDIR)
186#
187# world
188#
189# Attempt to rebuild and reinstall everything. This target is not to be
190# used for upgrading an existing FreeBSD system, because the kernel is
191# not included. One can argue that this target doesn't build everything
192# then.
193#
194world: upgrade_checks
195 @echo "--------------------------------------------------------------"
196 @echo ">>> make world started on ${STARTTIME}"
197 @echo "--------------------------------------------------------------"
198.if target(pre-world)
199 @echo
200 @echo "--------------------------------------------------------------"
201 @echo ">>> Making 'pre-world' target"
202 @echo "--------------------------------------------------------------"
203 ${_+_}@cd ${.CURDIR}; ${_MAKE} pre-world
204.endif
205 ${_+_}@cd ${.CURDIR}; ${_MAKE} buildworld
206 ${_+_}@cd ${.CURDIR}; ${_MAKE} -B installworld
207.if target(post-world)
208 @echo
209 @echo "--------------------------------------------------------------"
210 @echo ">>> Making 'post-world' target"
211 @echo "--------------------------------------------------------------"
212 ${_+_}@cd ${.CURDIR}; ${_MAKE} post-world
213.endif
214 @echo
215 @echo "--------------------------------------------------------------"
216 @echo ">>> make world completed on `LC_ALL=C date`"
217 @echo " (started ${STARTTIME})"
218 @echo "--------------------------------------------------------------"
219.else
220world:
221 @echo "WARNING: make world will overwrite your existing FreeBSD"
222 @echo "installation without also building and installing a new"
223 @echo "kernel. This can be dangerous. Please read the handbook,"
224 @echo "'Rebuilding world', for how to upgrade your system."
225 @echo "Define DESTDIR to where you want to install FreeBSD,"
226 @echo "including /, to override this warning and proceed as usual."
227 @echo ""
228 @echo "Bailing out now..."
229 @false
230.endif
231
232#
233# kernel
234#
235# Short hand for `make buildkernel installkernel'
236#
237kernel: buildkernel installkernel
238
239#
240# Perform a few tests to determine if the installed tools are adequate
241# for building the world.
242#
243upgrade_checks:
244 @if ! (cd ${.CURDIR}/tools/build/make_check && \
245 PATH=${PATH} ${BINMAKE} obj >/dev/null 2>&1 && \
246 PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \
247 then \
248 (cd ${.CURDIR} && ${MAKE} make); \
249 fi
250
251#
252# Upgrade make(1) to the current version using the installed
253# headers, libraries and tools. Also, allow the location of
254# the system bsdmake-like utility to be overridden.
255#
256MMAKEENV= MAKEOBJDIRPREFIX=${MAKEPATH} \
257 DESTDIR= \
258 INSTALL="sh ${.CURDIR}/tools/install.sh"
259MMAKE= ${MMAKEENV} ${MAKE} \
260 -D_UPGRADING \
261 -DNOMAN -DNO_MAN -DNOSHARED -DNO_SHARED \
262 -DNO_CPU_CFLAGS -DNO_WERROR
263
264make: .PHONY
265 @echo
266 @echo "--------------------------------------------------------------"
267 @echo ">>> Building an up-to-date make(1)"
268 @echo "--------------------------------------------------------------"
269 ${_+_}@cd ${.CURDIR}/usr.bin/make; \
270 ${MMAKE} obj && \
271 ${MMAKE} depend && \
272 ${MMAKE} all && \
273 ${MMAKE} install DESTDIR=${MAKEPATH} BINDIR=
274
275tinderbox:
276 cd ${.CURDIR} && \
277 DOING_TINDERBOX=YES ${MAKE} JFLAG=${JFLAG} universe
278
279#
280# universe
281#
282# Attempt to rebuild *everything* for all supported architectures,
283# with a reasonable chance of success, regardless of how old your
284# existing system is.
285#
286.if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets)
287TARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64 sun4v
288TARGET_ARCHES_arm?= arm armeb
289TARGET_ARCHES_mips?= mipsel mipseb mips64el mips64eb
290TARGET_ARCHES_powerpc?= powerpc powerpc64
291TARGET_ARCHES_pc98?= i386
292TARGET_ARCHES_sun4v?= sparc64
293.for target in ${TARGETS}
294TARGET_ARCHES_${target}?= ${target}
295.endfor
296
297targets:
298 @echo "Supported TARGET/TARGET_ARCH pairs"
299.for target in ${TARGETS}
300.for target_arch in ${TARGET_ARCHES_${target}}
301 @echo " ${target}/${target_arch}"
302.endfor
303.endfor
304
305.if defined(DOING_TINDERBOX)
306FAILFILE=tinderbox.failed
307MAKEFAIL=tee -a ${FAILFILE}
308.else
309MAKEFAIL=cat
310.endif
311
312universe: universe_prologue
313universe_prologue:
314 @echo "--------------------------------------------------------------"
315 @echo ">>> make universe started on ${STARTTIME}"
316 @echo "--------------------------------------------------------------"
317.if defined(DOING_TINDERBOX)
318 rm -f ${FAILFILE}
319.endif
320.for target in ${TARGETS}
321universe: universe_${target}
322.ORDER: universe_prologue universe_${target} universe_epilogue
323universe_${target}: universe_${target}_prologue
324universe_${target}_prologue:
325 @echo ">> ${target} started on `LC_ALL=C date`"
326.if !defined(MAKE_JUST_KERNELS)
327.for target_arch in ${TARGET_ARCHES_${target}}
328universe_${target}: universe_${target}_${target_arch}
329universe_${target}_${target_arch}: universe_${target}_prologue
330 @echo ">> ${target}.${target_arch} buildworld started on `LC_ALL=C date`"
331 @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
332 ${MAKE} ${JFLAG} buildworld \
333 TARGET=${target} \
334 TARGET_ARCH=${target_arch} \
335 > _.${target}.${target_arch}.buildworld 2>&1 || \
336 (echo "${target}.${target_arch} world failed," \
337 "check _.${target}.${target_arch}.buildworld for details" | \
338 ${MAKEFAIL}))
339 @echo ">> ${target}.${target_arch} buildworld completed on `LC_ALL=C date`"
340.endfor
341.endif
342.if !defined(MAKE_JUST_WORLDS)
343.if exists(${.CURDIR}/sys/${target}/conf/NOTES)
344 @(cd ${.CURDIR}/sys/${target}/conf && env __MAKE_CONF=/dev/null \
345 ${MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
346 (echo "${target} 'make LINT' failed," \
347 "check _.${target}.makeLINT for details"| ${MAKEFAIL}))
348.endif
349 @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} TARGET=${target} \
350 universe_kernels
351.endif
352 @echo ">> ${target} completed on `LC_ALL=C date`"
353.endfor
354universe_kernels: universe_kernconfs
355.if !defined(TARGET)
356TARGET!= uname -m
357.endif
358KERNCONFS!= cd ${.CURDIR}/sys/${TARGET}/conf && \
359 find [A-Z0-9]*[A-Z0-9] -type f -maxdepth 0 \
360 ! -name DEFAULTS ! -name NOTES
361universe_kernconfs:
362.for kernel in ${KERNCONFS}
363TARGET_ARCH_${kernel}!= cd ${.CURDIR}/sys/${TARGET}/conf && \
364 config -m ${.CURDIR}/sys/${TARGET}/conf/${kernel} 2> /dev/null | \
365 grep -v WARNING: | cut -f 2
366.if empty(TARGET_ARCH_${kernel})
367.error "Target architecture for ${TARGET}/conf/${kernel} unknown. config(8) likely too old."
368.endif
369universe_kernconfs: universe_kernconf_${TARGET}_${kernel}
370universe_kernconf_${TARGET}_${kernel}:
371 @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
372 ${MAKE} ${JFLAG} buildkernel \
373 TARGET=${TARGET} \
374 TARGET_ARCH=${TARGET_ARCH_${kernel}} \
375 KERNCONF=${kernel} \
376 > _.${TARGET}.${kernel} 2>&1 || \
377 (echo "${TARGET} ${kernel} kernel failed," \
378 "check _.${TARGET}.${kernel} for details"| ${MAKEFAIL}))
379.endfor
380universe: universe_epilogue
381universe_epilogue:
382 @echo "--------------------------------------------------------------"
383 @echo ">>> make universe completed on `LC_ALL=C date`"
384 @echo " (started ${STARTTIME})"
385 @echo "--------------------------------------------------------------"
386.if defined(DOING_TINDERBOX)
387 @if [ -e ${FAILFILE} ] ; then \
388 echo "Tinderbox failed:" ;\
389 cat ${FAILFILE} ;\
390 exit 1 ;\
391 fi
392.endif
393.endif