Get rid of LK_DRAIN and LK_INTERLOCK interactions. Recode interlocks when
[dragonfly.git] / Makefile.inc1
blob22d93d73e660b7cb224f339c5f1154a09a4b7f1a
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.84 2005/10/11 13:31:05 corecode Exp $
5 # Build-time options are documented in make.conf(5).
7 # The intended user-driven targets are:
9 # buildworld  - rebuild *everything*, including glue to help do upgrades
10 # quickworld  - skip the glue and do a depend+build on the meat
11 # realquickworld - skip the glue and depend stages and just build the meat
12 # crossworld  - only build the glue (particularly the cross-build environment)
13 # installworld- install everything built by "buildworld"
14 # update      - convenient way to update your source tree (eg: sup/cvs)
15 # most        - build user commands, no libraries or include files
16 # installmost - install user commands, no libraries or include files
18 # Standard targets (not defined here) are documented in the makefiles in
19 # /usr/share/mk.  These include:
20 #               obj depend all install clean cleandepend cleanobj
22 # Put initial settings here.
23 SUBDIR=
25 # We must do share/info early so that installation of info `dir'
26 # entries works correctly.  Do it first since it is less likely to
27 # grow dependencies on include and lib than vice versa.
28 .if exists(${.CURDIR}/share/info)
29 SUBDIR+= share/info
30 .endif
32 # We must do include and lib early so that the perl *.ph generation
33 # works correctly as it uses the header files installed by this.
34 .if exists(${.CURDIR}/include)
35 SUBDIR+= include
36 .endif
37 .if exists(${.CURDIR}/lib)
38 SUBDIR+= lib
39 .endif
40 # This exists simply to ensure that the obj dir hierarchy is
41 # intact for nrelease, allowing the nrelease Makefile's to 
42 # reference ${.OBJDIR}.
44 .if exists(${.CURDIR}/nrelease)
45 SUBDIR+= nrelease
46 .endif
48 .if exists(${.CURDIR}/bin)
49 SUBDIR+= bin
50 .endif
51 .if exists(${.CURDIR}/games) && !defined(NO_GAMES)
52 SUBDIR+= games
53 .endif
54 .if exists(${.CURDIR}/gnu)
55 SUBDIR+= gnu
56 .endif
57 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
58     !defined(NO_CRYPT) && !defined(NO_OPENSSL) && defined(WANT_KERBEROS)
59 SUBDIR+= kerberos5
60 .endif
61 .if exists(${.CURDIR}/libexec)
62 SUBDIR+= libexec
63 .endif
64 .if exists(${.CURDIR}/sbin)
65 SUBDIR+= sbin
66 .endif
67 .if exists(${.CURDIR}/secure) && !defined(NO_CRYPT)
68 SUBDIR+= secure
69 .endif
70 .if exists(${.CURDIR}/share) && !defined(NO_SHARE)
71 SUBDIR+= share
72 .endif
73 .if exists(${.CURDIR}/sys)
74 SUBDIR+= sys
75 .endif
76 .if exists(${.CURDIR}/usr.bin)
77 SUBDIR+= usr.bin
78 .endif
79 .if exists(${.CURDIR}/usr.sbin)
80 SUBDIR+= usr.sbin
81 .endif
83 # etc must be last for "distribute" to work
84 .if exists(${.CURDIR}/etc)
85 SUBDIR+= etc
86 .endif
88 # These are last, since it is nice to at least get the base system
89 # rebuilt before you do them.
90 .if defined(LOCAL_DIRS)
91 .for _DIR in ${LOCAL_DIRS}
92 .if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile)
93 SUBDIR+= ${_DIR}
94 .endif
95 .endfor
96 .endif
98 .if defined(SUBDIR_OVERRIDE)
99 SUBDIR=         ${SUBDIR_OVERRIDE}
100 .endif
102 .if defined(NOCLEANDIR)
103 CLEANDIR=       clean cleandepend
104 .else
105 CLEANDIR=       cleandir
106 .endif
108 SUP?=           /usr/local/bin/cvsup
109 SUPFLAGS?=      -g -L 2 -P -
110 .if defined(SUPHOST)
111 SUPFLAGS+=      -h ${SUPHOST}
112 .endif
114 .if defined(NO_CLEAN)
115 NOCLEAN=        # defined
116 .endif
118 # Object directory base in primary make.  Note that when we rerun make
119 # from inside this file we change MAKEOBJDIRPREFIX to the appropriate
120 # subdirectory because the rest of the build system needs it that way.
121 # The original object directory base is saved in OBJTREE.
123 MAKEOBJDIRPREFIX?=      /usr/obj
124 OBJTREE?=               ${MAKEOBJDIRPREFIX}
126 # Used for stage installs and pathing
128 DESTDIRBASE?=           ${OBJTREE}${.CURDIR}
130 TARGET_ARCH?=   ${MACHINE_ARCH}
131 .if ${TARGET_ARCH} == ${MACHINE_ARCH}
132 TARGET?=        ${MACHINE}
133 .else
134 TARGET?=        ${TARGET_ARCH}
135 .endif
136 .if make(buildworld)
137 BUILD_ARCH!=    sysctl -n hw.machine_arch
138 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
139 .error To cross-build, set TARGET_ARCH.
140 .endif
141 .endif
143 # BTOOLS        (Natively built) All non-cross-development tools that the
144 #               main build needs.  This includes things like 'mkdir' and 'rm'.
145 #               We will not use the native system's exec path once we start
146 #               on WORLD.  (bootstrap-tools and build-tools or BTOOLS)
148 # CTOOLS        (Natively built) Cross development tools which are specific
149 #               to the target architecture.
151 # WORLD         (Cross built) Our ultimate buildworld, using only BTOOLS and
152 #               CTOOLS.
154 # MACHINE_ARCH  Architecture we are building on
155 # TARGET_ARCH   Architecture we are building for
157 BTOOLSDEST=     ${DESTDIRBASE}/btools_${MACHINE_ARCH}
158 CTOOLSDEST=     ${DESTDIRBASE}/ctools_${MACHINE_ARCH}_${TARGET_ARCH}
159 WORLDDEST=      ${DESTDIRBASE}/world_${TARGET_ARCH}
161 # The bootstrap-tools path is used by the bootstrap-tools, build-tools, and
162 # cross-tools stages to augment the existing command path to access newer
163 # versions of certain utilities such as 'patch' that the cross-tools stage
164 # might expect.
166 BTOOLSPATH= ${BTOOLSDEST}/usr/sbin:${BTOOLSDEST}/usr/bin:${BTOOLSDEST}/bin:${BTOOLSDEST}/usr/games
168 # The strict temporary command path contains all binaries required
169 # by the buildworld system after the cross-tools stage.
171 STRICTTMPPATH=  ${CTOOLSDEST}/usr/sbin:${CTOOLSDEST}/usr/bin:${CTOOLSDEST}/bin:${CTOOLSDEST}/usr/games:${BTOOLSDEST}/usr/sbin:${BTOOLSDEST}/usr/bin:${BTOOLSDEST}/bin:${BTOOLSDEST}/usr/games
173 TMPDIR?=        /tmp
174 TMPPID!=        echo $$$$
177 # Building a world goes through the following stages
179 # 1. bootstrap-tool stage [BMAKE]
180 #       This stage is responsible for creating programs that
181 #       are needed for backward compatibility reasons. They
182 #       are not built as cross-tools.
183 # 2. build-tool stage [TMAKE]
184 #       This stage is responsible for creating the object
185 #       tree and building any tools that are needed during
186 #       the build process.
187 # 3. cross-tool stage [XMAKE]
188 #       This stage is responsible for creating any tools that
189 #       are needed for cross-builds. A cross-compiler is one
190 #       of them.
191 # 4. world stage [WMAKE]
192 #       This stage actually builds the world.
193 # 5. install stage (optional) [IMAKE]
194 #       This stage installs a previously built world.
197 # bootstrap-tool stage
199 BMAKEENV=       MAKEOBJDIRPREFIX=${BTOOLSDEST} \
200                 OBJTREE=${OBJTREE} \
201                 DESTDIR=${BTOOLSDEST} \
202                 PATH=${BTOOLSPATH}:${PATH} \
203                 INSTALL="sh ${.CURDIR}/tools/install.sh"
205 BMAKE=          ${BMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING \
206                 -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED \
207                 -DNO_WERROR -DNO_NLS
209 # build-tool stage
211 TMAKEENV=       MAKEOBJDIRPREFIX=${BTOOLSDEST} \
212                 OBJTREE=${OBJTREE} \
213                 DESTDIR= \
214                 PATH=${BTOOLSPATH}:${PATH} \
215                 INSTALL="sh ${.CURDIR}/tools/install.sh"
217 TMAKE=          ${TMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING \
218                 -DNO_FORTRAN -DNOSHARED
220 # cross-tool stage
222 # note: TOOLS_PREFIX points to the obj root holding the cross
223 #       compiler binaries, while USRDATA_PREFIX points to the obj root 
224 #       holding the target environment (and also determines where cross-built
225 #       libraries, crt*.o, and include files are installed).
227 XMAKEENV=       MAKEOBJDIRPREFIX=${CTOOLSDEST} \
228                 OBJTREE=${OBJTREE} \
229                 DESTDIR=${CTOOLSDEST} \
230                 INSTALL="sh ${.CURDIR}/tools/install.sh" \
231                 TOOLS_PREFIX=${CTOOLSDEST} \
232                 USRDATA_PREFIX=${WORLDDEST} \
233                 PATH=${BTOOLSPATH}:${PATH}
235 XMAKE=          ${XMAKEENV} ${MAKE} -f Makefile.inc1 -DNO_FORTRAN -DNO_GDB \
236                 -DBOOTSTRAPPING -DNOSHARED
238 # world stage, note the strict path and note that TOOLS_PREFIX is left
239 # unset and USRDATA_PREFIX (which defaults to TOOLS_PREFIX) is set to empty,
240 # which is primarily for the compiler so it targets / (e.g. /usr/<blah>)
241 # for both binary and library paths, even though it is being compiled to
242 # WORLDDEST.  None of the programs in the world stage are ever actually
243 # executed during the buildworld/installworld.
245 CROSSENV=       MAKEOBJDIRPREFIX=${WORLDDEST} \
246                 OBJTREE=${OBJTREE} \
247                 MACHINE_ARCH=${TARGET_ARCH} \
248                 MACHINE=${TARGET} \
249                 OBJFORMAT_PATH=${CTOOLSDEST}
251 WMAKEENV=       ${CROSSENV} \
252                 DESTDIR=${WORLDDEST} \
253                 INSTALL="sh ${.CURDIR}/tools/install.sh" \
254                 PATH=${STRICTTMPPATH}
256 WMAKE=          ${WMAKEENV} ${MAKE} -f Makefile.inc1
258 # install stage
260 IMAKEENV=       ${CROSSENV} \
261                 PATH=${STRICTTMPPATH}
262 IMAKE=          ${IMAKEENV} ${MAKE} -f Makefile.inc1
264 # kernel stage
266 KMAKEENV=       ${WMAKEENV}
268 # buildworld
270 # Attempt to rebuild the entire system, with reasonable chance of
271 # success, regardless of how old your existing system is.
273 _worldtmp:
274         @echo
275         @echo "--------------------------------------------------------------"
276         @echo ">>> Rebuilding the temporary build tree"
277         @echo "--------------------------------------------------------------"
278 .if !defined(NOCLEAN)
279         rm -rf ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST}
280 .else
281         # XXX - These two can depend on any header file.
282         rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
283         rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
284 .endif
285         mkdir -p ${DESTDIRBASE} ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST}
286 .for _dir in ${WORLDDEST} ${BTOOLSDEST} ${CTOOLSDEST}
287         mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist        \
288                 -p ${_dir}/  > /dev/null
289         mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist         \
290                 -p ${_dir}/usr > /dev/null
291 .endfor
292         mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist     \
293                 -p ${WORLDDEST}/usr/include > /dev/null
294         ${LN} -sf ${.CURDIR}/sys ${WORLDDEST}
296 _bootstrap-tools:
297         @echo
298         @echo "--------------------------------------------------------------"
299         @echo ">>> stage 1: bootstrap tools"
300         @echo "--------------------------------------------------------------"
301         cd ${.CURDIR}; ${BMAKE} bootstrap-tools
302 _cleanobj:
303         @echo
304         @echo "--------------------------------------------------------------"
305         @echo ">>> stage 2a: cleaning up the object tree"
306         @echo "--------------------------------------------------------------"
307         cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
308 _obj:
309         @echo
310         @echo "--------------------------------------------------------------"
311         @echo ">>> stage 2b: rebuilding the object tree"
312         @echo "--------------------------------------------------------------"
313         cd ${.CURDIR}; ${WMAKE} par-obj
314 _build-tools:
315         @echo
316         @echo "--------------------------------------------------------------"
317         @echo ">>> stage 2c: build tools"
318         @echo "--------------------------------------------------------------"
319         cd ${.CURDIR}; ${TMAKE} build-tools
320 _cross-tools:
321         @echo
322         @echo "--------------------------------------------------------------"
323         @echo ">>> stage 3: cross tools"
324         @echo "--------------------------------------------------------------"
325         cd ${.CURDIR}; ${XMAKE} cross-tools
326 _includes:
327         @echo
328         @echo "--------------------------------------------------------------"
329         @echo ">>> stage 4a: populating ${WORLDDEST}/usr/include"
330         @echo "--------------------------------------------------------------"
331         cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
332 _libraries:
333         @echo
334         @echo "--------------------------------------------------------------"
335         @echo ">>> stage 4b: building libraries"
336         @echo "--------------------------------------------------------------"
337         cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries
338 _depend:
339         @echo
340         @echo "--------------------------------------------------------------"
341         @echo ">>> stage 4c: make dependencies"
342         @echo "--------------------------------------------------------------"
343         cd ${.CURDIR}; ${WMAKE} par-depend
344 everything:
345         @echo
346         @echo "--------------------------------------------------------------"
347         @echo ">>> stage 4d: building everything.."
348         @echo "--------------------------------------------------------------"
349         cd ${.CURDIR}; ${WMAKE} all
351 # note: buildworld no longer depends on _cleanobj because we rm -rf the
352 # entire object tree and built the bootstrap tools in a different location.
354 # buildworld    - build everything from scratch
355 # quickworld    - skip the bootstrap, build, and cross-build steps
356 # realquickworld - skip the bootstrap, build, crossbuild, and depend step.
358 # note: we include _obj in realquickworld to prevent accidental creation
359 # of files in /usr/src.
361 WMAKE_TGTS=
362 .if !defined(SUBDIR_OVERRIDE)
363 WMAKE_TGTS+=    _worldtmp _bootstrap-tools
364 .endif
365 WMAKE_TGTS+=    _obj _build-tools
366 .if !defined(SUBDIR_OVERRIDE)
367 WMAKE_TGTS+=    _cross-tools
368 .endif
369 WMAKE_TGTS+=    _includes _libraries _depend everything
371 buildworld: ${WMAKE_TGTS}
373 quickworld: _obj _includes _libraries _depend everything
375 realquickworld: _obj _includes _libraries everything
377 crossworld: _worldtmp _bootstrap-tools _obj _build-tools _cross-tools
379 .ORDER: ${WMAKE_TGTS}
382 # installcheck
384 # Checks to be sure system is ready for installworld
386 installcheck:
387 .if !defined(NO_SENDMAIL)
388         @pw usershow smmsp || (echo "You may need to run 'make preupgrade' first"; exit 1)
389         @pw groupshow smmsp || (echo "You may need to run 'make preupgrade' first"; exit 1)
390 .endif
391         @pw usershow _pflogd || (echo "You may need to run 'make preupgrade' first"; exit 1)
392         @pw usershow _ntp || (echo "You may need to run 'make preupgrade' first"; exit 1)
393         @pw groupshow authpf || (echo "You may need to run 'make preupgrade' first"; exit 1)
394         @pw groupshow _pflogd || (echo "You may need to run 'make preupgrade' first"; exit 1)
395         @pw groupshow _ntp || (echo "You may need to run 'make preupgrade' first"; exit 1)
396 .if !defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/"
397         @case `uname -r` in 1.2*|1.3-*|1.3.0-*|1.3.1-*|1.3.2-*|1.3.3-*|1.3.4-*) echo "You must upgrade your kernel to at least 1.3.5 and reboot before you can safely installworld, due to stat(2) and dirent ABI changes" ; exit 1;; esac
398 .endif
400 # distributeworld
402 # Distributes everything compiled by a `buildworld'.
404 # installworld
406 # Installs everything compiled by a 'buildworld'.
408 distributeworld installworld: installcheck
409         cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
412 # reinstall
414 # If you have a build server, you can NFS mount the source and obj directories
415 # and do a 'make reinstall' on the *client* to install new binaries from the
416 # most recent server build.
418 reinstall:
419         @echo "--------------------------------------------------------------"
420         @echo ">>> Making hierarchy"
421         @echo "--------------------------------------------------------------"
422         cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
423         @echo
424         @echo "--------------------------------------------------------------"
425         @echo ">>> Installing everything.."
426         @echo "--------------------------------------------------------------"
427         cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
428 .if !defined(NOMAN) && !defined(NO_MAKEDB_RUN)
429         @echo
430         @echo "--------------------------------------------------------------"
431         @echo ">>> Rebuilding man page indices"
432         @echo "--------------------------------------------------------------"
433         cd ${.CURDIR}/share/man; ${MAKE} makedb
434 .endif
436 redistribute:
437         @echo "--------------------------------------------------------------"
438         @echo ">>> Distributing everything.."
439         @echo "--------------------------------------------------------------"
440         cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
443 # buildkernel, nativekernel, quickkernel, and installkernel
445 # Which kernels to build and/or install is specified by setting
446 # KERNCONF. If not defined a GENERIC kernel is built/installed.
447 # Only the existing (depending TARGET) config files are used
448 # for building kernels and only the first of these is designated
449 # as the one being installed.
451 # You can specify INSTALLSTRIPPED=1 if you wish the installed 
452 # kernel and modules to be stripped of its debug info (required
453 # symbols are left intact).  You can specify INSTALLSTRIPPEDMODULES
454 # if you only want to strip the modules of their debug info.  These
455 # only apply if you have DEBUG=-g in your kernel config or make line.
457 # Note that we have to use TARGET instead of TARGET_ARCH when
458 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
459 # be set to cross-build, we have to make sure TARGET is set
460 # properly.
462 .if !defined(KERNCONF) && defined(KERNEL)
463 KERNCONF=       ${KERNEL}
464 KERNWARN=       yes
465 .else
466 KERNCONF?=      GENERIC
467 .endif
468 INSTKERNNAME?=  kernel
470 KRNLSRCDIR=     ${.CURDIR}/sys
471 KRNLCONFDIR=    ${KRNLSRCDIR}/${TARGET}/conf
472 KRNLOBJDIR=     ${OBJTREE}${KRNLSRCDIR}
473 KERNCONFDIR?=   ${KRNLCONFDIR}
475 BUILDKERNELS=
476 INSTALLKERNEL=
477 .for _kernel in ${KERNCONF}
478 .if exists(${KERNCONFDIR}/${_kernel})
479 BUILDKERNELS+=  ${_kernel}
480 .if empty(INSTALLKERNEL)
481 INSTALLKERNEL= ${_kernel}
482 .endif
483 .endif
484 .endfor
486 # kernel version numbers survive rm -rf
488 .for _kernel in ${BUILDKERNELS}
489 .if exists(${KRNLOBJDIR}/${_kernel}/version)
490 KERNEL_VERSION_${_kernel} != cat ${KRNLOBJDIR}/${_kernel}/version
491 .endif
492 .endfor
495 # buildkernel
497 # Builds all kernels defined by BUILDKERNELS.
499 bk_tools:
500         @if [ ! -f ${WORLDDEST}/.libraries_done ]; then \
501             echo "You must buildworld before buildkernel.  If you wish"; \
502             echo "to build a kernel using native tools, config it manually"; \
503             echo "or use the nativekernel target if you are in a rush"; \
504             exit 1; \
505         fi
507 maybe_bk_tools:
508 .for _kernel in ${BUILDKERNELS}
509         @if [ ! -f ${KRNLOBJDIR}/${_kernel}/.nativekernel_run ]; then \
510             if [ ! -f ${WORLDDEST}/.libraries_done ]; then \
511                 echo "The kernel was build using buildworld tools which no" ; \
512                 echo "longer appear to exist, quickkernel failed!" ; \
513                 exit 1; \
514             fi; \
515         fi
516 .endfor
518 bk_build_list:
519 .if empty(BUILDKERNELS)
520         @echo ">>> ERROR: Missing kernel configuration file(s) (${KERNCONF})."
521         @false
522 .endif
524 bk_kernwarn:
525 .if defined(KERNWARN)
526         @echo "--------------------------------------------------------------"
527         @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
528         @echo "--------------------------------------------------------------"
529         @sleep 3
530 .endif
531         @echo
533 # The buildkernel target rebuilds the specified kernels from scratch
534 # using the crossbuild tools generated by the last buildworld.  It is
535 # the safest (but also the most time consuming) way to build a new kernel.
537 buildkernel:    bk_tools bk_build_list bk_kernwarn
538 .for _kernel in ${BUILDKERNELS}
539         @echo "--------------------------------------------------------------"
540         @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
541         @echo "--------------------------------------------------------------"
542         @echo "===> ${_kernel}"
543 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
544         rm -rf ${KRNLOBJDIR}/${_kernel}
545 .else
546         @if [ -f ${KRNLOBJDIR}/${_kernel}/.nativekernel_run ]; then \
547                 echo "YOU ARE REBUILDING WITH BUILDKERNEL, REMOVING OLD NATIVEKERNEL BUILD"; \
548                 rm -rf ${KRNLOBJDIR}/${_kernel}; fi
549 .endif
550         mkdir -p ${KRNLOBJDIR}
551 .if !defined(NO_KERNELCONFIG)
552         cd ${KRNLCONFDIR}; \
553                 PATH=${STRICTTMPPATH} \
554                     config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
555                         ${KERNCONFDIR}/${_kernel}
556 .endif
557 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) && defined(KERNEL_VERSION_${_kernel})
558         echo ${KERNEL_VERSION_${_kernel}} > ${KRNLOBJDIR}/${_kernel}/version
559 .endif
560         touch ${KRNLOBJDIR}/${_kernel}/.buildkernel_run
561         cd ${KRNLOBJDIR}/${_kernel}; \
562             MAKESRCPATH=${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm \
563             ${MAKE} -DBOOTSTRAPPING -f ${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm/Makefile
564 .if !defined(NO_KERNELDEPEND)
565         cd ${KRNLOBJDIR}/${_kernel}; \
566             ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend
567 .endif
568         cd ${KRNLOBJDIR}/${_kernel}; \
569             ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all
570         @echo "--------------------------------------------------------------"
571         @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
572         @echo "--------------------------------------------------------------"
573 .endfor
575 # The nativekernel target rebuilds the specified kernels from scratch
576 # using the systems standard compiler rather then using the crossbuild
577 # tools generated by the last buildworld.  This is fairly safe if your
578 # system is reasonable up-to-date.
580 nativekernel:   bk_build_list bk_kernwarn
581 .for _kernel in ${BUILDKERNELS}
582         @echo "--------------------------------------------------------------"
583         @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
584         @echo "--------------------------------------------------------------"
585         @echo "===> ${_kernel}"
586 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
587         rm -rf ${KRNLOBJDIR}/${_kernel}
588 .else
589         @if [ -f ${KRNLOBJDIR}/${_kernel}/.buildkernel_run ]; then \
590                 echo "YOU ARE REBUILDING WITH NATIVEKERNEL, REMOVING OLD BUILDKERNEL BUILD"; \
591                 rm -rf ${KRNLOBJDIR}/${_kernel}; fi
592 .endif
593         mkdir -p ${KRNLOBJDIR}
594 .if !defined(NO_KERNELCONFIG)
595         cd ${KRNLCONFDIR}; \
596                     config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
597                         ${KERNCONFDIR}/${_kernel}
598 .endif
599 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) && defined(KERNEL_VERSION_${_kernel})
600         echo ${KERNEL_VERSION_${_kernel}} > ${KRNLOBJDIR}/${_kernel}/version
601 .endif
602         touch ${KRNLOBJDIR}/${_kernel}/.nativekernel_run
603         cd ${KRNLOBJDIR}/${_kernel}; \
604             MAKESRCPATH=${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm \
605             ${MAKE} -DBOOTSTRAPPING -f ${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm/Makefile
606 .if !defined(NO_KERNELDEPEND)
607         cd ${KRNLOBJDIR}/${_kernel}; \
608             ${MAKE} KERNEL=${INSTKERNNAME} depend
609 .endif
610         cd ${KRNLOBJDIR}/${_kernel}; \
611             ${MAKE} KERNEL=${INSTKERNNAME} all
612         @echo "--------------------------------------------------------------"
613         @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
614         @echo "--------------------------------------------------------------"
615 .endfor
617 # The quickkernel target rebuilds the specified kernels as quickly
618 # as possible.  It will use the native tools or the buildworld cross tools
619 # based on whether the kernel was originally generated via buildkernel or
620 # nativekernel.  Config is rerun but the object hierarchy is not rebuilt,
621 # nor is the make depend step run.
623 quickkernel:    maybe_bk_tools bk_build_list bk_kernwarn
624 .for _kernel in ${BUILDKERNELS}
625         @echo "--------------------------------------------------------------"
626         @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
627         @echo "--------------------------------------------------------------"
628         @echo "===> ${_kernel}"
629 .if exists(${KRNLOBJDIR}/${_kernel}/.buildkernel_run)
630 .if !defined(NO_KERNELCONFIG)
631         cd ${KRNLCONFDIR}; \
632                 PATH=${STRICTTMPPATH} \
633                     config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
634                         ${KERNCONFDIR}/${_kernel}
635 .endif
636         cd ${KRNLOBJDIR}/${_kernel}; \
637             ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all
638 .else
639 .if !defined(NO_KERNELCONFIG)
640         cd ${KRNLCONFDIR}; \
641             config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
642                 ${KERNCONFDIR}/${_kernel}
643 .endif
644         cd ${KRNLOBJDIR}/${_kernel}; \
645             ${MAKE} KERNEL=${INSTKERNNAME} all
646 .endif
647         @echo "--------------------------------------------------------------"
648         @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
649         @echo "--------------------------------------------------------------"
650 .endfor
653 # installkernel
655 # Install the kernel defined by INSTALLKERNEL
657 installkernel reinstallkernel:
658 .if exists(${KRNLOBJDIR}/${_kernel}/.buildkernel_run)
659         cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
660             ${CROSSENV} ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
661 .else
662         cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
663             ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
664 .endif
667 # update
669 # Update the source tree, by running sup and/or running cvs to update to the
670 # latest copy.
672 update:
673 .if defined(SUP_UPDATE)
674         @echo "--------------------------------------------------------------"
675         @echo ">>> Running ${SUP}"
676         @echo "--------------------------------------------------------------"
677 .if defined(SUPFILE)
678         @${SUP} ${SUPFLAGS} ${SUPFILE}
679 .endif
680 .if defined(SUPFILE1)
681         @${SUP} ${SUPFLAGS} ${SUPFILE1}
682 .endif
683 .if defined(SUPFILE2)
684         @${SUP} ${SUPFLAGS} ${SUPFILE2}
685 .endif
686 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
687         @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
688 .endif
689 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
690         @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
691 .endif
692 .endif
693 .if defined(CVS_UPDATE)
694         @echo "--------------------------------------------------------------"
695         @echo ">>> Updating ${.CURDIR} from cvs repository `cat ${.CURDIR}/CVS/Root`"
696         @echo "--------------------------------------------------------------"
697         @sleep 2
698         cd ${.CURDIR}; cvs -q update -P -d
699 .endif
702 # most
704 # Build most of the user binaries on the existing system libs and includes.
706 most:
707         @echo "--------------------------------------------------------------"
708         @echo ">>> Building programs only"
709         @echo "--------------------------------------------------------------"
710 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin
711         cd ${.CURDIR}/${_dir};          ${MAKE} DIRPRFX=${_dir}/ all
712 .endfor
715 # installmost
717 # Install the binaries built by the 'most' target.  This does not include
718 # libraries or include files.
720 installmost:
721         @echo "--------------------------------------------------------------"
722         @echo ">>> Installing 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}/ install
726 .endfor
729 # ------------------------------------------------------------------------
731 # From here onwards are utility targets used by the 'make world' and
732 # related targets.  If your 'world' breaks, you may like to try to fix
733 # the problem and manually run the following targets to attempt to
734 # complete the build.  Beware, this is *not* guaranteed to work, you
735 # need to have a pretty good grip on the current state of the system
736 # to attempt to manually finish it.  If in doubt, 'make world' again.
739 # bootstrap-tools: Build all tools required to build all tools.  Note that
740 # order is important in a number of cases and also note that the bootstrap
741 # and build tools stages have access to earlier binaries they themselves
742 # had generated.
744 # patch:        older patch's do not have -i.  This program must be built
745 #               first so other bootstrap tools that need to apply patches
746 #               can use it.
747 # [x]install:   dependancies on various new install features
748 # rpcgen:       old rpcgen used a hardwired cpp path, newer OBJFORMAT_PATH
749 #               envs are not compatible with older objformat binaries.
751 .if exists(${.CURDIR}/games) && !defined(NO_GAMES)
752 _strfile=       games/fortune/strfile
753 .endif
755 bootstrap-tools:
756         ${LN} -fs /bin/date ${BTOOLSDEST}/bin/date
757 .for _tool in ${_strfile} \
758     usr.bin/patch \
759     bin/chmod bin/cp bin/dd bin/mkdir bin/rm bin/echo bin/test \
760     bin/cat bin/ln bin/mv bin/csh bin/expr bin/sh \
761     bin/hostname bin/kill \
762     usr.bin/yacc usr.bin/colldef usr.bin/uudecode usr.bin/xinstall \
763     usr.bin/m4 usr.bin/rpcgen usr.bin/make usr.bin/awk usr.bin/stat \
764     usr.bin/find usr.bin/lex usr.bin/sed usr.bin/uname usr.bin/touch \
765     usr.bin/mkdep usr.bin/mktemp usr.bin/lorder usr.bin/file2c \
766     usr.bin/tsort usr.bin/tr usr.bin/join usr.bin/wc usr.bin/basename \
767     usr.bin/gencat usr.bin/chflags usr.bin/expand usr.bin/paste \
768     usr.bin/mklocale usr.bin/uuencode usr.bin/compile_et usr.bin/hexdump \
769     usr.bin/vi usr.bin/cap_mkdb usr.bin/vgrind usr.bin/true usr.bin/false \
770     usr.bin/cmp usr.bin/xargs usr.bin/id usr.bin/env usr.bin/dirname \
771     usr.bin/tail \
772     usr.sbin/chown usr.sbin/mtree usr.sbin/config \
773     usr.sbin/btxld usr.sbin/pwd_mkdb usr.sbin/zic usr.sbin/makewhatis \
774     gnu/usr.bin/texinfo gnu/usr.bin/grep gnu/usr.bin/sort \
775     usr.bin/gzip usr.bin/bzip2 usr.bin/mkcsmapper usr.bin/mkesdb
776         ${ECHODIR} "===> ${_tool} (bootstrap-tools)"; \
777                 cd ${.CURDIR}/${_tool}; \
778                 ${MAKE} DIRPRFX=${_tool}/ obj; \
779                 ${MAKE} DIRPRFX=${_tool}/ depend; \
780                 ${MAKE} DIRPRFX=${_tool}/ all; \
781                 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${BTOOLSDEST} install
782 .endfor
783         touch ${BTOOLSDEST}/.bootstrap_done
785 # build-tools: Build special purpose build tools.
787 # XXX we may be able to remove or consolidate this into bootstrap-tools
788 # now that we have the native helper (.nx/.no) infrastructure.
790 .if exists(${.CURDIR}/games) && !defined(NO_GAMES)
791 _games= games/adventure games/hack games/phantasia
792 .endif
794 .if exists(${.CURDIR}/share) && !defined(NO_SHARE)
795 _share= share/syscons/scrnmaps
796 .endif
798 _gcc34_cross= gnu/usr.bin/cc34
799 _gcc34_tools= gnu/usr.bin/cc34/cc_prep gnu/usr.bin/cc34/cc_tools
800 .if defined(WANT_GCC40)
801 _gcc40_cross= gnu/usr.bin/cc40
802 _gcc40_tools= gnu/usr.bin/cc40/cc_prep gnu/usr.bin/cc40/cc_tools
803 .endif
804 _binutils= gnu/usr.bin/binutils215
806 .if !defined(NO_FORTRAN)
807 _fortran= gnu/usr.bin/cc34/f771
808 .endif
810 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
811     !defined(NO_CRYPT) && defined(WANT_KERBEROS)
812 _libkrb5= kerberos5/tools kerberos5/lib/libroken kerberos5/lib/libvers \
813     kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl
814 .endif
816 build-tools:
817 .for _tool in ${_gcc34_tools} ${_gcc40_tools} ${_fortran} ${_libkrb5} ${_share}
818         ${ECHODIR} "===> ${_tool} (build-tools)"; \
819                 cd ${.CURDIR}/${_tool}; \
820                 ${MAKE} DIRPRFX=${_tool}/ obj; \
821                 ${MAKE} DIRPRFX=${_tool}/ depend; \
822                 ${MAKE} DIRPRFX=${_tool}/ all; \
823                 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${BTOOLSDEST} install
824 .endfor
825         touch ${BTOOLSDEST}/.build_done
828 # cross-tools: Build cross-building tools
830 .if ${TARGET_ARCH} == "i386" && ${MACHINE_ARCH} != "i386"
831 _btxld= usr.sbin/btxld
832 .endif
834 cross-tools:
835 .for _tool in ${_btxld} ${_binutils} \
836               usr.bin/objformat usr.sbin/crunch/crunchide \
837               ${_gcc34_cross} ${_gcc40_cross}
838         ${ECHODIR} "===> ${_tool} (cross-tools)"; \
839                 cd ${.CURDIR}/${_tool}; \
840                 ${MAKE} DIRPRFX=${_tool}/ obj; \
841                 ${MAKE} DIRPRFX=${_tool}/ depend; \
842                 ${MAKE} DIRPRFX=${_tool}/ all; \
843                 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${CTOOLSDEST} install
844 .endfor
845         touch ${CTOOLSDEST}/.cross_done
848 # hierarchy - ensure that all the needed directories are present
850 hierarchy:
851         cd ${.CURDIR}/etc;              ${MAKE} distrib-dirs
854 # libraries - build all libraries, and install them under ${DESTDIR}.
856 # The list of libraries with dependents (${_prebuild_libs}) and their
857 # interdependencies (__L) are built automatically by the
858 # ${.CURDIR}/tools/make_libdeps.sh script.
860 # .makeenv does not work when bootstrapping from 4.x, so we must be sure
861 # to specify the correct CCVER or 'cc' will not exec the correct compiler.
863 libraries:
864         cd ${.CURDIR}; \
865             HOST_CCVER=${HOST_CCVER} CCVER=gcc34 \
866                 ${MAKE} -f Makefile.inc1 _startup_libs34;
867 .if defined(WANT_GCC40)
868         cd ${.CURDIR}; \
869             HOST_CCVER=${HOST_CCVER} CCVER=gcc40 \
870                 ${MAKE} -f Makefile.inc1 _startup_libs40;
871 .endif
872         cd ${.CURDIR}; \
873             ${MAKE} -f Makefile.inc1 _startup_libs; \
874             ${MAKE} -f Makefile.inc1 _prebuild_libs; \
875             ${MAKE} -f Makefile.inc1 _generic_libs;
876         touch ${WORLDDEST}/.libraries_done
878 # These dependencies are not automatically generated:
880 # gnu/lib/${CCVER}/libgcc and lib/csu must be built before all
881 # shared libraries for ELF.  The target for _startup_libs34 is
882 # specifically built using gcc34.  Same goes for _startup_libs40.
884 _startup_libs34=        gnu/lib/gcc34/libgcc
885 _startup_libs40=        gnu/lib/gcc40/libgcc
886 _startup_libs=  lib/csu/${MACHINE_ARCH}
887 _startup_libs+= lib/csu/common lib/libc lib/libc_rtld
889 _prebuild_libs= lib/libarchive
890 _prebuild_libs+=        lib/libutil
892 _generic_libs=  gnu/lib
894 .if !defined(NO_CRYPT) && defined(WANT_KERBEROS)
895 _prebuild_libs+=        kerberos5/tools
896 _prebuild_libs+=        kerberos5/lib/libasn1
897 _prebuild_libs+=        kerberos5/lib/libgssapi
898 _prebuild_libs+=        kerberos5/lib/libkrb5
899 _prebuild_libs+=        kerberos5/lib/libroken
900 _generic_libs+= kerberos5/lib
901 .endif
903 _prebuild_libs+= lib/libcom_err lib/libcrypt lib/libmd \
904                 lib/libncurses/libncurses lib/libopie lib/libradius \
905                 lib/libskey lib/libtacplus lib/libz lib/libm lib/libpam
907 lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L
908 lib/libskey__L: lib/libcrypt__L lib/libmd__L
910 _generic_libs+= lib
912 .if !defined(NO_CRYPT)
913 .if !defined(NO_OPENSSL)
914 _prebuild_libs+=        secure/lib/libcrypto secure/lib/libssl
915 .if !defined(NO_OPENSSH)
916 _prebuild_libs+=        secure/lib/libssh
917 secure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L
918 .endif
919 .endif
920 _generic_libs+= secure/lib
921 .endif
923 _generic_libs+= usr.bin/lex/lib
925 .for _lib in ${_startup_libs34} ${_startup_libs40} \
926                 ${_startup_libs} ${_prebuild_libs} ${_generic_libs}
927 ${_lib}__L: .PHONY
928 .if exists(${.CURDIR}/${_lib})
929         ${ECHODIR} "===> ${_lib}"; \
930                 cd ${.CURDIR}/${_lib}; \
931                 ${MAKE} DIRPRFX=${_lib}/ depend; \
932                 ${MAKE} DIRPRFX=${_lib}/ all; \
933                 ${MAKE} DIRPRFX=${_lib}/ install
934 .endif
935 .endfor
937 _startup_libs: ${_startup_libs:S/$/__L/}
938 _startup_libs34: ${_startup_libs34:S/$/__L/}
939 _startup_libs40: ${_startup_libs40:S/$/__L/}
940 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
941 _generic_libs: ${_generic_libs:S/$/__L/}
943 # library targets must be ordered because there are inter-library
944 # races (e.g. generation of tconfig.h)
946 .ORDER: ${_startup_libs34:S/$/__L/}
947 .ORDER: ${_startup_libs40:S/$/__L/}
948 .ORDER: ${_startup_libs:S/$/__L/}
949 .ORDER: ${_prebuild_libs:S/$/__L/}
950 .ORDER: ${_generic_libs:S/$/__L/}
952 .for __target in clean cleandepend cleandir obj depend includes
953 .for entry in ${SUBDIR}
954 ${entry}.${__target}__D: .PHONY
955         @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
956                 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
957                 edir=${entry}.${MACHINE_ARCH}; \
958                 cd ${.CURDIR}/$${edir}; \
959         else \
960                 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
961                 edir=${entry}; \
962                 cd ${.CURDIR}/$${edir}; \
963         fi; \
964         ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
965 .endfor
966 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
967 .ORDER: ${SUBDIR:S/$/.${__target}__D/}
968 .endfor
969 .ORDER: par-clean par-cleandepend par-cleandir par-obj par-depend par-includes
971 # The wmake target is used by /usr/bin/wmake to run make in a
972 # world build environment.
974 wmake:
975         @echo '${WMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${WMAKE_ARGS}'
977 wmakeenv:
978         @echo '${WMAKEENV} /bin/sh'
980 bmake:
981         @echo '${BMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${BMAKE_ARGS}'
983 bmakeenv:
984         @echo '${BMAKEENV} /bin/sh'
986 tmake:
987         @echo '${TMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${TMAKE_ARGS}'
989 tmakeenv:
990         @echo '${TMAKEENV} /bin/sh'
992 .include <bsd.subdir.mk>