Bring in recent mktemp(1) changes from FreeBSD
[dragonfly.git] / Makefile.inc1
CommitLineData
984263bc
MD
1#
2# $FreeBSD: src/Makefile.inc1,v 1.141.2.62 2003/04/06 19:54:00 dwmalone Exp $
cecff5c1
MD
3#
4# Build-time options are documented in make.conf(5).
984263bc
MD
5#
6# The intended user-driven targets are:
1397f94a 7#
984263bc 8# buildworld - rebuild *everything*, including glue to help do upgrades
1397f94a
MD
9# quickworld - skip the glue and do a depend+build on the meat
10# realquickworld - skip the glue and depend stages and just build the meat
11# crossworld - only build the glue (particularly the cross-build environment)
984263bc 12# installworld- install everything built by "buildworld"
984263bc
MD
13# most - build user commands, no libraries or include files
14# installmost - install user commands, no libraries or include files
15#
16# Standard targets (not defined here) are documented in the makefiles in
17# /usr/share/mk. These include:
18# obj depend all install clean cleandepend cleanobj
19
20# Put initial settings here.
21SUBDIR=
22
23# We must do share/info early so that installation of info `dir'
24# entries works correctly. Do it first since it is less likely to
25# grow dependencies on include and lib than vice versa.
26.if exists(${.CURDIR}/share/info)
27SUBDIR+= share/info
28.endif
29
30# We must do include and lib early so that the perl *.ph generation
31# works correctly as it uses the header files installed by this.
32.if exists(${.CURDIR}/include)
33SUBDIR+= include
34.endif
35.if exists(${.CURDIR}/lib)
36SUBDIR+= lib
37.endif
17d0fefe
MD
38# This exists simply to ensure that the obj dir hierarchy is
39# intact for nrelease, allowing the nrelease Makefile's to
40# reference ${.OBJDIR}.
41#
42.if exists(${.CURDIR}/nrelease)
43SUBDIR+= nrelease
44.endif
984263bc
MD
45
46.if exists(${.CURDIR}/bin)
47SUBDIR+= bin
48.endif
cecff5c1 49.if exists(${.CURDIR}/games) && !defined(NO_GAMES)
984263bc
MD
50SUBDIR+= games
51.endif
52.if exists(${.CURDIR}/gnu)
53SUBDIR+= gnu
54.endif
984263bc
MD
55.if exists(${.CURDIR}/libexec)
56SUBDIR+= libexec
57.endif
58.if exists(${.CURDIR}/sbin)
59SUBDIR+= sbin
60.endif
cecff5c1 61.if exists(${.CURDIR}/secure) && !defined(NO_CRYPT)
984263bc
MD
62SUBDIR+= secure
63.endif
cecff5c1 64.if exists(${.CURDIR}/share) && !defined(NO_SHARE)
984263bc
MD
65SUBDIR+= share
66.endif
67.if exists(${.CURDIR}/sys)
68SUBDIR+= sys
69.endif
70.if exists(${.CURDIR}/usr.bin)
71SUBDIR+= usr.bin
72.endif
73.if exists(${.CURDIR}/usr.sbin)
74SUBDIR+= usr.sbin
75.endif
76
984263bc
MD
77.if exists(${.CURDIR}/etc)
78SUBDIR+= etc
79.endif
80
81# These are last, since it is nice to at least get the base system
82# rebuilt before you do them.
83.if defined(LOCAL_DIRS)
84.for _DIR in ${LOCAL_DIRS}
85.if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile)
86SUBDIR+= ${_DIR}
87.endif
88.endfor
89.endif
90
91.if defined(SUBDIR_OVERRIDE)
92SUBDIR= ${SUBDIR_OVERRIDE}
93.endif
94
95.if defined(NOCLEANDIR)
96CLEANDIR= clean cleandepend
97.else
98CLEANDIR= cleandir
99.endif
100
9974d917
SS
101.if defined(NO_CLEAN)
102NOCLEAN= # defined
103.endif
d0a8f509 104
1397f94a
MD
105# Object directory base in primary make. Note that when we rerun make
106# from inside this file we change MAKEOBJDIRPREFIX to the appropriate
107# subdirectory because the rest of the build system needs it that way.
108# The original object directory base is saved in OBJTREE.
109#
984263bc 110MAKEOBJDIRPREFIX?= /usr/obj
1397f94a
MD
111OBJTREE?= ${MAKEOBJDIRPREFIX}
112
113# Used for stage installs and pathing
114#
115DESTDIRBASE?= ${OBJTREE}${.CURDIR}
116
c89fd520
SS
117# Remove DESTDIR from MAKEFLAGS. It is present in the environment
118# anyhow, and we need to be able to override it for stage installs
119.MAKEFLAGS:= ${.MAKEFLAGS:NDESTDIR=*}
120
0756733f
JM
121# This section sets the tools used to build the world/kernel
122WORLD_CCVER?= gcc44
123WORLD_LDVER?= ld.bfd
e685772e 124WORLD_BINUTILSVER?= binutils222
ded5c503 125
b2b3ffcd
SS
126# temporary until everybody has converted to x86_64
127.if ${MACHINE_ARCH} == "amd64"
128MACHINE_ARCH= x86_64
3da8e88f
JM
129.if defined(.PARSEDIR)
130.export MACHINE_ARCH
131.else
132# LEGACY MAKE - REMOVE FOR DFLY 3.6
b2b3ffcd
SS
133.makeenv MACHINE_ARCH
134.endif
3da8e88f 135.endif
b2b3ffcd 136
984263bc
MD
137TARGET_ARCH?= ${MACHINE_ARCH}
138.if ${TARGET_ARCH} == ${MACHINE_ARCH}
139TARGET?= ${MACHINE}
140.else
141TARGET?= ${TARGET_ARCH}
142.endif
143.if make(buildworld)
144BUILD_ARCH!= sysctl -n hw.machine_arch
b2b3ffcd
SS
145
146# temporary until everybody has converted to x86_64
147.if ${BUILD_ARCH} == "amd64"
148BUILD_ARCH= x86_64
149.endif
150
984263bc
MD
151.if ${MACHINE_ARCH} != ${BUILD_ARCH}
152.error To cross-build, set TARGET_ARCH.
153.endif
154.endif
1397f94a 155
0955fd91
MD
156# Backwards compatibility with older make's or older sys.mk's. make
157# is expected to define MACHINE_PLATFORM.
158#
159.if !defined(MACHINE_PLATFORM)
160MACHINE_PLATFORM= pc32
161.endif
4d005c1d
SS
162
163# XXX this is ugly and we need to come up with a nicer solution
164.if !defined(TARGET_PLATFORM)
165.if ${TARGET_ARCH} == "i386"
166TARGET_PLATFORM= pc32
b2b3ffcd 167.elif ${TARGET_ARCH} == "x86_64"
4d005c1d
SS
168TARGET_PLATFORM= pc64
169.else
170.error Unknown target architecture.
171.endif
172.endif
0955fd91 173
5f87b7d3
SZ
174THREAD_LIB?= thread_xu
175.if ${THREAD_LIB} == "c_r"
176.if defined(NO_LIBC_R)
177.error libc_r is chosen as the default thread library, but NO_LIBC_R is defined
178.endif
179.endif
180
1397f94a
MD
181# BTOOLS (Natively built) All non-cross-development tools that the
182# main build needs. This includes things like 'mkdir' and 'rm'.
183# We will not use the native system's exec path once we start
184# on WORLD. (bootstrap-tools and build-tools or BTOOLS)
185#
186# CTOOLS (Natively built) Cross development tools which are specific
187# to the target architecture.
188#
189# WORLD (Cross built) Our ultimate buildworld, using only BTOOLS and
190# CTOOLS.
191#
0955fd91
MD
192# MACHINE_PLATFORM Platform Architecture we are building on
193# MACHINE Machine Architecture (usually the same as MACHINE_ARCH)
e2ea6619
MD
194# MACHINE_ARCH Cpu Architecture we are building on
195#
0955fd91
MD
196# TARGET_PLATFORM Platform Architecture we are building for
197# TARGET Machine Architecture we are building for
e2ea6619 198# TARGET_ARCH Cpu Architecture we are building for
1397f94a
MD
199#
200BTOOLSDEST= ${DESTDIRBASE}/btools_${MACHINE_ARCH}
201CTOOLSDEST= ${DESTDIRBASE}/ctools_${MACHINE_ARCH}_${TARGET_ARCH}
202WORLDDEST= ${DESTDIRBASE}/world_${TARGET_ARCH}
203
79aa78bc
MD
204# The bootstrap-tools path is used by the bootstrap-tools, build-tools, and
205# cross-tools stages to augment the existing command path to access newer
206# versions of certain utilities such as 'patch' that the cross-tools stage
207# might expect.
208#
209BTOOLSPATH= ${BTOOLSDEST}/usr/sbin:${BTOOLSDEST}/usr/bin:${BTOOLSDEST}/bin:${BTOOLSDEST}/usr/games
210
1397f94a
MD
211# The strict temporary command path contains all binaries required
212# by the buildworld system after the cross-tools stage.
213#
21e43067 214STRICTTMPPATH= ${CTOOLSDEST}/usr/sbin:${CTOOLSDEST}/usr/bin:${CTOOLSDEST}/bin:${CTOOLSDEST}/usr/games:${BTOOLSDEST}/usr/sbin:${BTOOLSDEST}/usr/bin:${BTOOLSDEST}/bin:${BTOOLSDEST}/usr/games:/usr/pkg/bin
984263bc
MD
215
216TMPDIR?= /tmp
217TMPPID!= echo $$$$
984263bc
MD
218
219#
220# Building a world goes through the following stages
221#
222# 1. bootstrap-tool stage [BMAKE]
223# This stage is responsible for creating programs that
224# are needed for backward compatibility reasons. They
225# are not built as cross-tools.
226# 2. build-tool stage [TMAKE]
227# This stage is responsible for creating the object
228# tree and building any tools that are needed during
229# the build process.
230# 3. cross-tool stage [XMAKE]
231# This stage is responsible for creating any tools that
232# are needed for cross-builds. A cross-compiler is one
233# of them.
234# 4. world stage [WMAKE]
235# This stage actually builds the world.
236# 5. install stage (optional) [IMAKE]
237# This stage installs a previously built world.
238#
239
984263bc 240# bootstrap-tool stage
1397f94a
MD
241#
242BMAKEENV= MAKEOBJDIRPREFIX=${BTOOLSDEST} \
243 OBJTREE=${OBJTREE} \
44831353 244 DESTDIR=${BTOOLSDEST} \
79aa78bc 245 PATH=${BTOOLSPATH}:${PATH} \
984263bc 246 INSTALL="sh ${.CURDIR}/tools/install.sh"
1397f94a 247
f8a75064 248BMAKE= ${BMAKEENV} make -f Makefile.inc1 -DBOOTSTRAPPING \
e486d225
SS
249 -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED \
250 -DNO_WERROR -DNO_NLS
984263bc
MD
251
252# build-tool stage
1397f94a
MD
253#
254TMAKEENV= MAKEOBJDIRPREFIX=${BTOOLSDEST} \
255 OBJTREE=${OBJTREE} \
984263bc 256 DESTDIR= \
79aa78bc 257 PATH=${BTOOLSPATH}:${PATH} \
984263bc 258 INSTALL="sh ${.CURDIR}/tools/install.sh"
1397f94a 259
f8a75064 260TMAKE= ${TMAKEENV} make -f Makefile.inc1 -DBOOTSTRAPPING \
e486d225 261 -DNO_FORTRAN -DNOSHARED
984263bc
MD
262
263# cross-tool stage
1397f94a
MD
264#
265# note: TOOLS_PREFIX points to the obj root holding the cross
44831353
MD
266# compiler binaries, while USRDATA_PREFIX points to the obj root
267# holding the target environment (and also determines where cross-built
268# libraries, crt*.o, and include files are installed).
1397f94a
MD
269#
270XMAKEENV= MAKEOBJDIRPREFIX=${CTOOLSDEST} \
271 OBJTREE=${OBJTREE} \
272 DESTDIR=${CTOOLSDEST} \
273 INSTALL="sh ${.CURDIR}/tools/install.sh" \
274 TOOLS_PREFIX=${CTOOLSDEST} \
79aa78bc
MD
275 USRDATA_PREFIX=${WORLDDEST} \
276 PATH=${BTOOLSPATH}:${PATH}
1397f94a 277
f8a75064 278XMAKE= ${XMAKEENV} make -f Makefile.inc1 -DNO_FORTRAN -DNO_GDB \
e486d225 279 -DBOOTSTRAPPING -DNOSHARED
1397f94a
MD
280
281# world stage, note the strict path and note that TOOLS_PREFIX is left
282# unset and USRDATA_PREFIX (which defaults to TOOLS_PREFIX) is set to empty,
283# which is primarily for the compiler so it targets / (e.g. /usr/<blah>)
284# for both binary and library paths, even though it is being compiled to
285# WORLDDEST. None of the programs in the world stage are ever actually
286# executed during the buildworld/installworld.
287#
288CROSSENV= MAKEOBJDIRPREFIX=${WORLDDEST} \
289 OBJTREE=${OBJTREE} \
290 MACHINE_ARCH=${TARGET_ARCH} \
291 MACHINE=${TARGET} \
0955fd91 292 MACHINE_PLATFORM=${TARGET_PLATFORM} \
ded5c503 293 OBJFORMAT_PATH=${CTOOLSDEST} \
ce6fa878 294 HOST_CCVER=${HOST_CCVER} \
123dec51 295 CCVER=${WORLD_CCVER} \
0756733f 296 LDVER=${WORLD_LDVER} \
123dec51 297 BINUTILSVER=${WORLD_BINUTILSVER}
984263bc 298
984263bc 299WMAKEENV= ${CROSSENV} \
1397f94a 300 DESTDIR=${WORLDDEST} \
984263bc 301 INSTALL="sh ${.CURDIR}/tools/install.sh" \
1397f94a
MD
302 PATH=${STRICTTMPPATH}
303
f8a75064 304WMAKE= ${WMAKEENV} make -f Makefile.inc1
984263bc
MD
305
306# install stage
b07b69cc 307#
984263bc 308IMAKEENV= ${CROSSENV} \
1397f94a 309 PATH=${STRICTTMPPATH}
f8a75064 310IMAKE= ${IMAKEENV} make -f Makefile.inc1
984263bc
MD
311
312# kernel stage
b07b69cc
MD
313#
314KMAKEENV= ${WMAKEENV}
984263bc 315
984263bc
MD
316# buildworld
317#
318# Attempt to rebuild the entire system, with reasonable chance of
319# success, regardless of how old your existing system is.
320#
2cde9453
SS
321_worldtmp: _cleantmp _mtreetmp
322.ORDER: _cleantmp _mtreetmp
323
324_cleantmp:
984263bc
MD
325 @echo
326 @echo "--------------------------------------------------------------"
327 @echo ">>> Rebuilding the temporary build tree"
328 @echo "--------------------------------------------------------------"
329.if !defined(NOCLEAN)
1397f94a 330 rm -rf ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST}
984263bc
MD
331.else
332 # XXX - These two can depend on any header file.
333 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
334 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
335.endif
2cde9453
SS
336
337_mtreetmp:
1397f94a
MD
338 mkdir -p ${DESTDIRBASE} ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST}
339.for _dir in ${WORLDDEST} ${BTOOLSDEST} ${CTOOLSDEST}
340 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
341 -p ${_dir}/ > /dev/null
342 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
343 -p ${_dir}/usr > /dev/null
984263bc 344.endfor
1397f94a
MD
345 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
346 -p ${WORLDDEST}/usr/include > /dev/null
062db326 347 ${LN} -sf ${.CURDIR}/sys ${WORLDDEST}
1397f94a 348
984263bc
MD
349_bootstrap-tools:
350 @echo
351 @echo "--------------------------------------------------------------"
352 @echo ">>> stage 1: bootstrap tools"
353 @echo "--------------------------------------------------------------"
354 cd ${.CURDIR}; ${BMAKE} bootstrap-tools
355_cleanobj:
984263bc
MD
356 @echo
357 @echo "--------------------------------------------------------------"
1397f94a 358 @echo ">>> stage 2a: cleaning up the object tree"
984263bc
MD
359 @echo "--------------------------------------------------------------"
360 cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
984263bc
MD
361_obj:
362 @echo
363 @echo "--------------------------------------------------------------"
1397f94a 364 @echo ">>> stage 2b: rebuilding the object tree"
984263bc
MD
365 @echo "--------------------------------------------------------------"
366 cd ${.CURDIR}; ${WMAKE} par-obj
367_build-tools:
368 @echo
369 @echo "--------------------------------------------------------------"
1397f94a 370 @echo ">>> stage 2c: build tools"
984263bc
MD
371 @echo "--------------------------------------------------------------"
372 cd ${.CURDIR}; ${TMAKE} build-tools
373_cross-tools:
374 @echo
375 @echo "--------------------------------------------------------------"
376 @echo ">>> stage 3: cross tools"
377 @echo "--------------------------------------------------------------"
378 cd ${.CURDIR}; ${XMAKE} cross-tools
379_includes:
380 @echo
381 @echo "--------------------------------------------------------------"
1397f94a 382 @echo ">>> stage 4a: populating ${WORLDDEST}/usr/include"
984263bc
MD
383 @echo "--------------------------------------------------------------"
384 cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
385_libraries:
386 @echo
387 @echo "--------------------------------------------------------------"
1397f94a 388 @echo ">>> stage 4b: building libraries"
984263bc
MD
389 @echo "--------------------------------------------------------------"
390 cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries
391_depend:
392 @echo
393 @echo "--------------------------------------------------------------"
1397f94a 394 @echo ">>> stage 4c: make dependencies"
984263bc
MD
395 @echo "--------------------------------------------------------------"
396 cd ${.CURDIR}; ${WMAKE} par-depend
397everything:
398 @echo
399 @echo "--------------------------------------------------------------"
1397f94a 400 @echo ">>> stage 4d: building everything.."
984263bc
MD
401 @echo "--------------------------------------------------------------"
402 cd ${.CURDIR}; ${WMAKE} all
403
1397f94a
MD
404# note: buildworld no longer depends on _cleanobj because we rm -rf the
405# entire object tree and built the bootstrap tools in a different location.
406#
407# buildworld - build everything from scratch
408# quickworld - skip the bootstrap, build, and cross-build steps
409# realquickworld - skip the bootstrap, build, crossbuild, and depend step.
410#
411# note: we include _obj in realquickworld to prevent accidental creation
412# of files in /usr/src.
984263bc 413
c08b39fe 414WMAKE_TGTS=
984263bc
MD
415.if !defined(SUBDIR_OVERRIDE)
416WMAKE_TGTS+= _worldtmp _bootstrap-tools
417.endif
1397f94a 418WMAKE_TGTS+= _obj _build-tools
984263bc
MD
419.if !defined(SUBDIR_OVERRIDE)
420WMAKE_TGTS+= _cross-tools
421.endif
422WMAKE_TGTS+= _includes _libraries _depend everything
423
424buildworld: ${WMAKE_TGTS}
1397f94a 425
2cde9453 426quickworld: _mtreetmp _obj _includes _libraries _depend everything
1397f94a 427
2cde9453 428realquickworld: _mtreetmp _obj _includes _libraries everything
1397f94a
MD
429
430crossworld: _worldtmp _bootstrap-tools _obj _build-tools _cross-tools
431
984263bc 432.ORDER: ${WMAKE_TGTS}
9ce30817 433.ORDER: _obj _includes
2cde9453 434.ORDER: _mtreetmp _obj
984263bc
MD
435
436#
437# installcheck
438#
c08b39fe 439# Checks to be sure system is ready for installworld
984263bc
MD
440#
441installcheck:
442.if !defined(NO_SENDMAIL)
3da8e88f
JM
443 @pw usershow smmsp || (echo "You may need to run 'make preupgrade' first"; /usr/bin/false)
444 @pw groupshow smmsp || (echo "You may need to run 'make preupgrade' first"; /usr/bin/false)
984263bc 445.endif
3da8e88f
JM
446 @pw usershow _pflogd || (echo "You may need to run 'make preupgrade' first"; /usr/bin/false)
447 @pw groupshow authpf || (echo "You may need to run 'make preupgrade' first"; /usr/bin/false)
448 @pw groupshow _pflogd || (echo "You may need to run 'make preupgrade' first"; /usr/bin/false)
9b815a46 449.if !defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/"
3da8e88f 450 @case `uname -r` in 1.2*|1.3-*|1.3.*|1.4.*|1.5.0-*|1.5.1-*|1.5.2-*|1.5.3-*) echo "You must upgrade your kernel to at least 1.5.4 and reboot before you can safely installworld, due to libc/system call ABI changes" ; /usr/bin/false ; esac
9b815a46 451.endif
984263bc
MD
452#
453# installworld
454#
455# Installs everything compiled by a 'buildworld'.
456#
5cccfb7b 457installworld: installcheck
984263bc 458 cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
ec6483ce 459 ${INSTALL} -o root -g wheel -m 644 ${.CURDIR}/Makefile_upgrade.inc ${DESTDIR}/etc/upgrade/
984263bc
MD
460
461#
462# reinstall
463#
464# If you have a build server, you can NFS mount the source and obj directories
465# and do a 'make reinstall' on the *client* to install new binaries from the
466# most recent server build.
467#
468reinstall:
469 @echo "--------------------------------------------------------------"
470 @echo ">>> Making hierarchy"
471 @echo "--------------------------------------------------------------"
f8a75064 472 cd ${.CURDIR}; make -f Makefile.inc1 hierarchy
984263bc
MD
473 @echo
474 @echo "--------------------------------------------------------------"
475 @echo ">>> Installing everything.."
476 @echo "--------------------------------------------------------------"
f8a75064 477 cd ${.CURDIR}; make -f Makefile.inc1 install
984263bc 478
984263bc 479#
fc7aca3e 480# buildkernel, nativekernel, quickkernel, and installkernel
984263bc
MD
481#
482# Which kernels to build and/or install is specified by setting
483# KERNCONF. If not defined a GENERIC kernel is built/installed.
484# Only the existing (depending TARGET) config files are used
485# for building kernels and only the first of these is designated
486# as the one being installed.
487#
c2c83759
MD
488# You can specify INSTALLSTRIPPED=1 if you wish the installed
489# kernel and modules to be stripped of its debug info (required
490# symbols are left intact). You can specify INSTALLSTRIPPEDMODULES
491# if you only want to strip the modules of their debug info. These
492# only apply if you have DEBUG=-g in your kernel config or make line.
493#
984263bc
MD
494# Note that we have to use TARGET instead of TARGET_ARCH when
495# we're in kernel-land. Since only TARGET_ARCH is (expected) to
496# be set to cross-build, we have to make sure TARGET is set
497# properly.
498
499.if !defined(KERNCONF) && defined(KERNEL)
500KERNCONF= ${KERNEL}
501KERNWARN= yes
502.else
702a95cc
SS
503# XXX makeshift fix to build the right kernel for the (target) architecture
504# We should configure this in the platform files somehow
505.if ${TARGET_ARCH} == "i386"
984263bc 506KERNCONF?= GENERIC
702a95cc 507.else
b2b3ffcd 508KERNCONF?= X86_64_GENERIC
702a95cc 509.endif
984263bc
MD
510.endif
511INSTKERNNAME?= kernel
512
513KRNLSRCDIR= ${.CURDIR}/sys
4e54470f 514KRNLCONFDIR= ${KRNLSRCDIR}/config
984263bc
MD
515KRNLOBJDIR= ${OBJTREE}${KRNLSRCDIR}
516KERNCONFDIR?= ${KRNLCONFDIR}
517
518BUILDKERNELS=
519INSTALLKERNEL=
520.for _kernel in ${KERNCONF}
521.if exists(${KERNCONFDIR}/${_kernel})
522BUILDKERNELS+= ${_kernel}
523.if empty(INSTALLKERNEL)
524INSTALLKERNEL= ${_kernel}
525.endif
526.endif
527.endfor
528
9a359590
MD
529# kernel version numbers survive rm -rf
530#
531.for _kernel in ${BUILDKERNELS}
532.if exists(${KRNLOBJDIR}/${_kernel}/version)
533KERNEL_VERSION_${_kernel} != cat ${KRNLOBJDIR}/${_kernel}/version
534.endif
535.endfor
536
984263bc
MD
537#
538# buildkernel
539#
540# Builds all kernels defined by BUILDKERNELS.
541#
fc7aca3e 542bk_tools:
e05c8c84
MD
543 @if [ ! -f ${WORLDDEST}/.libraries_done ]; then \
544 echo "You must buildworld before buildkernel. If you wish"; \
545 echo "to build a kernel using native tools, config it manually"; \
546 echo "or use the nativekernel target if you are in a rush"; \
3da8e88f 547 /usr/bin/false; \
c2c83759
MD
548 fi
549
550maybe_bk_tools:
551.for _kernel in ${BUILDKERNELS}
552 @if [ ! -f ${KRNLOBJDIR}/${_kernel}/.nativekernel_run ]; then \
553 if [ ! -f ${WORLDDEST}/.libraries_done ]; then \
554 echo "The kernel was build using buildworld tools which no" ; \
555 echo "longer appear to exist, quickkernel failed!" ; \
3da8e88f 556 /usr/bin/false; \
c2c83759
MD
557 fi; \
558 fi
559.endfor
e05c8c84 560
fc7aca3e 561bk_build_list:
984263bc
MD
562.if empty(BUILDKERNELS)
563 @echo ">>> ERROR: Missing kernel configuration file(s) (${KERNCONF})."
603cdb58 564 @echo ">>> Did you move your kernel configs from i386/conf to config/?"
984263bc
MD
565 @false
566.endif
fc7aca3e
MD
567
568bk_kernwarn:
984263bc
MD
569.if defined(KERNWARN)
570 @echo "--------------------------------------------------------------"
571 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
572 @echo "--------------------------------------------------------------"
573 @sleep 3
574.endif
575 @echo
fc7aca3e
MD
576
577# The buildkernel target rebuilds the specified kernels from scratch
578# using the crossbuild tools generated by the last buildworld. It is
579# the safest (but also the most time consuming) way to build a new kernel.
580#
581buildkernel: bk_tools bk_build_list bk_kernwarn
984263bc
MD
582.for _kernel in ${BUILDKERNELS}
583 @echo "--------------------------------------------------------------"
584 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
585 @echo "--------------------------------------------------------------"
586 @echo "===> ${_kernel}"
fc7aca3e
MD
587.if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
588 rm -rf ${KRNLOBJDIR}/${_kernel}
589.else
e05c8c84 590 @if [ -f ${KRNLOBJDIR}/${_kernel}/.nativekernel_run ]; then \
fc7aca3e 591 echo "YOU ARE REBUILDING WITH BUILDKERNEL, REMOVING OLD NATIVEKERNEL BUILD"; \
e05c8c84 592 rm -rf ${KRNLOBJDIR}/${_kernel}; fi
fc7aca3e 593.endif
984263bc
MD
594 mkdir -p ${KRNLOBJDIR}
595.if !defined(NO_KERNELCONFIG)
596 cd ${KRNLCONFDIR}; \
1397f94a 597 PATH=${STRICTTMPPATH} \
f8a75064 598 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
984263bc 599 ${KERNCONFDIR}/${_kernel}
9a359590
MD
600.endif
601.if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) && defined(KERNEL_VERSION_${_kernel})
602 echo ${KERNEL_VERSION_${_kernel}} > ${KRNLOBJDIR}/${_kernel}/version
984263bc 603.endif
e05c8c84 604 touch ${KRNLOBJDIR}/${_kernel}/.buildkernel_run
984263bc
MD
605.if !defined(NO_KERNELDEPEND)
606 cd ${KRNLOBJDIR}/${_kernel}; \
f8a75064 607 ${KMAKEENV} make KERNEL=${INSTKERNNAME} depend
984263bc
MD
608.endif
609 cd ${KRNLOBJDIR}/${_kernel}; \
f8a75064 610 ${KMAKEENV} make KERNEL=${INSTKERNNAME} all
984263bc
MD
611 @echo "--------------------------------------------------------------"
612 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
613 @echo "--------------------------------------------------------------"
614.endfor
615
fc7aca3e 616# The nativekernel target rebuilds the specified kernels from scratch
114580ac 617# using the system's standard compiler rather than using the crossbuild
fc7aca3e
MD
618# tools generated by the last buildworld. This is fairly safe if your
619# system is reasonable up-to-date.
e05c8c84 620#
fc7aca3e 621nativekernel: bk_build_list bk_kernwarn
e05c8c84
MD
622.for _kernel in ${BUILDKERNELS}
623 @echo "--------------------------------------------------------------"
624 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
625 @echo "--------------------------------------------------------------"
626 @echo "===> ${_kernel}"
fc7aca3e
MD
627.if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
628 rm -rf ${KRNLOBJDIR}/${_kernel}
629.else
e05c8c84 630 @if [ -f ${KRNLOBJDIR}/${_kernel}/.buildkernel_run ]; then \
fc7aca3e 631 echo "YOU ARE REBUILDING WITH NATIVEKERNEL, REMOVING OLD BUILDKERNEL BUILD"; \
e05c8c84 632 rm -rf ${KRNLOBJDIR}/${_kernel}; fi
fc7aca3e 633.endif
e05c8c84
MD
634 mkdir -p ${KRNLOBJDIR}
635.if !defined(NO_KERNELCONFIG)
636 cd ${KRNLCONFDIR}; \
637 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
638 ${KERNCONFDIR}/${_kernel}
9a359590
MD
639.endif
640.if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) && defined(KERNEL_VERSION_${_kernel})
641 echo ${KERNEL_VERSION_${_kernel}} > ${KRNLOBJDIR}/${_kernel}/version
e05c8c84
MD
642.endif
643 touch ${KRNLOBJDIR}/${_kernel}/.nativekernel_run
e05c8c84
MD
644 cd ${KRNLOBJDIR}/${_kernel}; \
645 MAKESRCPATH=${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm \
f8a75064 646 make -DBOOTSTRAPPING -f ${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm/Makefile
e05c8c84
MD
647.if !defined(NO_KERNELDEPEND)
648 cd ${KRNLOBJDIR}/${_kernel}; \
f8a75064 649 make KERNEL=${INSTKERNNAME} depend
e05c8c84
MD
650.endif
651 cd ${KRNLOBJDIR}/${_kernel}; \
f8a75064 652 make KERNEL=${INSTKERNNAME} all
e05c8c84
MD
653 @echo "--------------------------------------------------------------"
654 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
655 @echo "--------------------------------------------------------------"
656.endfor
657
fc7aca3e
MD
658# The quickkernel target rebuilds the specified kernels as quickly
659# as possible. It will use the native tools or the buildworld cross tools
660# based on whether the kernel was originally generated via buildkernel or
661# nativekernel. Config is rerun but the object hierarchy is not rebuilt,
662# nor is the make depend step run.
984263bc 663#
c2c83759 664quickkernel: maybe_bk_tools bk_build_list bk_kernwarn
fc7aca3e
MD
665.for _kernel in ${BUILDKERNELS}
666 @echo "--------------------------------------------------------------"
667 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
668 @echo "--------------------------------------------------------------"
669 @echo "===> ${_kernel}"
670.if exists(${KRNLOBJDIR}/${_kernel}/.buildkernel_run)
671.if !defined(NO_KERNELCONFIG)
672 cd ${KRNLCONFDIR}; \
673 PATH=${STRICTTMPPATH} \
f8a75064 674 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
fc7aca3e
MD
675 ${KERNCONFDIR}/${_kernel}
676.endif
677 cd ${KRNLOBJDIR}/${_kernel}; \
f8a75064 678 ${KMAKEENV} make KERNEL=${INSTKERNNAME} all
fc7aca3e
MD
679.else
680.if !defined(NO_KERNELCONFIG)
681 cd ${KRNLCONFDIR}; \
682 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
683 ${KERNCONFDIR}/${_kernel}
684.endif
685 cd ${KRNLOBJDIR}/${_kernel}; \
f8a75064 686 make KERNEL=${INSTKERNNAME} all
fc7aca3e
MD
687.endif
688 @echo "--------------------------------------------------------------"
689 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
690 @echo "--------------------------------------------------------------"
691.endfor
692
693
984263bc
MD
694# installkernel
695#
696# Install the kernel defined by INSTALLKERNEL
697#
698installkernel reinstallkernel:
982b0507
MD
699 @echo "--------------------------------------------------------------"
700 @echo ">>> Kernel install for ${INSTALLKERNEL} started on `LC_ALL=C date`"
701 @echo "--------------------------------------------------------------"
702.if exists(${KRNLOBJDIR}/${INSTALLKERNEL}/.buildkernel_run)
984263bc 703 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
f8a75064 704 ${IMAKEENV} make KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
c2c83759
MD
705.else
706 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
f8a75064 707 make KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
c2c83759 708.endif
984263bc 709
984263bc
MD
710#
711# most
712#
713# Build most of the user binaries on the existing system libs and includes.
714#
715most:
716 @echo "--------------------------------------------------------------"
717 @echo ">>> Building programs only"
718 @echo "--------------------------------------------------------------"
719.for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin
f8a75064 720 cd ${.CURDIR}/${_dir}; make DIRPRFX=${_dir}/ all
984263bc
MD
721.endfor
722
723#
724# installmost
725#
726# Install the binaries built by the 'most' target. This does not include
727# libraries or include files.
728#
729installmost:
730 @echo "--------------------------------------------------------------"
731 @echo ">>> Installing programs only"
732 @echo "--------------------------------------------------------------"
733.for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin
f8a75064 734 cd ${.CURDIR}/${_dir}; make DIRPRFX=${_dir}/ install
984263bc
MD
735.endfor
736
737#
738# ------------------------------------------------------------------------
739#
740# From here onwards are utility targets used by the 'make world' and
741# related targets. If your 'world' breaks, you may like to try to fix
742# the problem and manually run the following targets to attempt to
743# complete the build. Beware, this is *not* guaranteed to work, you
744# need to have a pretty good grip on the current state of the system
745# to attempt to manually finish it. If in doubt, 'make world' again.
746#
747
79aa78bc
MD
748# bootstrap-tools: Build all tools required to build all tools. Note that
749# order is important in a number of cases and also note that the bootstrap
750# and build tools stages have access to earlier binaries they themselves
751# had generated.
984263bc 752#
79aa78bc
MD
753# patch: older patch's do not have -i. This program must be built
754# first so other bootstrap tools that need to apply patches
755# can use it.
17030342
MD
756# [x]install: dependancies on various new install features
757# rpcgen: old rpcgen used a hardwired cpp path, newer OBJFORMAT_PATH
758# envs are not compatible with older objformat binaries.
759#
cecff5c1 760.if exists(${.CURDIR}/games) && !defined(NO_GAMES)
984263bc
MD
761_strfile= games/fortune/strfile
762.endif
763
d2e9c9d8
MD
764BSTRAPDIRS= ${_strfile} \
765 usr.bin/patch \
766 bin/chmod bin/cp bin/cpdup bin/dd bin/mkdir bin/rm bin/echo \
767 bin/test bin/cat bin/ln bin/mv bin/csh bin/expr bin/sh \
768 bin/hostname bin/kill \
769 usr.bin/yacc usr.bin/colldef usr.bin/uudecode usr.bin/xinstall \
3da8e88f 770 usr.bin/m4 usr.bin/rpcgen usr.bin/bmake usr.bin/awk usr.bin/stat \
d2e9c9d8
MD
771 usr.bin/find usr.bin/lex usr.bin/sed usr.bin/uname usr.bin/touch \
772 usr.bin/mkdep usr.bin/mktemp usr.bin/lorder usr.bin/file2c \
773 usr.bin/tsort usr.bin/tr usr.bin/join usr.bin/wc usr.bin/basename \
774 usr.bin/gencat usr.bin/chflags usr.bin/expand usr.bin/paste \
775 usr.bin/mklocale usr.bin/uuencode usr.bin/compile_et usr.bin/hexdump \
776 usr.bin/cap_mkdb usr.bin/true usr.bin/false \
777 usr.bin/cmp usr.bin/xargs usr.bin/id usr.bin/env usr.bin/dirname \
8c4a123d 778 usr.bin/tail usr.bin/unifdef usr.bin/tic \
d2e9c9d8
MD
779 usr.sbin/chown usr.sbin/mtree usr.sbin/config \
780 usr.sbin/btxld usr.sbin/zic usr.sbin/makewhatis \
781 gnu/usr.bin/texinfo gnu/usr.bin/grep usr.bin/sort \
782 usr.bin/gzip usr.bin/bzip2 usr.bin/mkcsmapper usr.bin/mkesdb
783
784bootstrap-tools: bootstrap-tools-before bootstrap-tools-targets
785 touch ${BTOOLSDEST}/.bootstrap_done
786
787bootstrap-tools-before:
062db326 788 ${LN} -fs /bin/date ${BTOOLSDEST}/bin/date
d2e9c9d8
MD
789
790bootstrap-tools-targets: ${BSTRAPDIRS:S/^/bstrap-/}
791
792.ORDER: bootstrap-tools-before bootstrap-tools-targets
793
794.for _tool in ${BSTRAPDIRS}
795bstrap-${_tool}!
1397f94a 796 ${ECHODIR} "===> ${_tool} (bootstrap-tools)"; \
984263bc 797 cd ${.CURDIR}/${_tool}; \
f8a75064
JM
798 make DIRPRFX=${_tool}/ obj; \
799 make DIRPRFX=${_tool}/ depend; \
800 make DIRPRFX=${_tool}/ all; \
801 make DIRPRFX=${_tool}/ DESTDIR=${BTOOLSDEST} install
984263bc
MD
802.endfor
803
bceb727e 804# build-tools: Build special purpose build tools.
984263bc 805#
1397f94a
MD
806# XXX we may be able to remove or consolidate this into bootstrap-tools
807# now that we have the native helper (.nx/.no) infrastructure.
808#
cecff5c1 809.if exists(${.CURDIR}/share) && !defined(NO_SHARE)
984263bc
MD
810_share= share/syscons/scrnmaps
811.endif
812
f0140465
JM
813_gcc_common_cross= gnu/usr.bin/gmp gnu/usr.bin/mpfr
814_gcc44_cross= gnu/usr.bin/cc44
4f5ea479 815_gcc44_tools= gnu/usr.bin/cc44/cc_prep gnu/usr.bin/cc44/cc_tools
f0140465 816.if !defined(NO_GCC47)
ce38cc15 817_gcc47_cross= lib/libz gnu/usr.bin/mpc gnu/usr.bin/cc47
f0140465
JM
818_gcc47_tools= gnu/usr.bin/cc47/cc_prep gnu/usr.bin/cc47/cc_tools
819.endif
c97b9141 820_custom_cross= libexec/customcc
123dec51 821_binutils= gnu/usr.bin/${WORLD_BINUTILSVER}
17030342 822
f0140465 823BTOOLSDIRS= ${_gcc44_tools} ${_gcc47_tools} ${_share}
d2e9c9d8
MD
824
825build-tools: build-tools-targets
826 touch ${BTOOLSDEST}/.build_done
827
828build-tools-targets: ${BTOOLSDIRS:S/^/btools-/}
829
9ba72882 830.ORDER: ${_gcc44_tools:S/^/btools-/}
f0140465 831.ORDER: ${_gcc47_tools:S/^/btools-/}
9ba72882 832
d2e9c9d8
MD
833.for _tool in ${BTOOLSDIRS}
834btools-${_tool}!
1397f94a 835 ${ECHODIR} "===> ${_tool} (build-tools)"; \
984263bc 836 cd ${.CURDIR}/${_tool}; \
f8a75064
JM
837 make DIRPRFX=${_tool}/ obj; \
838 make DIRPRFX=${_tool}/ depend; \
839 make DIRPRFX=${_tool}/ all; \
840 make DIRPRFX=${_tool}/ DESTDIR=${BTOOLSDEST} install
984263bc
MD
841.endfor
842
843#
844# cross-tools: Build cross-building tools
845#
984263bc
MD
846.if ${TARGET_ARCH} == "i386" && ${MACHINE_ARCH} != "i386"
847_btxld= usr.sbin/btxld
848.endif
849
f0140465
JM
850CTOOLSDIRS= ${_btxld} ${_binutils} usr.bin/objformat ${_gcc_common_cross} \
851 ${_gcc44_cross} ${_gcc47_cross} ${_custom_cross}
d2e9c9d8
MD
852
853cross-tools: cross-tools-targets
854 touch ${CTOOLSDEST}/.cross_done
855
856cross-tools-targets: ${CTOOLSDIRS:S/^/ctools-/}
857
858.for _tool in ${CTOOLSDIRS}
859ctools-${_tool}!
1397f94a 860 ${ECHODIR} "===> ${_tool} (cross-tools)"; \
984263bc 861 cd ${.CURDIR}/${_tool}; \
f8a75064
JM
862 make DIRPRFX=${_tool}/ obj; \
863 make DIRPRFX=${_tool}/ depend; \
864 make DIRPRFX=${_tool}/ all; \
865 make DIRPRFX=${_tool}/ DESTDIR=${CTOOLSDEST} install
984263bc
MD
866.endfor
867
868#
869# hierarchy - ensure that all the needed directories are present
870#
871hierarchy:
f8a75064 872 cd ${.CURDIR}/etc; make distrib-dirs
984263bc
MD
873
874#
875# libraries - build all libraries, and install them under ${DESTDIR}.
876#
877# The list of libraries with dependents (${_prebuild_libs}) and their
878# interdependencies (__L) are built automatically by the
879# ${.CURDIR}/tools/make_libdeps.sh script.
880#
5228fe46
MD
881# .makeenv does not work when bootstrapping from 4.x, so we must be sure
882# to specify the correct CCVER or 'cc' will not exec the correct compiler.
883#
984263bc 884libraries:
f0140465 885.if !defined(NO_GCC47)
ddf7cc86 886 cd ${.CURDIR}; \
f0140465 887 HOST_CCVER=${HOST_CCVER} CCVER=gcc47 \
f8a75064 888 make -f Makefile.inc1 _startup_libs47;
30c91f0c 889.endif
4f5ea479
SS
890 cd ${.CURDIR}; \
891 HOST_CCVER=${HOST_CCVER} CCVER=gcc44 \
f8a75064 892 make -f Makefile.inc1 _startup_libs44;
29d48e65 893 cd ${.CURDIR}; \
f8a75064
JM
894 make -f Makefile.inc1 _startup_libs; \
895 make -f Makefile.inc1 _prebuild_libs; \
896 make -f Makefile.inc1 _generic_libs;
e05c8c84 897 touch ${WORLDDEST}/.libraries_done
984263bc
MD
898
899# These dependencies are not automatically generated:
900#
fd8b66cd 901# gnu/lib/${CCVER}/libgcc and gnu/lib/${CCVER}/csu must be built before all
4f5ea479
SS
902# shared libraries for ELF. The target for _startup_libsXX is
903# specifically built using gccXX.
984263bc 904#
64ed7155
JM
905_startup_libs47= gnu/usr.bin/cc47/cc_prep \
906 gnu/usr.bin/cc47/cc_tools \
907 gnu/lib/gcc47/csu \
f0140465
JM
908 gnu/lib/gcc47/libgcc \
909 gnu/lib/gcc47/libgcc_eh \
910 gnu/lib/gcc47/libgcc_pic
64ed7155
JM
911_startup_libs44= gnu/usr.bin/cc44/cc_prep \
912 gnu/usr.bin/cc44/cc_tools \
913 gnu/lib/gcc44/csu \
914 gnu/lib/gcc44/libgcc
e1da6819 915_startup_libs= lib/csu lib/libc lib/libc_rtld
984263bc 916
59392a00 917_prebuild_libs= lib/libbz2 lib/liblzma lib/libz
0b153c05 918_prebuild_libs+= lib/libutil
984263bc
MD
919
920_generic_libs= gnu/lib
921
984263bc 922_prebuild_libs+= lib/libcom_err lib/libcrypt lib/libmd \
7d1ab061 923 lib/libncurses/libncurses lib/libopie lib/libradius \
48d67717 924 lib/libsbuf lib/libtacplus lib/libm \
9f95f3e0 925 lib/libpam lib/libypclnt lib/lib${THREAD_LIB} \
3d91d947 926 lib/libpthread lib/libprop lib/libdevattr
984263bc
MD
927
928lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L
984263bc
MD
929
930_generic_libs+= lib
931
cecff5c1 932.if !defined(NO_CRYPT)
984263bc
MD
933.if !defined(NO_OPENSSL)
934_prebuild_libs+= secure/lib/libcrypto secure/lib/libssl
935.if !defined(NO_OPENSSH)
936_prebuild_libs+= secure/lib/libssh
937secure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L
938.endif
939.endif
940_generic_libs+= secure/lib
941.endif
942
943_generic_libs+= usr.bin/lex/lib
944
f0140465 945.for _lib in ${_startup_libs44} ${_startup_libs47} \
4db2a28c 946 ${_startup_libs} ${_prebuild_libs} ${_generic_libs}
984263bc
MD
947${_lib}__L: .PHONY
948.if exists(${.CURDIR}/${_lib})
949 ${ECHODIR} "===> ${_lib}"; \
950 cd ${.CURDIR}/${_lib}; \
f8a75064
JM
951 make DIRPRFX=${_lib}/ depend; \
952 make DIRPRFX=${_lib}/ all; \
953 make DIRPRFX=${_lib}/ install
984263bc
MD
954.endif
955.endfor
956
957_startup_libs: ${_startup_libs:S/$/__L/}
f0140465 958_startup_libs47: ${_startup_libs47:S/$/__L/}
4f5ea479 959_startup_libs44: ${_startup_libs44:S/$/__L/}
984263bc
MD
960_prebuild_libs: ${_prebuild_libs:S/$/__L/}
961_generic_libs: ${_generic_libs:S/$/__L/}
962
1397f94a
MD
963# library targets must be ordered because there are inter-library
964# races (e.g. generation of tconfig.h)
965#
f0140465 966.ORDER: ${_startup_libs47:S/$/__L/}
4f5ea479 967.ORDER: ${_startup_libs44:S/$/__L/}
1397f94a
MD
968.ORDER: ${_startup_libs:S/$/__L/}
969.ORDER: ${_prebuild_libs:S/$/__L/}
970.ORDER: ${_generic_libs:S/$/__L/}
971
972.for __target in clean cleandepend cleandir obj depend includes
984263bc
MD
973.for entry in ${SUBDIR}
974${entry}.${__target}__D: .PHONY
975 @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
976 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
977 edir=${entry}.${MACHINE_ARCH}; \
978 cd ${.CURDIR}/$${edir}; \
979 else \
980 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
981 edir=${entry}; \
982 cd ${.CURDIR}/$${edir}; \
983 fi; \
f8a75064 984 make ${__target} DIRPRFX=${DIRPRFX}$${edir}/
984263bc
MD
985.endfor
986par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1397f94a 987.ORDER: ${SUBDIR:S/$/.${__target}__D/}
984263bc 988.endfor
1397f94a 989.ORDER: par-clean par-cleandepend par-cleandir par-obj par-depend par-includes
984263bc 990
cb0f1574
MD
991# The wmake target is used by /usr/bin/wmake to run make in a
992# world build environment.
993#
994wmake:
f8a75064 995 @echo '${WMAKEENV} make ${WMAKE_ARGS}'
cb0f1574 996
5c7da0d7
MD
997wmakeenv:
998 @echo '${WMAKEENV} /bin/sh'
999
1397f94a 1000bmake:
f8a75064 1001 @echo '${BMAKEENV} make ${BMAKE_ARGS}'
1397f94a 1002
17030342
MD
1003bmakeenv:
1004 @echo '${BMAKEENV} /bin/sh'
1005
1397f94a 1006tmake:
f8a75064 1007 @echo '${TMAKEENV} make ${TMAKE_ARGS}'
1397f94a 1008
17030342
MD
1009tmakeenv:
1010 @echo '${TMAKEENV} /bin/sh'
1011
66834c05 1012xmake:
f8a75064 1013 @echo '${XMAKEENV} make ${XMAKE_ARGS}'
66834c05
SS
1014
1015xmakeenv:
1016 @echo '${XMAKEENV} /bin/sh'
1017
3da8e88f
JM
1018# Take advantage of bmake error response
1019#
1020MAKE_PRINT_VAR_ON_ERROR= \
1021 .CURDIR \
1022 .OBJDIR \
1023 .MAKE \
1024 MAKE_VERSION \
1025 LD_LIBRARY_PATH \
1026 MACHINE_ARCH \
1027 MACHINE \
1028 MAKEFILE \
1029 .TARGETS \
1030 .ERROR_TARGET \
1031 .ERROR_META_FILE \
1032 .MAKE.LEVEL \
1033 .MAKE.MODE
1034
984263bc 1035.include <bsd.subdir.mk>