Fix a bug in 2.95.x prototypes that prevents us from building the world with
[dragonfly.git] / Makefile.inc1
... / ...
CommitLineData
1#
2# $FreeBSD: src/Makefile.inc1,v 1.141.2.62 2003/04/06 19:54:00 dwmalone Exp $
3# $DragonFly: src/Makefile.inc1,v 1.32 2004/06/20 20:49:45 joerg Exp $
4#
5# Make command line options:
6# -DMAKE_KERBEROS5 to build Kerberos5
7# -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
8# -DNOCLEAN do not clean at all
9# -DNOCRYPT will prevent building of crypt versions
10# -DNOMAN do not build the manual pages
11# -DNOPROFILE do not build profiled libraries
12# -DNOGAMES do not go into games subdir
13# -DNOSHARE do not go into share subdir
14# -DNOINFO do not make or install info files
15# -DNOLIBC_R do not build libc_r.
16# -DNO_FORTRAN do not build g77 and related libraries.
17# -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
18# -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
19# -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
20# -DNO_PORTSUPDATE do not update ports in ${MAKE} update
21# -DNO_DOCUPDATE do not update doc in ${MAKE} update
22# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
23# TARGET_ARCH="arch" to crossbuild world to a different arch
24#
25# The intended user-driven targets are:
26#
27# buildworld - rebuild *everything*, including glue to help do upgrades
28# quickworld - skip the glue and do a depend+build on the meat
29# realquickworld - skip the glue and depend stages and just build the meat
30# crossworld - only build the glue (particularly the cross-build environment)
31# installworld- install everything built by "buildworld"
32# update - convenient way to update your source tree (eg: sup/cvs)
33# most - build user commands, no libraries or include files
34# installmost - install user commands, no libraries or include files
35#
36# Standard targets (not defined here) are documented in the makefiles in
37# /usr/share/mk. These include:
38# obj depend all install clean cleandepend cleanobj
39
40# Put initial settings here.
41SUBDIR=
42
43# We must do share/info early so that installation of info `dir'
44# entries works correctly. Do it first since it is less likely to
45# grow dependencies on include and lib than vice versa.
46.if exists(${.CURDIR}/share/info)
47SUBDIR+= share/info
48.endif
49
50# We must do include and lib early so that the perl *.ph generation
51# works correctly as it uses the header files installed by this.
52.if exists(${.CURDIR}/include)
53SUBDIR+= include
54.endif
55.if exists(${.CURDIR}/lib)
56SUBDIR+= lib
57.endif
58# This exists simply to ensure that the obj dir hierarchy is
59# intact for nrelease, allowing the nrelease Makefile's to
60# reference ${.OBJDIR}.
61#
62.if exists(${.CURDIR}/nrelease)
63SUBDIR+= nrelease
64.endif
65
66.if exists(${.CURDIR}/bin)
67SUBDIR+= bin
68.endif
69.if exists(${.CURDIR}/games) && !defined(NOGAMES)
70SUBDIR+= games
71.endif
72.if exists(${.CURDIR}/gnu)
73SUBDIR+= gnu
74.endif
75.if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
76 !defined(NOCRYPT) && !defined(NO_OPENSSL) && defined(MAKE_KERBEROS5)
77SUBDIR+= kerberos5
78.endif
79.if exists(${.CURDIR}/libexec)
80SUBDIR+= libexec
81.endif
82.if exists(${.CURDIR}/sbin)
83SUBDIR+= sbin
84.endif
85.if exists(${.CURDIR}/secure) && !defined(NOCRYPT)
86SUBDIR+= secure
87.endif
88.if exists(${.CURDIR}/share) && !defined(NOSHARE)
89SUBDIR+= share
90.endif
91.if exists(${.CURDIR}/sys)
92SUBDIR+= sys
93.endif
94.if exists(${.CURDIR}/usr.bin)
95SUBDIR+= usr.bin
96.endif
97.if exists(${.CURDIR}/usr.sbin)
98SUBDIR+= usr.sbin
99.endif
100
101# etc must be last for "distribute" to work
102.if exists(${.CURDIR}/etc)
103SUBDIR+= etc
104.endif
105
106# These are last, since it is nice to at least get the base system
107# rebuilt before you do them.
108.if defined(LOCAL_DIRS)
109.for _DIR in ${LOCAL_DIRS}
110.if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile)
111SUBDIR+= ${_DIR}
112.endif
113.endfor
114.endif
115
116.if defined(SUBDIR_OVERRIDE)
117SUBDIR= ${SUBDIR_OVERRIDE}
118.endif
119
120.if defined(NOCLEANDIR)
121CLEANDIR= clean cleandepend
122.else
123CLEANDIR= cleandir
124.endif
125
126SUP?= /usr/local/bin/cvsup
127SUPFLAGS?= -g -L 2 -P -
128.if defined(SUPHOST)
129SUPFLAGS+= -h ${SUPHOST}
130.endif
131
132# Object directory base in primary make. Note that when we rerun make
133# from inside this file we change MAKEOBJDIRPREFIX to the appropriate
134# subdirectory because the rest of the build system needs it that way.
135# The original object directory base is saved in OBJTREE.
136#
137MAKEOBJDIRPREFIX?= /usr/obj
138OBJTREE?= ${MAKEOBJDIRPREFIX}
139
140# Used for stage installs and pathing
141#
142DESTDIRBASE?= ${OBJTREE}${.CURDIR}
143
144TARGET_ARCH?= ${MACHINE_ARCH}
145.if ${TARGET_ARCH} == ${MACHINE_ARCH}
146TARGET?= ${MACHINE}
147.else
148TARGET?= ${TARGET_ARCH}
149.endif
150.if make(buildworld)
151BUILD_ARCH!= sysctl -n hw.machine_arch
152.if ${MACHINE_ARCH} != ${BUILD_ARCH}
153.error To cross-build, set TARGET_ARCH.
154.endif
155.endif
156
157# BTOOLS (Natively built) All non-cross-development tools that the
158# main build needs. This includes things like 'mkdir' and 'rm'.
159# We will not use the native system's exec path once we start
160# on WORLD. (bootstrap-tools and build-tools or BTOOLS)
161#
162# CTOOLS (Natively built) Cross development tools which are specific
163# to the target architecture.
164#
165# WORLD (Cross built) Our ultimate buildworld, using only BTOOLS and
166# CTOOLS.
167#
168# MACHINE_ARCH Architecture we are building on
169# TARGET_ARCH Architecture we are building for
170#
171BTOOLSDEST= ${DESTDIRBASE}/btools_${MACHINE_ARCH}
172CTOOLSDEST= ${DESTDIRBASE}/ctools_${MACHINE_ARCH}_${TARGET_ARCH}
173WORLDDEST= ${DESTDIRBASE}/world_${TARGET_ARCH}
174
175# The strict temporary command path contains all binaries required
176# by the buildworld system after the cross-tools stage.
177#
178STRICTTMPPATH= ${CTOOLSDEST}/usr/sbin:${CTOOLSDEST}/usr/bin:${CTOOLSDEST}/bin:${CTOOLSDEST}/usr/games:${BTOOLSDEST}/usr/sbin:${BTOOLSDEST}/usr/bin:${BTOOLSDEST}/bin:${BTOOLSDEST}/usr/games
179
180TMPDIR?= /tmp
181TMPPID!= echo $$$$
182
183#
184# Building a world goes through the following stages
185#
186# 1. bootstrap-tool stage [BMAKE]
187# This stage is responsible for creating programs that
188# are needed for backward compatibility reasons. They
189# are not built as cross-tools.
190# 2. build-tool stage [TMAKE]
191# This stage is responsible for creating the object
192# tree and building any tools that are needed during
193# the build process.
194# 3. cross-tool stage [XMAKE]
195# This stage is responsible for creating any tools that
196# are needed for cross-builds. A cross-compiler is one
197# of them.
198# 4. world stage [WMAKE]
199# This stage actually builds the world.
200# 5. install stage (optional) [IMAKE]
201# This stage installs a previously built world.
202#
203
204# bootstrap-tool stage
205#
206BMAKEENV= MAKEOBJDIRPREFIX=${BTOOLSDEST} \
207 OBJTREE=${OBJTREE} \
208 HOST_CCVER=${HOST_CCVER} \
209 DESTDIR=${BTOOLSDEST} \
210 INSTALL="sh ${.CURDIR}/tools/install.sh"
211
212BMAKE= ${BMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING \
213 -DNOHTML -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED \
214 -DNO_WERROR
215
216# build-tool stage
217#
218TMAKEENV= MAKEOBJDIRPREFIX=${BTOOLSDEST} \
219 OBJTREE=${OBJTREE} \
220 HOST_CCVER=${HOST_CCVER} \
221 DESTDIR= \
222 INSTALL="sh ${.CURDIR}/tools/install.sh"
223
224TMAKE= ${TMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING \
225 -DNO_FORTRAN
226
227# cross-tool stage
228#
229# note: TOOLS_PREFIX points to the obj root holding the cross
230# compiler binaries, while USRDATA_PREFIX points to the obj root
231# holding the target environment (and also determines where cross-built
232# libraries, crt*.o, and include files are installed).
233#
234XMAKEENV= MAKEOBJDIRPREFIX=${CTOOLSDEST} \
235 OBJTREE=${OBJTREE} \
236 HOST_CCVER=${HOST_CCVER} \
237 DESTDIR=${CTOOLSDEST} \
238 INSTALL="sh ${.CURDIR}/tools/install.sh" \
239 TOOLS_PREFIX=${CTOOLSDEST} \
240 USRDATA_PREFIX=${WORLDDEST}
241
242XMAKE= ${XMAKEENV} ${MAKE} -f Makefile.inc1 -DNO_FORTRAN -DNO_GDB \
243 -DBOOTSTRAPPING
244
245# world stage, note the strict path and note that TOOLS_PREFIX is left
246# unset and USRDATA_PREFIX (which defaults to TOOLS_PREFIX) is set to empty,
247# which is primarily for the compiler so it targets / (e.g. /usr/<blah>)
248# for both binary and library paths, even though it is being compiled to
249# WORLDDEST. None of the programs in the world stage are ever actually
250# executed during the buildworld/installworld.
251#
252CROSSENV= MAKEOBJDIRPREFIX=${WORLDDEST} \
253 OBJTREE=${OBJTREE} \
254 HOST_CCVER=${HOST_CCVER} \
255 MACHINE_ARCH=${TARGET_ARCH} \
256 MACHINE=${TARGET} \
257 OBJFORMAT_PATH=${CTOOLSDEST} \
258 PERL5LIB=${WORLDDEST}/usr/libdata/perl/5.00503 \
259 GROFF_BIN_PATH=${BTOOLSDEST}/usr/bin \
260 GROFF_FONT_PATH=${BTOOLSDEST}/usr/share/groff_font \
261 GROFF_TMAC_PATH=${BTOOLSDEST}/usr/share/tmac
262
263WMAKEENV= ${CROSSENV} \
264 DESTDIR=${WORLDDEST} \
265 INSTALL="sh ${.CURDIR}/tools/install.sh" \
266 PATH=${STRICTTMPPATH}
267
268WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1
269
270# install stage
271#
272IMAKEENV= ${CROSSENV} \
273 PATH=${STRICTTMPPATH}
274IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
275
276# kernel stage
277#
278KMAKEENV= ${WMAKEENV}
279
280# buildworld
281#
282# Attempt to rebuild the entire system, with reasonable chance of
283# success, regardless of how old your existing system is.
284#
285_worldtmp:
286 @echo
287 @echo "--------------------------------------------------------------"
288 @echo ">>> Rebuilding the temporary build tree"
289 @echo "--------------------------------------------------------------"
290.if !defined(NOCLEAN)
291 rm -rf ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST}
292.else
293 # XXX - These two can depend on any header file.
294 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
295 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
296.endif
297 mkdir -p ${DESTDIRBASE} ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST}
298.for _dir in ${WORLDDEST} ${BTOOLSDEST} ${CTOOLSDEST}
299 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
300 -p ${_dir}/ > /dev/null
301 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
302 -p ${_dir}/usr > /dev/null
303.endfor
304 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
305 -p ${WORLDDEST}/usr/include > /dev/null
306 ln -sf ${.CURDIR}/sys ${WORLDDEST}
307
308_bootstrap-tools:
309 @echo
310 @echo "--------------------------------------------------------------"
311 @echo ">>> stage 1: bootstrap tools"
312 @echo "--------------------------------------------------------------"
313 cd ${.CURDIR}; ${BMAKE} bootstrap-tools
314_cleanobj:
315 @echo
316 @echo "--------------------------------------------------------------"
317 @echo ">>> stage 2a: cleaning up the object tree"
318 @echo "--------------------------------------------------------------"
319 cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
320_obj:
321 @echo
322 @echo "--------------------------------------------------------------"
323 @echo ">>> stage 2b: rebuilding the object tree"
324 @echo "--------------------------------------------------------------"
325 cd ${.CURDIR}; ${WMAKE} par-obj
326_build-tools:
327 @echo
328 @echo "--------------------------------------------------------------"
329 @echo ">>> stage 2c: build tools"
330 @echo "--------------------------------------------------------------"
331 cd ${.CURDIR}; ${TMAKE} build-tools
332_cross-tools:
333 @echo
334 @echo "--------------------------------------------------------------"
335 @echo ">>> stage 3: cross tools"
336 @echo "--------------------------------------------------------------"
337 cd ${.CURDIR}; ${XMAKE} cross-tools
338_includes:
339 @echo
340 @echo "--------------------------------------------------------------"
341 @echo ">>> stage 4a: populating ${WORLDDEST}/usr/include"
342 @echo "--------------------------------------------------------------"
343 cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
344_libraries:
345 @echo
346 @echo "--------------------------------------------------------------"
347 @echo ">>> stage 4b: building libraries"
348 @echo "--------------------------------------------------------------"
349 cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries
350_depend:
351 @echo
352 @echo "--------------------------------------------------------------"
353 @echo ">>> stage 4c: make dependencies"
354 @echo "--------------------------------------------------------------"
355 cd ${.CURDIR}; ${WMAKE} par-depend
356everything:
357 @echo
358 @echo "--------------------------------------------------------------"
359 @echo ">>> stage 4d: building everything.."
360 @echo "--------------------------------------------------------------"
361 cd ${.CURDIR}; ${WMAKE} all
362
363# note: buildworld no longer depends on _cleanobj because we rm -rf the
364# entire object tree and built the bootstrap tools in a different location.
365#
366# buildworld - build everything from scratch
367# quickworld - skip the bootstrap, build, and cross-build steps
368# realquickworld - skip the bootstrap, build, crossbuild, and depend step.
369#
370# note: we include _obj in realquickworld to prevent accidental creation
371# of files in /usr/src.
372
373WMAKE_TGTS=
374.if !defined(SUBDIR_OVERRIDE)
375WMAKE_TGTS+= _worldtmp _bootstrap-tools
376.endif
377WMAKE_TGTS+= _obj _build-tools
378.if !defined(SUBDIR_OVERRIDE)
379WMAKE_TGTS+= _cross-tools
380.endif
381WMAKE_TGTS+= _includes _libraries _depend everything
382
383buildworld: ${WMAKE_TGTS}
384
385quickworld: _obj _includes _libraries _depend everything
386
387realquickworld: _obj _includes _libraries everything
388
389crossworld: _worldtmp _bootstrap-tools _obj _build-tools _cross-tools
390
391.ORDER: ${WMAKE_TGTS}
392
393#
394# installcheck
395#
396# Checks to be sure system is ready for installworld
397#
398installcheck:
399.if !defined(NO_SENDMAIL)
400 @if ! `id -u smmsp > /dev/null`; then \
401 echo "ERROR: Required smmsp user is missing, see /usr/src/UPDATING."; \
402 false; \
403 fi
404 @if ! `id -g smmsp > /dev/null`; then \
405 echo "ERROR: Required smmsp group is missing, see /usr/src/UPDATING."; \
406 false; \
407 fi
408.endif
409
410#
411# distributeworld
412#
413# Distributes everything compiled by a `buildworld'.
414#
415# installworld
416#
417# Installs everything compiled by a 'buildworld'.
418#
419distributeworld installworld: installcheck
420 cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
421
422#
423# reinstall
424#
425# If you have a build server, you can NFS mount the source and obj directories
426# and do a 'make reinstall' on the *client* to install new binaries from the
427# most recent server build.
428#
429reinstall:
430 @echo "--------------------------------------------------------------"
431 @echo ">>> Making hierarchy"
432 @echo "--------------------------------------------------------------"
433 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
434 @echo
435 @echo "--------------------------------------------------------------"
436 @echo ">>> Installing everything.."
437 @echo "--------------------------------------------------------------"
438 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
439.if !defined(NOMAN) && !defined(NO_MAKEDB_RUN)
440 @echo
441 @echo "--------------------------------------------------------------"
442 @echo ">>> Rebuilding man page indices"
443 @echo "--------------------------------------------------------------"
444 cd ${.CURDIR}/share/man; ${MAKE} makedb
445.endif
446
447redistribute:
448 @echo "--------------------------------------------------------------"
449 @echo ">>> Distributing everything.."
450 @echo "--------------------------------------------------------------"
451 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
452
453#
454# buildkernel and installkernel
455#
456# Which kernels to build and/or install is specified by setting
457# KERNCONF. If not defined a GENERIC kernel is built/installed.
458# Only the existing (depending TARGET) config files are used
459# for building kernels and only the first of these is designated
460# as the one being installed.
461#
462# Note that we have to use TARGET instead of TARGET_ARCH when
463# we're in kernel-land. Since only TARGET_ARCH is (expected) to
464# be set to cross-build, we have to make sure TARGET is set
465# properly.
466
467.if !defined(KERNCONF) && defined(KERNEL)
468KERNCONF= ${KERNEL}
469KERNWARN= yes
470.else
471KERNCONF?= GENERIC
472.endif
473INSTKERNNAME?= kernel
474
475KRNLSRCDIR= ${.CURDIR}/sys
476KRNLCONFDIR= ${KRNLSRCDIR}/${TARGET}/conf
477KRNLOBJDIR= ${OBJTREE}${KRNLSRCDIR}
478KERNCONFDIR?= ${KRNLCONFDIR}
479
480BUILDKERNELS=
481INSTALLKERNEL=
482.for _kernel in ${KERNCONF}
483.if exists(${KERNCONFDIR}/${_kernel})
484BUILDKERNELS+= ${_kernel}
485.if empty(INSTALLKERNEL)
486INSTALLKERNEL= ${_kernel}
487.endif
488.endif
489.endfor
490
491#
492# buildkernel
493#
494# Builds all kernels defined by BUILDKERNELS.
495#
496check_buildworld_tools:
497 @if [ ! -f ${WORLDDEST}/.libraries_done ]; then \
498 echo "You must buildworld before buildkernel. If you wish"; \
499 echo "to build a kernel using native tools, config it manually"; \
500 echo "or use the nativekernel target if you are in a rush"; \
501 exit 1; \
502 fi
503
504buildkernel: check_buildworld_tools
505.if empty(BUILDKERNELS)
506 @echo ">>> ERROR: Missing kernel configuration file(s) (${KERNCONF})."
507 @false
508.endif
509.if defined(KERNWARN)
510 @echo "--------------------------------------------------------------"
511 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
512 @echo "--------------------------------------------------------------"
513 @sleep 3
514.endif
515 @echo
516.for _kernel in ${BUILDKERNELS}
517 @echo "--------------------------------------------------------------"
518 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
519 @echo "--------------------------------------------------------------"
520 @echo "===> ${_kernel}"
521 @if [ -f ${KRNLOBJDIR}/${_kernel}/.nativekernel_run ]; then \
522 echo "REMOVING OLD NATIVEKERNEL BUILD"; \
523 rm -rf ${KRNLOBJDIR}/${_kernel}; fi
524 mkdir -p ${KRNLOBJDIR}
525.if !defined(NO_KERNELCONFIG)
526 cd ${KRNLCONFDIR}; \
527 PATH=${STRICTTMPPATH} \
528 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
529 ${KERNCONFDIR}/${_kernel}
530.endif
531 touch ${KRNLOBJDIR}/${_kernel}/.buildkernel_run
532.if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
533 cd ${KRNLOBJDIR}/${_kernel}; \
534 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} -DNO_MODULES clean
535.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KRNLSRCDIR}/modules)
536 cd ${KRNLOBJDIR}/${_kernel}; \
537 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} cleandir
538.endif
539.endif
540 cd ${KRNLOBJDIR}/${_kernel}; \
541 MAKESRCPATH=${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm \
542 ${MAKE} -DBOOTSTRAPPING -f ${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm/Makefile
543.if !defined(NO_KERNELDEPEND)
544 cd ${KRNLOBJDIR}/${_kernel}; \
545 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend
546.endif
547 cd ${KRNLOBJDIR}/${_kernel}; \
548 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all
549 @echo "--------------------------------------------------------------"
550 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
551 @echo "--------------------------------------------------------------"
552.endfor
553
554# The nativekernel target is for when you are impatient and want to
555# build a kernel without building the world first.
556#
557nativekernel:
558.if empty(BUILDKERNELS)
559 @echo ">>> ERROR: Missing kernel configuration file(s) (${KERNCONF})."
560 @false
561.endif
562.if defined(KERNWARN)
563 @echo "--------------------------------------------------------------"
564 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
565 @echo "--------------------------------------------------------------"
566 @sleep 3
567.endif
568 @echo
569.for _kernel in ${BUILDKERNELS}
570 @echo "--------------------------------------------------------------"
571 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
572 @echo "--------------------------------------------------------------"
573 @echo "===> ${_kernel}"
574 @if [ -f ${KRNLOBJDIR}/${_kernel}/.buildkernel_run ]; then \
575 echo "REMOVING OLD BUILDKERNEL BUILD"; \
576 rm -rf ${KRNLOBJDIR}/${_kernel}; fi
577 mkdir -p ${KRNLOBJDIR}
578.if !defined(NO_KERNELCONFIG)
579 cd ${KRNLCONFDIR}; \
580 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
581 ${KERNCONFDIR}/${_kernel}
582.endif
583 touch ${KRNLOBJDIR}/${_kernel}/.nativekernel_run
584.if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
585 cd ${KRNLOBJDIR}/${_kernel}; \
586 ${MAKE} KERNEL=${INSTKERNNAME} -DNO_MODULES clean
587.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KRNLSRCDIR}/modules)
588 cd ${KRNLOBJDIR}/${_kernel}; \
589 ${MAKE} KERNEL=${INSTKERNNAME} cleandir
590.endif
591.endif
592 cd ${KRNLOBJDIR}/${_kernel}; \
593 MAKESRCPATH=${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm \
594 ${MAKE} -DBOOTSTRAPPING -f ${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm/Makefile
595.if !defined(NO_KERNELDEPEND)
596 cd ${KRNLOBJDIR}/${_kernel}; \
597 ${MAKE} KERNEL=${INSTKERNNAME} depend
598.endif
599 cd ${KRNLOBJDIR}/${_kernel}; \
600 ${MAKE} KERNEL=${INSTKERNNAME} all
601 @echo "--------------------------------------------------------------"
602 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
603 @echo "--------------------------------------------------------------"
604.endfor
605
606#
607# installkernel
608#
609# Install the kernel defined by INSTALLKERNEL
610#
611installkernel reinstallkernel:
612 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
613 ${CROSSENV} ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
614
615#
616# update
617#
618# Update the source tree, by running sup and/or running cvs to update to the
619# latest copy.
620#
621update:
622.if defined(SUP_UPDATE)
623 @echo "--------------------------------------------------------------"
624 @echo ">>> Running ${SUP}"
625 @echo "--------------------------------------------------------------"
626.if defined(SUPFILE)
627 @${SUP} ${SUPFLAGS} ${SUPFILE}
628.endif
629.if defined(SUPFILE1)
630 @${SUP} ${SUPFLAGS} ${SUPFILE1}
631.endif
632.if defined(SUPFILE2)
633 @${SUP} ${SUPFLAGS} ${SUPFILE2}
634.endif
635.if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
636 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
637.endif
638.if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
639 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
640.endif
641.endif
642.if defined(CVS_UPDATE)
643 @echo "--------------------------------------------------------------"
644 @echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
645 @echo "--------------------------------------------------------------"
646 cd ${.CURDIR}; cvs -q update -rRELENG_4 -P -d
647.endif
648
649#
650# most
651#
652# Build most of the user binaries on the existing system libs and includes.
653#
654most:
655 @echo "--------------------------------------------------------------"
656 @echo ">>> Building programs only"
657 @echo "--------------------------------------------------------------"
658.for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin
659 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ all
660.endfor
661
662#
663# installmost
664#
665# Install the binaries built by the 'most' target. This does not include
666# libraries or include files.
667#
668installmost:
669 @echo "--------------------------------------------------------------"
670 @echo ">>> Installing programs only"
671 @echo "--------------------------------------------------------------"
672.for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin
673 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ install
674.endfor
675
676#
677# ------------------------------------------------------------------------
678#
679# From here onwards are utility targets used by the 'make world' and
680# related targets. If your 'world' breaks, you may like to try to fix
681# the problem and manually run the following targets to attempt to
682# complete the build. Beware, this is *not* guaranteed to work, you
683# need to have a pretty good grip on the current state of the system
684# to attempt to manually finish it. If in doubt, 'make world' again.
685#
686
687# bootstrap-tools: Build all tools required to build all tools.
688#
689# [x]install: dependancies on various new install features
690# rpcgen: old rpcgen used a hardwired cpp path, newer OBJFORMAT_PATH
691# envs are not compatible with older objformat binaries.
692#
693.if exists(${.CURDIR}/games) && !defined(NOGAMES)
694_strfile= games/fortune/strfile
695.endif
696
697bootstrap-tools:
698.for _tool in ${_strfile} \
699 bin/chmod bin/cp bin/dd bin/mkdir bin/rm bin/echo bin/test \
700 bin/cat bin/date bin/ln bin/mv bin/csh bin/expr bin/sh bin/ls \
701 bin/hostname bin/kill \
702 sbin/sysctl \
703 usr.bin/yacc usr.bin/colldef usr.bin/uudecode usr.bin/xinstall \
704 usr.bin/m4 usr.bin/rpcgen usr.bin/make usr.bin/awk usr.bin/file \
705 usr.bin/find usr.bin/lex usr.bin/sed usr.bin/uname usr.bin/touch \
706 usr.bin/mkdep usr.bin/mktemp usr.bin/lorder usr.bin/file2c \
707 usr.bin/tsort usr.bin/tr usr.bin/join usr.bin/wc usr.bin/basename \
708 usr.bin/gencat usr.bin/chflags usr.bin/expand usr.bin/paste \
709 usr.bin/mklocale usr.bin/uuencode usr.bin/compile_et usr.bin/hexdump \
710 usr.bin/vi usr.bin/cap_mkdb usr.bin/vgrind usr.bin/true usr.bin/false \
711 usr.bin/cmp usr.bin/xargs usr.bin/id usr.bin/env usr.bin/dirname \
712 usr.sbin/chown usr.sbin/mtree usr.sbin/config \
713 usr.sbin/btxld usr.sbin/pwd_mkdb usr.sbin/zic usr.sbin/makewhatis \
714 gnu/usr.bin/gperf gnu/usr.bin/groff gnu/usr.bin/texinfo \
715 gnu/usr.bin/grep gnu/usr.bin/sort gnu/usr.bin/patch \
716 gnu/usr.bin/gzip
717 ${ECHODIR} "===> ${_tool} (bootstrap-tools)"; \
718 cd ${.CURDIR}/${_tool}; \
719 ${MAKE} DIRPRFX=${_tool}/ obj; \
720 ${MAKE} DIRPRFX=${_tool}/ depend; \
721 ${MAKE} DIRPRFX=${_tool}/ all; \
722 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${BTOOLSDEST} install
723.endfor
724 touch ${BTOOLSDEST}/.bootstrap_done
725
726# build-tools: Build special purpose build tools. gcc2 related tools are
727# only built under the i386 architecture. Other architectures are
728# gcc3-only.
729#
730# XXX we may be able to remove or consolidate this into bootstrap-tools
731# now that we have the native helper (.nx/.no) infrastructure.
732#
733.if exists(${.CURDIR}/games) && !defined(NOGAMES)
734_games= games/adventure games/hack games/phantasia
735.endif
736
737.if exists(${.CURDIR}/share) && !defined(NOSHARE)
738_share= share/syscons/scrnmaps
739.endif
740
741_gcc3_cross= gnu/usr.bin/cc3
742_gcc3_tools= gnu/usr.bin/cc3/cc_tools
743.if ${MACHINE_ARCH} == "i386" && ${TARGET_ARCH} == "i386"
744_gcc2_cross= gnu/usr.bin/cc
745_gcc2_tools= gnu/usr.bin/cc/cc_tools
746_binutils= gnu/usr.bin/binutils gnu/usr.bin/binutils214
747.else
748_binutils= gnu/usr.bin/binutils214
749.endif
750
751.if !defined(NO_FORTRAN)
752.if ${TARGET_ARCH} == "i386"
753_fortran= gnu/usr.bin/cc/f771
754.else
755_fortran= gnu/usr.bin/cc3/f771
756.endif
757.endif
758
759.if !defined(NOPERL)
760_perl= gnu/usr.bin/perl/miniperl
761.endif
762
763.if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
764 !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
765_libkrb5= kerberos5/lib/libroken kerberos5/lib/libvers \
766 kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl
767.endif
768
769.if defined(RELEASEDIR)
770_sysinstall= release/sysinstall
771.endif
772
773build-tools:
774.for _tool in ${_gcc2_tools} ${_gcc3_tools} \
775 ${_fortran} ${_perl} ${_libroken4} ${_libkrb5} \
776 ${_share} ${_sysinstall}
777 ${ECHODIR} "===> ${_tool} (build-tools)"; \
778 cd ${.CURDIR}/${_tool}; \
779 ${MAKE} DIRPRFX=${_tool}/ obj; \
780 ${MAKE} DIRPRFX=${_tool}/ depend; \
781 ${MAKE} DIRPRFX=${_tool}/ all; \
782 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${BTOOLSDEST} install
783.endfor
784 touch ${BTOOLSDEST}/.build_done
785
786#
787# cross-tools: Build cross-building tools
788#
789.if ${TARGET_ARCH} == "alpha" && ${MACHINE_ARCH} != "alpha"
790_elf2exe= usr.sbin/elf2exe
791.endif
792
793.if ${TARGET_ARCH} == "i386" && ${MACHINE_ARCH} != "i386"
794_btxld= usr.sbin/btxld
795.endif
796
797cross-tools:
798.for _tool in ${_btxld} ${_elf2exe} ${_binutils} \
799 usr.bin/objformat usr.sbin/crunch/crunchide \
800 ${_gcc2_cross} ${_gcc3_cross}
801 ${ECHODIR} "===> ${_tool} (cross-tools)"; \
802 cd ${.CURDIR}/${_tool}; \
803 ${MAKE} DIRPRFX=${_tool}/ obj; \
804 ${MAKE} DIRPRFX=${_tool}/ depend; \
805 ${MAKE} DIRPRFX=${_tool}/ all; \
806 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${CTOOLSDEST} install
807.endfor
808 touch ${CTOOLSDEST}/.cross_done
809
810#
811# hierarchy - ensure that all the needed directories are present
812#
813hierarchy:
814 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
815
816#
817# libraries - build all libraries, and install them under ${DESTDIR}.
818#
819# The list of libraries with dependents (${_prebuild_libs}) and their
820# interdependencies (__L) are built automatically by the
821# ${.CURDIR}/tools/make_libdeps.sh script.
822#
823# .makeenv does not work when bootstrapping from 4.x, so we must be sure
824# to specify the correct CCVER or 'cc' will not exec the correct compiler.
825#
826libraries:
827 cd ${.CURDIR}; \
828 CCVER=gcc2 ${MAKE} -f Makefile.inc1 _startup_libs2; \
829 CCVER=gcc3 ${MAKE} -f Makefile.inc1 _startup_libs3; \
830 ${MAKE} -f Makefile.inc1 _startup_libs; \
831 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
832 ${MAKE} -f Makefile.inc1 _generic_libs;
833 touch ${WORLDDEST}/.libraries_done
834
835# These dependencies are not automatically generated:
836#
837# gnu/lib/libgcc and lib/csu must be built before all
838# shared libraries for ELF. The targets for _startup_libs{2,3} are
839# specifically built using gcc{2,3}.
840#
841_startup_libs2= gnu/lib/gcc2/libgcc
842_startup_libs3= gnu/lib/gcc3/libgcc
843.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
844_startup_libs= lib/csu/${MACHINE_ARCH}-elf
845.else
846_startup_libs= lib/csu/${MACHINE_ARCH}
847.endif
848_startup_libs+= lib/csu/common lib/libc
849
850_prebuild_libs=
851
852_generic_libs= gnu/lib
853
854.if !defined(NOPERL)
855_generic_libs+= gnu/usr.bin/perl/libperl
856.endif
857
858.if !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
859_prebuild_libs+= kerberos5/lib/libasn1
860_prebuild_libs+= kerberos5/lib/libgssapi
861_prebuild_libs+= kerberos5/lib/libkrb5
862_prebuild_libs+= kerberos5/lib/libroken
863_generic_libs+= kerberos5/lib
864.endif
865
866_prebuild_libs+= lib/libcom_err lib/libcrypt lib/libmd \
867 lib/libncurses lib/libopie lib/libradius lib/libskey \
868 lib/libtacplus lib/libutil \
869 lib/libz lib/msun
870
871lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L
872lib/libskey__L: lib/libcrypt__L lib/libmd__L
873
874_generic_libs+= lib
875
876.if !defined(NOCRYPT)
877.if !defined(NO_OPENSSL)
878_prebuild_libs+= secure/lib/libcrypto secure/lib/libssl
879.if !defined(NO_OPENSSH)
880_prebuild_libs+= secure/lib/libssh
881secure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L
882.endif
883.endif
884_generic_libs+= secure/lib
885.endif
886
887_generic_libs+= usr.bin/lex/lib
888
889.if ${MACHINE_ARCH} == "i386"
890_generic_libs+= usr.sbin/pcvt/keycap
891.endif
892
893.for _lib in ${_startup_libs2} ${_startup_libs3} ${_startup_libs} \
894 ${_prebuild_libs} ${_generic_libs}
895${_lib}__L: .PHONY
896.if exists(${.CURDIR}/${_lib})
897 ${ECHODIR} "===> ${_lib}"; \
898 cd ${.CURDIR}/${_lib}; \
899 ${MAKE} DIRPRFX=${_lib}/ depend; \
900 ${MAKE} DIRPRFX=${_lib}/ all; \
901 ${MAKE} DIRPRFX=${_lib}/ install
902.endif
903.endfor
904
905# only mess with gcc2 for i386 architectures.
906#
907_startup_libs: ${_startup_libs:S/$/__L/}
908.if ${TARGET_ARCH} == "i386"
909_startup_libs2: ${_startup_libs2:S/$/__L/}
910.else
911_startup_libs2:
912.endif
913_startup_libs3: ${_startup_libs3:S/$/__L/}
914_prebuild_libs: ${_prebuild_libs:S/$/__L/}
915_generic_libs: ${_generic_libs:S/$/__L/}
916
917# library targets must be ordered because there are inter-library
918# races (e.g. generation of tconfig.h)
919#
920.ORDER: ${_startup_libs2:S/$/__L/}
921.ORDER: ${_startup_libs3:S/$/__L/}
922.ORDER: ${_startup_libs:S/$/__L/}
923.ORDER: ${_prebuild_libs:S/$/__L/}
924.ORDER: ${_generic_libs:S/$/__L/}
925
926.for __target in clean cleandepend cleandir obj depend includes
927.for entry in ${SUBDIR}
928${entry}.${__target}__D: .PHONY
929 @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
930 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
931 edir=${entry}.${MACHINE_ARCH}; \
932 cd ${.CURDIR}/$${edir}; \
933 else \
934 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
935 edir=${entry}; \
936 cd ${.CURDIR}/$${edir}; \
937 fi; \
938 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
939.endfor
940par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
941.ORDER: ${SUBDIR:S/$/.${__target}__D/}
942.endfor
943.ORDER: par-clean par-cleandepend par-cleandir par-obj par-depend par-includes
944
945# The wmake target is used by /usr/bin/wmake to run make in a
946# world build environment.
947#
948wmake:
949 @echo '${WMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${WMAKE_ARGS}'
950
951wmakeenv:
952 @echo '${WMAKEENV} /bin/sh'
953
954bmake:
955 @echo '${BMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${BMAKE_ARGS}'
956
957bmakeenv:
958 @echo '${BMAKEENV} /bin/sh'
959
960tmake:
961 @echo '${TMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${TMAKE_ARGS}'
962
963tmakeenv:
964 @echo '${TMAKEENV} /bin/sh'
965
966.include <bsd.subdir.mk>
967