Separate INTERNALLIB and INSTALL_PIC_ARCHIVE. We want to have the latter
[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.65 2005/04/22 07:38:58 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 bootstrap-tools path is used by the bootstrap-tools, build-tools, and
176# cross-tools stages to augment the existing command path to access newer
177# versions of certain utilities such as 'patch' that the cross-tools stage
178# might expect.
179#
180BTOOLSPATH= ${BTOOLSDEST}/usr/sbin:${BTOOLSDEST}/usr/bin:${BTOOLSDEST}/bin:${BTOOLSDEST}/usr/games
181
182# The strict temporary command path contains all binaries required
183# by the buildworld system after the cross-tools stage.
184#
185STRICTTMPPATH= ${CTOOLSDEST}/usr/sbin:${CTOOLSDEST}/usr/bin:${CTOOLSDEST}/bin:${CTOOLSDEST}/usr/games:${BTOOLSDEST}/usr/sbin:${BTOOLSDEST}/usr/bin:${BTOOLSDEST}/bin:${BTOOLSDEST}/usr/games
186
187TMPDIR?= /tmp
188TMPPID!= echo $$$$
189
190#
191# Building a world goes through the following stages
192#
193# 1. bootstrap-tool stage [BMAKE]
194# This stage is responsible for creating programs that
195# are needed for backward compatibility reasons. They
196# are not built as cross-tools.
197# 2. build-tool stage [TMAKE]
198# This stage is responsible for creating the object
199# tree and building any tools that are needed during
200# the build process.
201# 3. cross-tool stage [XMAKE]
202# This stage is responsible for creating any tools that
203# are needed for cross-builds. A cross-compiler is one
204# of them.
205# 4. world stage [WMAKE]
206# This stage actually builds the world.
207# 5. install stage (optional) [IMAKE]
208# This stage installs a previously built world.
209#
210
211# bootstrap-tool stage
212#
213BMAKEENV= MAKEOBJDIRPREFIX=${BTOOLSDEST} \
214 OBJTREE=${OBJTREE} \
215 DESTDIR=${BTOOLSDEST} \
216 PATH=${BTOOLSPATH}:${PATH} \
217 INSTALL="sh ${.CURDIR}/tools/install.sh"
218
219BMAKE= ${BMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING \
220 -DNOHTML -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED \
221 -DNO_WERROR
222
223# build-tool stage
224#
225TMAKEENV= MAKEOBJDIRPREFIX=${BTOOLSDEST} \
226 OBJTREE=${OBJTREE} \
227 DESTDIR= \
228 PATH=${BTOOLSPATH}:${PATH} \
229 INSTALL="sh ${.CURDIR}/tools/install.sh"
230
231TMAKE= ${TMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING \
232 -DNO_FORTRAN
233
234# cross-tool stage
235#
236# note: TOOLS_PREFIX points to the obj root holding the cross
237# compiler binaries, while USRDATA_PREFIX points to the obj root
238# holding the target environment (and also determines where cross-built
239# libraries, crt*.o, and include files are installed).
240#
241XMAKEENV= MAKEOBJDIRPREFIX=${CTOOLSDEST} \
242 OBJTREE=${OBJTREE} \
243 DESTDIR=${CTOOLSDEST} \
244 INSTALL="sh ${.CURDIR}/tools/install.sh" \
245 TOOLS_PREFIX=${CTOOLSDEST} \
246 USRDATA_PREFIX=${WORLDDEST} \
247 PATH=${BTOOLSPATH}:${PATH}
248
249XMAKE= ${XMAKEENV} ${MAKE} -f Makefile.inc1 -DNO_FORTRAN -DNO_GDB \
250 -DBOOTSTRAPPING
251
252# world stage, note the strict path and note that TOOLS_PREFIX is left
253# unset and USRDATA_PREFIX (which defaults to TOOLS_PREFIX) is set to empty,
254# which is primarily for the compiler so it targets / (e.g. /usr/<blah>)
255# for both binary and library paths, even though it is being compiled to
256# WORLDDEST. None of the programs in the world stage are ever actually
257# executed during the buildworld/installworld.
258#
259CROSSENV= MAKEOBJDIRPREFIX=${WORLDDEST} \
260 OBJTREE=${OBJTREE} \
261 MACHINE_ARCH=${TARGET_ARCH} \
262 MACHINE=${TARGET} \
263 OBJFORMAT_PATH=${CTOOLSDEST}
264
265WMAKEENV= ${CROSSENV} \
266 DESTDIR=${WORLDDEST} \
267 INSTALL="sh ${.CURDIR}/tools/install.sh" \
268 PATH=${STRICTTMPPATH}
269
270WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1
271
272# install stage
273#
274IMAKEENV= ${CROSSENV} \
275 PATH=${STRICTTMPPATH}
276IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
277
278# kernel stage
279#
280KMAKEENV= ${WMAKEENV}
281
282# buildworld
283#
284# Attempt to rebuild the entire system, with reasonable chance of
285# success, regardless of how old your existing system is.
286#
287_worldtmp:
288 @echo
289 @echo "--------------------------------------------------------------"
290 @echo ">>> Rebuilding the temporary build tree"
291 @echo "--------------------------------------------------------------"
292.if !defined(NOCLEAN)
293 rm -rf ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST}
294.else
295 # XXX - These two can depend on any header file.
296 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
297 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
298.endif
299 mkdir -p ${DESTDIRBASE} ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST}
300.for _dir in ${WORLDDEST} ${BTOOLSDEST} ${CTOOLSDEST}
301 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
302 -p ${_dir}/ > /dev/null
303 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
304 -p ${_dir}/usr > /dev/null
305.endfor
306 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
307 -p ${WORLDDEST}/usr/include > /dev/null
308 ln -sf ${.CURDIR}/sys ${WORLDDEST}
309
310_bootstrap-tools:
311 @echo
312 @echo "--------------------------------------------------------------"
313 @echo ">>> stage 1: bootstrap tools"
314 @echo "--------------------------------------------------------------"
315 cd ${.CURDIR}; ${BMAKE} bootstrap-tools
316_cleanobj:
317 @echo
318 @echo "--------------------------------------------------------------"
319 @echo ">>> stage 2a: cleaning up the object tree"
320 @echo "--------------------------------------------------------------"
321 cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
322_obj:
323 @echo
324 @echo "--------------------------------------------------------------"
325 @echo ">>> stage 2b: rebuilding the object tree"
326 @echo "--------------------------------------------------------------"
327 cd ${.CURDIR}; ${WMAKE} par-obj
328_build-tools:
329 @echo
330 @echo "--------------------------------------------------------------"
331 @echo ">>> stage 2c: build tools"
332 @echo "--------------------------------------------------------------"
333 cd ${.CURDIR}; ${TMAKE} build-tools
334_cross-tools:
335 @echo
336 @echo "--------------------------------------------------------------"
337 @echo ">>> stage 3: cross tools"
338 @echo "--------------------------------------------------------------"
339 cd ${.CURDIR}; ${XMAKE} cross-tools
340_includes:
341 @echo
342 @echo "--------------------------------------------------------------"
343 @echo ">>> stage 4a: populating ${WORLDDEST}/usr/include"
344 @echo "--------------------------------------------------------------"
345 cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
346_libraries:
347 @echo
348 @echo "--------------------------------------------------------------"
349 @echo ">>> stage 4b: building libraries"
350 @echo "--------------------------------------------------------------"
351 cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries
352_depend:
353 @echo
354 @echo "--------------------------------------------------------------"
355 @echo ">>> stage 4c: make dependencies"
356 @echo "--------------------------------------------------------------"
357 cd ${.CURDIR}; ${WMAKE} par-depend
358everything:
359 @echo
360 @echo "--------------------------------------------------------------"
361 @echo ">>> stage 4d: building everything.."
362 @echo "--------------------------------------------------------------"
363 cd ${.CURDIR}; ${WMAKE} all
364
365# note: buildworld no longer depends on _cleanobj because we rm -rf the
366# entire object tree and built the bootstrap tools in a different location.
367#
368# buildworld - build everything from scratch
369# quickworld - skip the bootstrap, build, and cross-build steps
370# realquickworld - skip the bootstrap, build, crossbuild, and depend step.
371#
372# note: we include _obj in realquickworld to prevent accidental creation
373# of files in /usr/src.
374
375WMAKE_TGTS=
376.if !defined(SUBDIR_OVERRIDE)
377WMAKE_TGTS+= _worldtmp _bootstrap-tools
378.endif
379WMAKE_TGTS+= _obj _build-tools
380.if !defined(SUBDIR_OVERRIDE)
381WMAKE_TGTS+= _cross-tools
382.endif
383WMAKE_TGTS+= _includes _libraries _depend everything
384
385buildworld: ${WMAKE_TGTS}
386
387quickworld: _obj _includes _libraries _depend everything
388
389realquickworld: _obj _includes _libraries everything
390
391crossworld: _worldtmp _bootstrap-tools _obj _build-tools _cross-tools
392
393.ORDER: ${WMAKE_TGTS}
394
395#
396# installcheck
397#
398# Checks to be sure system is ready for installworld
399#
400installcheck:
401.if !defined(NO_SENDMAIL)
402 @pw usershow smmsp || (echo "You may need to run 'make preupgrade' first"; exit 1)
403 @pw groupshow smmsp || (echo "You may need to run 'make preupgrade' first"; exit 1)
404.endif
405 @pw usershow _pflogd || (echo "You may need to run 'make preupgrade' first"; exit 1)
406 @pw usershow _ntp || (echo "You may need to run 'make preupgrade' first"; exit 1)
407 @pw groupshow authpf || (echo "You may need to run 'make preupgrade' first"; exit 1)
408 @pw groupshow _pflogd || (echo "You may need to run 'make preupgrade' first"; exit 1)
409 @pw groupshow _ntp || (echo "You may need to run 'make preupgrade' first"; exit 1)
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, nativekernel, quickkernel, 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# You can specify INSTALLSTRIPPED=1 if you wish the installed
463# kernel and modules to be stripped of its debug info (required
464# symbols are left intact). You can specify INSTALLSTRIPPEDMODULES
465# if you only want to strip the modules of their debug info. These
466# only apply if you have DEBUG=-g in your kernel config or make line.
467#
468# Note that we have to use TARGET instead of TARGET_ARCH when
469# we're in kernel-land. Since only TARGET_ARCH is (expected) to
470# be set to cross-build, we have to make sure TARGET is set
471# properly.
472
473.if !defined(KERNCONF) && defined(KERNEL)
474KERNCONF= ${KERNEL}
475KERNWARN= yes
476.else
477KERNCONF?= GENERIC
478.endif
479INSTKERNNAME?= kernel
480
481KRNLSRCDIR= ${.CURDIR}/sys
482KRNLCONFDIR= ${KRNLSRCDIR}/${TARGET}/conf
483KRNLOBJDIR= ${OBJTREE}${KRNLSRCDIR}
484KERNCONFDIR?= ${KRNLCONFDIR}
485
486BUILDKERNELS=
487INSTALLKERNEL=
488.for _kernel in ${KERNCONF}
489.if exists(${KERNCONFDIR}/${_kernel})
490BUILDKERNELS+= ${_kernel}
491.if empty(INSTALLKERNEL)
492INSTALLKERNEL= ${_kernel}
493.endif
494.endif
495.endfor
496
497# kernel version numbers survive rm -rf
498#
499.for _kernel in ${BUILDKERNELS}
500.if exists(${KRNLOBJDIR}/${_kernel}/version)
501KERNEL_VERSION_${_kernel} != cat ${KRNLOBJDIR}/${_kernel}/version
502.endif
503.endfor
504
505#
506# buildkernel
507#
508# Builds all kernels defined by BUILDKERNELS.
509#
510bk_tools:
511 @if [ ! -f ${WORLDDEST}/.libraries_done ]; then \
512 echo "You must buildworld before buildkernel. If you wish"; \
513 echo "to build a kernel using native tools, config it manually"; \
514 echo "or use the nativekernel target if you are in a rush"; \
515 exit 1; \
516 fi
517
518maybe_bk_tools:
519.for _kernel in ${BUILDKERNELS}
520 @if [ ! -f ${KRNLOBJDIR}/${_kernel}/.nativekernel_run ]; then \
521 if [ ! -f ${WORLDDEST}/.libraries_done ]; then \
522 echo "The kernel was build using buildworld tools which no" ; \
523 echo "longer appear to exist, quickkernel failed!" ; \
524 exit 1; \
525 fi; \
526 fi
527.endfor
528
529bk_build_list:
530.if empty(BUILDKERNELS)
531 @echo ">>> ERROR: Missing kernel configuration file(s) (${KERNCONF})."
532 @false
533.endif
534
535bk_kernwarn:
536.if defined(KERNWARN)
537 @echo "--------------------------------------------------------------"
538 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
539 @echo "--------------------------------------------------------------"
540 @sleep 3
541.endif
542 @echo
543
544# The buildkernel target rebuilds the specified kernels from scratch
545# using the crossbuild tools generated by the last buildworld. It is
546# the safest (but also the most time consuming) way to build a new kernel.
547#
548buildkernel: bk_tools bk_build_list bk_kernwarn
549.for _kernel in ${BUILDKERNELS}
550 @echo "--------------------------------------------------------------"
551 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
552 @echo "--------------------------------------------------------------"
553 @echo "===> ${_kernel}"
554.if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
555 rm -rf ${KRNLOBJDIR}/${_kernel}
556.else
557 @if [ -f ${KRNLOBJDIR}/${_kernel}/.nativekernel_run ]; then \
558 echo "YOU ARE REBUILDING WITH BUILDKERNEL, REMOVING OLD NATIVEKERNEL BUILD"; \
559 rm -rf ${KRNLOBJDIR}/${_kernel}; fi
560.endif
561 mkdir -p ${KRNLOBJDIR}
562.if !defined(NO_KERNELCONFIG)
563 cd ${KRNLCONFDIR}; \
564 PATH=${STRICTTMPPATH} \
565 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
566 ${KERNCONFDIR}/${_kernel}
567.endif
568.if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) && defined(KERNEL_VERSION_${_kernel})
569 echo ${KERNEL_VERSION_${_kernel}} > ${KRNLOBJDIR}/${_kernel}/version
570.endif
571 touch ${KRNLOBJDIR}/${_kernel}/.buildkernel_run
572 cd ${KRNLOBJDIR}/${_kernel}; \
573 MAKESRCPATH=${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm \
574 ${MAKE} -DBOOTSTRAPPING -f ${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm/Makefile
575.if !defined(NO_KERNELDEPEND)
576 cd ${KRNLOBJDIR}/${_kernel}; \
577 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend
578.endif
579 cd ${KRNLOBJDIR}/${_kernel}; \
580 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all
581 @echo "--------------------------------------------------------------"
582 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
583 @echo "--------------------------------------------------------------"
584.endfor
585
586# The nativekernel target rebuilds the specified kernels from scratch
587# using the systems standard compiler rather then using the crossbuild
588# tools generated by the last buildworld. This is fairly safe if your
589# system is reasonable up-to-date.
590#
591nativekernel: bk_build_list bk_kernwarn
592.for _kernel in ${BUILDKERNELS}
593 @echo "--------------------------------------------------------------"
594 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
595 @echo "--------------------------------------------------------------"
596 @echo "===> ${_kernel}"
597.if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
598 rm -rf ${KRNLOBJDIR}/${_kernel}
599.else
600 @if [ -f ${KRNLOBJDIR}/${_kernel}/.buildkernel_run ]; then \
601 echo "YOU ARE REBUILDING WITH NATIVEKERNEL, REMOVING OLD BUILDKERNEL BUILD"; \
602 rm -rf ${KRNLOBJDIR}/${_kernel}; fi
603.endif
604 mkdir -p ${KRNLOBJDIR}
605.if !defined(NO_KERNELCONFIG)
606 cd ${KRNLCONFDIR}; \
607 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
608 ${KERNCONFDIR}/${_kernel}
609.endif
610.if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) && defined(KERNEL_VERSION_${_kernel})
611 echo ${KERNEL_VERSION_${_kernel}} > ${KRNLOBJDIR}/${_kernel}/version
612.endif
613 touch ${KRNLOBJDIR}/${_kernel}/.nativekernel_run
614 cd ${KRNLOBJDIR}/${_kernel}; \
615 MAKESRCPATH=${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm \
616 ${MAKE} -DBOOTSTRAPPING -f ${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm/Makefile
617.if !defined(NO_KERNELDEPEND)
618 cd ${KRNLOBJDIR}/${_kernel}; \
619 ${MAKE} KERNEL=${INSTKERNNAME} depend
620.endif
621 cd ${KRNLOBJDIR}/${_kernel}; \
622 ${MAKE} KERNEL=${INSTKERNNAME} all
623 @echo "--------------------------------------------------------------"
624 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
625 @echo "--------------------------------------------------------------"
626.endfor
627
628# The quickkernel target rebuilds the specified kernels as quickly
629# as possible. It will use the native tools or the buildworld cross tools
630# based on whether the kernel was originally generated via buildkernel or
631# nativekernel. Config is rerun but the object hierarchy is not rebuilt,
632# nor is the make depend step run.
633#
634quickkernel: maybe_bk_tools bk_build_list bk_kernwarn
635.for _kernel in ${BUILDKERNELS}
636 @echo "--------------------------------------------------------------"
637 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
638 @echo "--------------------------------------------------------------"
639 @echo "===> ${_kernel}"
640.if exists(${KRNLOBJDIR}/${_kernel}/.buildkernel_run)
641.if !defined(NO_KERNELCONFIG)
642 cd ${KRNLCONFDIR}; \
643 PATH=${STRICTTMPPATH} \
644 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
645 ${KERNCONFDIR}/${_kernel}
646.endif
647 cd ${KRNLOBJDIR}/${_kernel}; \
648 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all
649.else
650.if !defined(NO_KERNELCONFIG)
651 cd ${KRNLCONFDIR}; \
652 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
653 ${KERNCONFDIR}/${_kernel}
654.endif
655 cd ${KRNLOBJDIR}/${_kernel}; \
656 ${MAKE} KERNEL=${INSTKERNNAME} all
657.endif
658 @echo "--------------------------------------------------------------"
659 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
660 @echo "--------------------------------------------------------------"
661.endfor
662
663
664# installkernel
665#
666# Install the kernel defined by INSTALLKERNEL
667#
668installkernel reinstallkernel:
669.if exists(${KRNLOBJDIR}/${_kernel}/.buildkernel_run)
670 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
671 ${CROSSENV} ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
672.else
673 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
674 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
675.endif
676
677#
678# update
679#
680# Update the source tree, by running sup and/or running cvs to update to the
681# latest copy.
682#
683update:
684.if defined(SUP_UPDATE)
685 @echo "--------------------------------------------------------------"
686 @echo ">>> Running ${SUP}"
687 @echo "--------------------------------------------------------------"
688.if defined(SUPFILE)
689 @${SUP} ${SUPFLAGS} ${SUPFILE}
690.endif
691.if defined(SUPFILE1)
692 @${SUP} ${SUPFLAGS} ${SUPFILE1}
693.endif
694.if defined(SUPFILE2)
695 @${SUP} ${SUPFLAGS} ${SUPFILE2}
696.endif
697.if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
698 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
699.endif
700.if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
701 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
702.endif
703.endif
704.if defined(CVS_UPDATE)
705 @echo "--------------------------------------------------------------"
706 @echo ">>> Updating ${.CURDIR} from cvs repository `cat ${.CURDIR}/CVS/Root`"
707 @echo "--------------------------------------------------------------"
708 @sleep 2
709 cd ${.CURDIR}; cvs -q update -P -d
710.endif
711
712#
713# most
714#
715# Build most of the user binaries on the existing system libs and includes.
716#
717most:
718 @echo "--------------------------------------------------------------"
719 @echo ">>> Building programs only"
720 @echo "--------------------------------------------------------------"
721.for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin
722 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ all
723.endfor
724
725#
726# installmost
727#
728# Install the binaries built by the 'most' target. This does not include
729# libraries or include files.
730#
731installmost:
732 @echo "--------------------------------------------------------------"
733 @echo ">>> Installing programs only"
734 @echo "--------------------------------------------------------------"
735.for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin
736 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ install
737.endfor
738
739#
740# ------------------------------------------------------------------------
741#
742# From here onwards are utility targets used by the 'make world' and
743# related targets. If your 'world' breaks, you may like to try to fix
744# the problem and manually run the following targets to attempt to
745# complete the build. Beware, this is *not* guaranteed to work, you
746# need to have a pretty good grip on the current state of the system
747# to attempt to manually finish it. If in doubt, 'make world' again.
748#
749
750# bootstrap-tools: Build all tools required to build all tools. Note that
751# order is important in a number of cases and also note that the bootstrap
752# and build tools stages have access to earlier binaries they themselves
753# had generated.
754#
755# patch: older patch's do not have -i. This program must be built
756# first so other bootstrap tools that need to apply patches
757# can use it.
758# [x]install: dependancies on various new install features
759# rpcgen: old rpcgen used a hardwired cpp path, newer OBJFORMAT_PATH
760# envs are not compatible with older objformat binaries.
761#
762.if exists(${.CURDIR}/games) && !defined(NOGAMES)
763_strfile= games/fortune/strfile
764.endif
765
766bootstrap-tools:
767 ln -fs /bin/date ${BTOOLSDEST}/bin/date
768.for _tool in ${_strfile} \
769 usr.bin/patch \
770 bin/chmod bin/cp bin/dd bin/mkdir bin/rm bin/echo bin/test \
771 bin/cat bin/ln bin/mv bin/csh bin/expr bin/sh bin/ls \
772 bin/hostname bin/kill \
773 usr.bin/yacc usr.bin/colldef usr.bin/uudecode usr.bin/xinstall \
774 usr.bin/m4 usr.bin/rpcgen usr.bin/make usr.bin/awk \
775 usr.bin/find usr.bin/lex usr.bin/sed usr.bin/uname usr.bin/touch \
776 usr.bin/mkdep usr.bin/mktemp usr.bin/lorder usr.bin/file2c \
777 usr.bin/tsort usr.bin/tr usr.bin/join usr.bin/wc usr.bin/basename \
778 usr.bin/gencat usr.bin/chflags usr.bin/expand usr.bin/paste \
779 usr.bin/mklocale usr.bin/uuencode usr.bin/compile_et usr.bin/hexdump \
780 usr.bin/vi usr.bin/cap_mkdb usr.bin/vgrind usr.bin/true usr.bin/false \
781 usr.bin/cmp usr.bin/xargs usr.bin/id usr.bin/env usr.bin/dirname \
782 usr.sbin/chown usr.sbin/mtree usr.sbin/config \
783 usr.sbin/btxld usr.sbin/pwd_mkdb usr.sbin/zic usr.sbin/makewhatis \
784 gnu/usr.bin/texinfo gnu/usr.bin/grep gnu/usr.bin/sort \
785 usr.bin/gzip usr.bin/bzip2 usr.bin/mkcsmapper usr.bin/mkesdb
786 ${ECHODIR} "===> ${_tool} (bootstrap-tools)"; \
787 cd ${.CURDIR}/${_tool}; \
788 ${MAKE} DIRPRFX=${_tool}/ obj; \
789 ${MAKE} DIRPRFX=${_tool}/ depend; \
790 ${MAKE} DIRPRFX=${_tool}/ all; \
791 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${BTOOLSDEST} install
792.endfor
793 touch ${BTOOLSDEST}/.bootstrap_done
794
795# build-tools: Build special purpose build tools.
796#
797# XXX we may be able to remove or consolidate this into bootstrap-tools
798# now that we have the native helper (.nx/.no) infrastructure.
799#
800.if exists(${.CURDIR}/games) && !defined(NOGAMES)
801_games= games/adventure games/hack games/phantasia
802.endif
803
804.if exists(${.CURDIR}/share) && !defined(NOSHARE)
805_share= share/syscons/scrnmaps
806.endif
807
808_gcc34_cross= gnu/usr.bin/cc34
809_gcc34_tools= gnu/usr.bin/cc34/cc_prep gnu/usr.bin/cc34/cc_tools
810_binutils= gnu/usr.bin/binutils215
811
812.if !defined(NO_FORTRAN)
813_fortran= gnu/usr.bin/cc34/f771
814.endif
815
816.if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
817 !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
818_libkrb5= kerberos5/bintools kerberos5/lib/libroken kerberos5/lib/libvers \
819 kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl
820.endif
821
822.if defined(RELEASEDIR)
823_sysinstall= release/sysinstall
824.endif
825
826build-tools:
827.for _tool in ${_gcc34_tools} ${_fortran} ${_libkrb5} ${_share} ${_sysinstall}
828 ${ECHODIR} "===> ${_tool} (build-tools)"; \
829 cd ${.CURDIR}/${_tool}; \
830 ${MAKE} DIRPRFX=${_tool}/ obj; \
831 ${MAKE} DIRPRFX=${_tool}/ depend; \
832 ${MAKE} DIRPRFX=${_tool}/ all; \
833 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${BTOOLSDEST} install
834.endfor
835 touch ${BTOOLSDEST}/.build_done
836
837#
838# cross-tools: Build cross-building tools
839#
840.if ${TARGET_ARCH} == "i386" && ${MACHINE_ARCH} != "i386"
841_btxld= usr.sbin/btxld
842.endif
843
844cross-tools:
845.for _tool in ${_btxld} ${_binutils} \
846 usr.bin/objformat usr.sbin/crunch/crunchide \
847 ${_gcc34_cross}
848 ${ECHODIR} "===> ${_tool} (cross-tools)"; \
849 cd ${.CURDIR}/${_tool}; \
850 ${MAKE} DIRPRFX=${_tool}/ obj; \
851 ${MAKE} DIRPRFX=${_tool}/ depend; \
852 ${MAKE} DIRPRFX=${_tool}/ all; \
853 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${CTOOLSDEST} install
854.endfor
855 touch ${CTOOLSDEST}/.cross_done
856
857#
858# hierarchy - ensure that all the needed directories are present
859#
860hierarchy:
861 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
862
863#
864# libraries - build all libraries, and install them under ${DESTDIR}.
865#
866# The list of libraries with dependents (${_prebuild_libs}) and their
867# interdependencies (__L) are built automatically by the
868# ${.CURDIR}/tools/make_libdeps.sh script.
869#
870# .makeenv does not work when bootstrapping from 4.x, so we must be sure
871# to specify the correct CCVER or 'cc' will not exec the correct compiler.
872#
873libraries:
874 cd ${.CURDIR}; \
875 HOST_CCVER=${HOST_CCVER} CCVER=gcc34 \
876 ${MAKE} -f Makefile.inc1 _startup_libs34; \
877 ${MAKE} -f Makefile.inc1 _startup_libs; \
878 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
879 ${MAKE} -f Makefile.inc1 _generic_libs;
880 touch ${WORLDDEST}/.libraries_done
881
882# These dependencies are not automatically generated:
883#
884# gnu/lib/${CCVER}/libgcc and lib/csu must be built before all
885# shared libraries for ELF. The target for _startup_libs34 is
886# specifically built using gcc34.
887#
888_startup_libs34= gnu/lib/gcc34/libgcc
889_startup_libs= lib/csu/${MACHINE_ARCH}
890_startup_libs+= lib/csu/common lib/libc
891
892_prebuild_libs= lib/libarchive
893_prebuild_libs+= lib/libutil
894
895_generic_libs= gnu/lib
896
897.if !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
898_prebuild_libs+= kerberos5/tools
899_prebuild_libs+= kerberos5/lib/libasn1
900_prebuild_libs+= kerberos5/lib/libgssapi
901_prebuild_libs+= kerberos5/lib/libkrb5
902_prebuild_libs+= kerberos5/lib/libroken
903_generic_libs+= kerberos5/lib
904.endif
905
906_prebuild_libs+= lib/libcom_err lib/libcrypt lib/libmd \
907 lib/libncurses/libncurses lib/libopie lib/libradius \
908 lib/libskey lib/libtacplus lib/libz lib/msun
909
910lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L
911lib/libskey__L: lib/libcrypt__L lib/libmd__L
912
913_generic_libs+= lib
914
915.if !defined(NOCRYPT)
916.if !defined(NO_OPENSSL)
917_prebuild_libs+= secure/lib/libcrypto secure/lib/libssl
918.if !defined(NO_OPENSSH)
919_prebuild_libs+= secure/lib/libssh
920secure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L
921.endif
922.endif
923_generic_libs+= secure/lib
924.endif
925
926_generic_libs+= usr.bin/lex/lib
927
928.for _lib in ${_startup_libs2} ${_startup_libs3} ${_startup_libs34} \
929 ${_startup_libs} ${_prebuild_libs} ${_generic_libs}
930${_lib}__L: .PHONY
931.if exists(${.CURDIR}/${_lib})
932 ${ECHODIR} "===> ${_lib}"; \
933 cd ${.CURDIR}/${_lib}; \
934 ${MAKE} DIRPRFX=${_lib}/ depend; \
935 ${MAKE} DIRPRFX=${_lib}/ all; \
936 ${MAKE} DIRPRFX=${_lib}/ install
937.endif
938.endfor
939
940_startup_libs: ${_startup_libs:S/$/__L/}
941_startup_libs34: ${_startup_libs34:S/$/__L/}
942_prebuild_libs: ${_prebuild_libs:S/$/__L/}
943_generic_libs: ${_generic_libs:S/$/__L/}
944
945# library targets must be ordered because there are inter-library
946# races (e.g. generation of tconfig.h)
947#
948.ORDER: ${_startup_libs34:S/$/__L/}
949.ORDER: ${_startup_libs:S/$/__L/}
950.ORDER: ${_prebuild_libs:S/$/__L/}
951.ORDER: ${_generic_libs:S/$/__L/}
952
953.for __target in clean cleandepend cleandir obj depend includes
954.for entry in ${SUBDIR}
955${entry}.${__target}__D: .PHONY
956 @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
957 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
958 edir=${entry}.${MACHINE_ARCH}; \
959 cd ${.CURDIR}/$${edir}; \
960 else \
961 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
962 edir=${entry}; \
963 cd ${.CURDIR}/$${edir}; \
964 fi; \
965 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
966.endfor
967par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
968.ORDER: ${SUBDIR:S/$/.${__target}__D/}
969.endfor
970.ORDER: par-clean par-cleandepend par-cleandir par-obj par-depend par-includes
971
972# The wmake target is used by /usr/bin/wmake to run make in a
973# world build environment.
974#
975wmake:
976 @echo '${WMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${WMAKE_ARGS}'
977
978wmakeenv:
979 @echo '${WMAKEENV} /bin/sh'
980
981bmake:
982 @echo '${BMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${BMAKE_ARGS}'
983
984bmakeenv:
985 @echo '${BMAKEENV} /bin/sh'
986
987tmake:
988 @echo '${TMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${TMAKE_ARGS}'
989
990tmakeenv:
991 @echo '${TMAKEENV} /bin/sh'
992
993.include <bsd.subdir.mk>
994