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