]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - Makefile.inc1
This commit was generated by cvs2svn to compensate for changes in r122137,
[FreeBSD/FreeBSD.git] / Makefile.inc1
1 #
2 # $FreeBSD$
3 #
4 # Make command line options:
5 #       -DNO_KERBEROS Do not build Heimdal (Kerberos 5)
6 #       -DNO_RESCUE do not build rescue binaries
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 #
26 # The intended user-driven targets are:
27 # buildworld  - rebuild *everything*, including glue to help do upgrades
28 # installworld- install everything built by "buildworld"
29 # update      - convenient way to update your source tree (eg: sup/cvs)
30 #
31 # Standard targets (not defined here) are documented in the makefiles in
32 # /usr/share/mk.  These include:
33 #               obj depend all install clean cleandepend cleanobj
34
35 # Put initial settings here.
36 SUBDIR=
37
38 # We must do share/info early so that installation of info `dir'
39 # entries works correctly.  Do it first since it is less likely to
40 # grow dependencies on include and lib than vice versa.
41 .if exists(${.CURDIR}/share/info)
42 SUBDIR+= share/info
43 .endif
44
45 .if exists(${.CURDIR}/include)
46 SUBDIR+= include
47 .endif
48 .if exists(${.CURDIR}/lib)
49 SUBDIR+= lib
50 .endif
51
52 # When upgrading to a dynamically linked root, install the runtime
53 # linker early into its new location before make(1) has a chance
54 # to run the dynamically linked /bin/sh.
55 .if defined(WITH_DYNAMICROOT) && !defined(NOPIC) && \
56     (!defined(TARGET_ARCH) || ${TARGET_ARCH} == ${MACHINE_ARCH}) && \
57     !defined(DISTDIR) && \
58     (!defined(DESTDIR) || empty(DESTDIR) || ${DESTDIR} == "/") && \
59     !exists(/libexec/ld-elf.so.1)
60 SUBDIR+= libexec/rtld-elf
61 .endif
62
63 .if exists(${.CURDIR}/bin)
64 SUBDIR+= bin
65 .endif
66 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
67 SUBDIR+= games
68 .endif
69 .if exists(${.CURDIR}/gnu)
70 SUBDIR+= gnu
71 .endif
72 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
73     !defined(NOCRYPT) && !defined(NO_OPENSSL) && !defined(NO_KERBEROS)
74 SUBDIR+= kerberos5
75 .endif
76 .if exists(${.CURDIR}/libexec)
77 SUBDIR+= libexec
78 .endif
79 .if exists(${.CURDIR}/rescue) && !defined(NO_RESCUE)
80 SUBDIR+= rescue
81 .endif
82 .if exists(${.CURDIR}/sbin)
83 SUBDIR+= sbin
84 .endif
85 .if exists(${.CURDIR}/secure) && !defined(NOCRYPT)
86 SUBDIR+= secure
87 .endif
88 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
89 SUBDIR+= share
90 .endif
91 .if exists(${.CURDIR}/sys)
92 SUBDIR+= sys
93 .endif
94 .if exists(${.CURDIR}/usr.bin)
95 SUBDIR+= usr.bin
96 .endif
97 .if exists(${.CURDIR}/usr.sbin)
98 SUBDIR+= usr.sbin
99 .endif
100
101 # etc must be last for "distribute" to work
102 .if exists(${.CURDIR}/etc)
103 SUBDIR+= 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)
111 SUBDIR+= ${_DIR}
112 .endif
113 .endfor
114 .endif
115
116 .if defined(SUBDIR_OVERRIDE)
117 SUBDIR=         ${SUBDIR_OVERRIDE}
118 .endif
119
120 .if defined(NOCLEANDIR)
121 CLEANDIR=       clean cleandepend
122 .else
123 CLEANDIR=       cleandir
124 .endif
125
126 CVS?=           cvs
127 SUP?=           /usr/local/bin/cvsup
128 SUPFLAGS?=      -g -L 2 -P -
129 .if defined(SUPHOST)
130 SUPFLAGS+=      -h ${SUPHOST}
131 .endif
132
133 MAKEOBJDIRPREFIX?=      /usr/obj
134 .if !defined(OSRELDATE)
135 .if exists(/usr/include/osreldate.h)
136 OSRELDATE!=     awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
137                 /usr/include/osreldate.h
138 .else
139 OSRELDATE=      0
140 .endif
141 .endif
142 TARGET_ARCH?=   ${MACHINE_ARCH}
143 .if ${TARGET_ARCH} == ${MACHINE_ARCH}
144 TARGET?=        ${MACHINE}
145 TARGET_CPUTYPE?=${CPUTYPE}
146 .else
147 TARGET?=        ${TARGET_ARCH}
148 TARGET_CPUTYPE?=
149 .endif
150 .if !empty(TARGET_CPUTYPE)
151 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
152 .else
153 _TARGET_CPUTYPE=dummy
154 .endif
155 _CPUTYPE!=      ${MAKE} -f /dev/null -m ${.CURDIR}/share/mk \
156                 CPUTYPE=${_TARGET_CPUTYPE} -V CPUTYPE
157 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
158 .error CPUTYPE global should be set with ?=.
159 .endif
160 .if make(buildworld)
161 BUILD_ARCH!=    sysctl -n hw.machine_arch
162 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
163 .error To cross-build, set TARGET_ARCH.
164 .endif
165 .endif
166 .if ${MACHINE} == ${TARGET}
167 OBJTREE=        ${MAKEOBJDIRPREFIX}
168 .else
169 OBJTREE=        ${MAKEOBJDIRPREFIX}/${TARGET}
170 .endif
171 WORLDTMP=       ${OBJTREE}${.CURDIR}/${MACHINE_ARCH}
172 # /usr/games added for fortune which depend on strfile
173 BPATH=          ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games
174 XPATH=          ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
175 STRICTTMPPATH=  ${BPATH}:${XPATH}
176 TMPPATH=        ${STRICTTMPPATH}:${PATH}
177
178 INSTALLTMP!=    /usr/bin/mktemp -d -u -t install
179
180 #
181 # Building a world goes through the following stages
182 #
183 # 1. legacy stage [BMAKE]
184 #       This stage is responsible for creating compatibility
185 #       shims that are needed by the bootstrap-tools,
186 #       build-tools and cross-tools stages.
187 # 1. bootstrap-tools stage [BMAKE]
188 #       This stage is responsible for creating programs that
189 #       are needed for backward compatibility reasons. They
190 #       are not built as cross-tools.
191 # 2. build-tools stage [TMAKE]
192 #       This stage is responsible for creating the object
193 #       tree and building any tools that are needed during
194 #       the build process.
195 # 3. cross-tools stage [XMAKE]
196 #       This stage is responsible for creating any tools that
197 #       are needed for cross-builds. A cross-compiler is one
198 #       of them.
199 # 4. world stage [WMAKE]
200 #       This stage actually builds the world.
201 # 5. install stage (optional) [IMAKE]
202 #       This stage installs a previously built world.
203 #
204
205 BOOTSTRAPPING?= 0
206
207 # Common environment for world related stages
208 CROSSENV=       MAKEOBJDIRPREFIX=${OBJTREE} \
209                 MACHINE_ARCH=${TARGET_ARCH} \
210                 MACHINE=${TARGET} \
211                 CPUTYPE=${TARGET_CPUTYPE} \
212                 GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
213                 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
214                 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
215
216 # bootstrap-tools stage
217 BMAKEENV=       DESTDIR= \
218                 INSTALL="sh ${.CURDIR}/tools/install.sh" \
219                 PATH=${BPATH}:${PATH} \
220                 WORLDTMP=${WORLDTMP} \
221                 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
222 BMAKE=          MAKEOBJDIRPREFIX=${WORLDTMP} \
223                 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
224                 BOOTSTRAPPING=${OSRELDATE} \
225                 -DNOHTML -DNOINFO -DNOLINT -DNOMAN -DNOPIC -DNOPROFILE \
226                 -DNOSHARED -DNO_CPU_CFLAGS -DNO_WARNS
227
228 # build-tools stage
229 TMAKE=          MAKEOBJDIRPREFIX=${OBJTREE} \
230                 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
231                 BOOTSTRAPPING=${OSRELDATE} -DNOLINT -DNO_CPU_CFLAGS -DNO_WARNS
232
233 # cross-tools stage
234 XMAKE=          TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB
235
236 # world stage
237 WMAKEENV=       ${CROSSENV} \
238                 DESTDIR=${WORLDTMP} \
239                 _SHLIBDIRPREFIX=${WORLDTMP} \
240                 INSTALL="sh ${.CURDIR}/tools/install.sh" \
241                 PATH=${TMPPATH}
242 WMAKE=          ${WMAKEENV} ${MAKE} -f Makefile.inc1
243
244 # install stage
245 IMAKEENV=       ${CROSSENV} \
246                 PATH=${STRICTTMPPATH}:${INSTALLTMP}
247 IMAKE=          ${IMAKEENV} ${MAKE} -f Makefile.inc1
248
249 # kernel stage
250 KMAKEENV=       ${WMAKEENV}
251
252 #
253 # buildworld
254 #
255 # Attempt to rebuild the entire system, with reasonable chance of
256 # success, regardless of how old your existing system is.
257 #
258 _worldtmp:
259 .if ${.CURDIR:C/[^,]//g} != ""
260 #       The m4 build of sendmail files doesn't like it if ',' is used
261 #       anywhere in the path of it's files.
262         @echo
263         @echo "*** Error: path to source tree contains a comma ','"
264         @echo
265         @false
266 .endif
267         @echo
268         @echo "--------------------------------------------------------------"
269         @echo ">>> Rebuilding the temporary build tree"
270         @echo "--------------------------------------------------------------"
271 .if !defined(NOCLEAN)
272         rm -rf ${WORLDTMP}
273 .else
274         rm -rf ${WORLDTMP}/legacy/usr/include
275         # XXX - These two can depend on any header file.
276         rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
277         rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
278 .endif
279 .for _dir in \
280     usr/bin usr/games usr/include/sys usr/lib \
281     usr/libexec usr/sbin usr/share/dict \
282     usr/share/groff_font/devX100 \
283     usr/share/groff_font/devX100-12 \
284     usr/share/groff_font/devX75 \
285     usr/share/groff_font/devX75-12 \
286     usr/share/groff_font/devascii \
287     usr/share/groff_font/devcp1047 \
288     usr/share/groff_font/devdvi \
289     usr/share/groff_font/devhtml \
290     usr/share/groff_font/devkoi8-r \
291     usr/share/groff_font/devlatin1 \
292     usr/share/groff_font/devlbp \
293     usr/share/groff_font/devlj4 \
294     usr/share/groff_font/devps \
295     usr/share/groff_font/devutf8 \
296     usr/share/tmac/mdoc usr/share/tmac/mm
297         mkdir -p ${WORLDTMP}/legacy/${_dir}
298 .endfor
299 .for _dir in \
300     lib usr/bin usr/include usr/lib/compat/aout usr/libdata/ldscripts \
301     usr/libexec usr/share/misc
302         mkdir -p ${WORLDTMP}/${_dir}
303 .endfor
304         mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
305             -p ${WORLDTMP}/usr/include
306         ln -sf ${.CURDIR}/sys ${WORLDTMP}
307 _legacy:
308         @echo
309         @echo "--------------------------------------------------------------"
310         @echo ">>> stage 1.1: legacy release compatibility shims"
311         @echo "--------------------------------------------------------------"
312         cd ${.CURDIR}; ${BMAKE} legacy
313 _bootstrap-tools:
314         @echo
315         @echo "--------------------------------------------------------------"
316         @echo ">>> stage 1.2: bootstrap tools"
317         @echo "--------------------------------------------------------------"
318         cd ${.CURDIR}; ${BMAKE} bootstrap-tools
319 _cleanobj:
320 .if !defined(NOCLEAN)
321         @echo
322         @echo "--------------------------------------------------------------"
323         @echo ">>> stage 2.1: cleaning up the object tree"
324         @echo "--------------------------------------------------------------"
325         cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
326 .endif
327 _obj:
328         @echo
329         @echo "--------------------------------------------------------------"
330         @echo ">>> stage 2.2: rebuilding the object tree"
331         @echo "--------------------------------------------------------------"
332         cd ${.CURDIR}; ${WMAKE} par-obj
333 _build-tools:
334         @echo
335         @echo "--------------------------------------------------------------"
336         @echo ">>> stage 2.3: build tools"
337         @echo "--------------------------------------------------------------"
338         cd ${.CURDIR}; ${TMAKE} build-tools
339 _cross-tools:
340         @echo
341         @echo "--------------------------------------------------------------"
342         @echo ">>> stage 3: cross tools"
343         @echo "--------------------------------------------------------------"
344         cd ${.CURDIR}; ${XMAKE} cross-tools
345 _includes:
346         @echo
347         @echo "--------------------------------------------------------------"
348         @echo ">>> stage 4.1: building includes"
349         @echo "--------------------------------------------------------------"
350         cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
351 _libraries:
352         @echo
353         @echo "--------------------------------------------------------------"
354         @echo ">>> stage 4.2: building libraries"
355         @echo "--------------------------------------------------------------"
356         cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG -DNOLINT \
357                 libraries
358 _depend:
359         @echo
360         @echo "--------------------------------------------------------------"
361         @echo ">>> stage 4.3: make dependencies"
362         @echo "--------------------------------------------------------------"
363         cd ${.CURDIR}; ${WMAKE} par-depend
364 everything:
365         @echo
366         @echo "--------------------------------------------------------------"
367         @echo ">>> stage 4.4: building everything.."
368         @echo "--------------------------------------------------------------"
369         cd ${.CURDIR}; ${WMAKE} par-all
370
371
372 WMAKE_TGTS=
373 .if !defined(SUBDIR_OVERRIDE)
374 WMAKE_TGTS+=    _worldtmp _legacy _bootstrap-tools
375 .endif
376 WMAKE_TGTS+=    _cleanobj _obj _build-tools
377 .if !defined(SUBDIR_OVERRIDE)
378 WMAKE_TGTS+=    _cross-tools
379 .endif
380 WMAKE_TGTS+=    _includes _libraries _depend everything
381
382 buildworld: ${WMAKE_TGTS}
383 .ORDER: ${WMAKE_TGTS}
384
385 #
386 # installcheck
387 #
388 # Checks to be sure system is ready for installworld
389 #
390 installcheck:
391 .if !defined(NO_SENDMAIL)
392         @if ! `id -u smmsp > /dev/null`; then \
393                 echo "ERROR: Required smmsp user is missing, see /usr/src/UPDATING."; \
394                 false; \
395         fi
396         @if ! `id -g smmsp > /dev/null`; then \
397                 echo "ERROR: Required smmsp group is missing, see /usr/src/UPDATING."; \
398                 false; \
399         fi
400 .endif
401
402 #
403 # distributeworld
404 #
405 # Distributes everything compiled by a `buildworld'.
406 #
407 # installworld
408 #
409 # Installs everything compiled by a 'buildworld'.
410 #
411 distributeworld installworld: installcheck
412         mkdir -p ${INSTALLTMP}
413         for prog in [ awk cap_mkdb cat chflags chmod chown \
414             date echo egrep find grep \
415             ln make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
416             test true uname wc zic; do \
417                 cp `which $$prog` ${INSTALLTMP}; \
418         done
419         cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
420         rm -rf ${INSTALLTMP}
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 #
429 reinstall:
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
447 redistribute:
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)
468 KERNCONF=       ${KERNEL}
469 KERNWARN=       yes
470 .else
471 KERNCONF?=      GENERIC
472 .endif
473 INSTKERNNAME?=  kernel
474
475 KERNSRCDIR?=    ${.CURDIR}/sys
476 KRNLCONFDIR=    ${KERNSRCDIR}/${TARGET}/conf
477 KRNLOBJDIR=     ${OBJTREE}${KERNSRCDIR}
478 KERNCONFDIR?=   ${KRNLCONFDIR}
479
480 BUILDKERNELS=
481 INSTALLKERNEL=
482 .for _kernel in ${KERNCONF}
483 .if exists(${KERNCONFDIR}/${_kernel})
484 BUILDKERNELS+=  ${_kernel}
485 .if empty(INSTALLKERNEL)
486 INSTALLKERNEL= ${_kernel}
487 .endif
488 .endif
489 .endfor
490
491 #
492 # buildkernel
493 #
494 # Builds all kernels defined by BUILDKERNELS.
495 #
496 buildkernel:
497 .if empty(BUILDKERNELS)
498         @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF}).";
499         @false
500 .endif
501 .if defined(KERNWARN)
502         @echo "--------------------------------------------------------------"
503         @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
504         @echo "--------------------------------------------------------------"
505         @sleep 3
506 .endif
507         @echo
508 .for _kernel in ${BUILDKERNELS}
509         @echo "--------------------------------------------------------------"
510         @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
511         @echo "--------------------------------------------------------------"
512         @echo "===> ${_kernel}"
513         mkdir -p ${KRNLOBJDIR}
514 .if !defined(NO_KERNELCONFIG)
515         cd ${KRNLCONFDIR}; \
516                 PATH=${TMPPATH} \
517                     config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
518                         ${KERNCONFDIR}/${_kernel}
519 .endif
520 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
521         cd ${KRNLOBJDIR}/${_kernel}; \
522             ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} ${CLEANDIR}
523 .endif
524         cd ${KRNLOBJDIR}/${_kernel}; \
525             MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
526             ${MAKE} -DNO_CPU_CFLAGS -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
527         cd ${KRNLOBJDIR}/${_kernel}; \
528             ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} obj
529 # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
530 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
531 .for target in obj depend all
532         cd ${.CURDIR}/sys/modules/aic7xxx/aicasm; \
533             MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
534             ${MAKE} -DNO_CPU_CFLAGS ${target}
535 .endfor
536 .endif
537 .if !defined(NO_KERNELDEPEND)
538         cd ${KRNLOBJDIR}/${_kernel}; \
539             ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend -DNO_MODULES_OBJ
540 .endif
541         cd ${KRNLOBJDIR}/${_kernel}; \
542             ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all -DNO_MODULES_OBJ
543         @echo "--------------------------------------------------------------"
544         @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
545         @echo "--------------------------------------------------------------"
546 .endfor
547
548 #
549 # installkernel
550 #
551 # Install the kernel defined by INSTALLKERNEL
552 #
553 installkernel reinstallkernel installkernel.debug reinstallkernel.debug:
554 .if empty(INSTALLKERNEL)
555         @echo "ERROR: No kernel \"${KERNCONF}\" to install."
556         @false
557 .endif
558         cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
559             ${CROSSENV} PATH=${TMPPATH} \
560             ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
561
562 #
563 # update
564 #
565 # Update the source tree, by running sup and/or running cvs to update to the
566 # latest copy.
567 #
568 update:
569 .if defined(SUP_UPDATE)
570         @echo "--------------------------------------------------------------"
571         @echo ">>> Running ${SUP}"
572         @echo "--------------------------------------------------------------"
573 .if defined(SUPFILE)
574         @${SUP} ${SUPFLAGS} ${SUPFILE}
575 .endif
576 .if defined(SUPFILE1)
577         @${SUP} ${SUPFLAGS} ${SUPFILE1}
578 .endif
579 .if defined(SUPFILE2)
580         @${SUP} ${SUPFLAGS} ${SUPFILE2}
581 .endif
582 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
583         @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
584 .endif
585 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
586         @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
587 .endif
588 .endif
589 .if defined(CVS_UPDATE)
590         @echo "--------------------------------------------------------------"
591         @echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
592         @echo "--------------------------------------------------------------"
593         cd ${.CURDIR}; ${CVS} -R -q update -A -P -d
594 .endif
595
596 #
597 # ------------------------------------------------------------------------
598 #
599 # From here onwards are utility targets used by the 'make world' and
600 # related targets.  If your 'world' breaks, you may like to try to fix
601 # the problem and manually run the following targets to attempt to
602 # complete the build.  Beware, this is *not* guaranteed to work, you
603 # need to have a pretty good grip on the current state of the system
604 # to attempt to manually finish it.  If in doubt, 'make world' again.
605 #
606
607 #
608 # legacy: Build compatibility shims for the next three targets
609 #
610 legacy:
611 .for _tool in tools/build
612         @${ECHODIR} "===> ${_tool}"; \
613             cd ${.CURDIR}/${_tool}; \
614             ${MAKE} DIRPRFX=${_tool}/ obj; \
615             ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
616             ${MAKE} DIRPRFX=${_tool}/ depend; \
617             ${MAKE} DIRPRFX=${_tool}/ all; \
618             ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
619 .endfor
620
621 #
622 # bootstrap-tools: Build tools needed for compatibility
623 #
624 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
625 _strfile=       games/fortune/strfile
626 .endif
627
628 .if !defined(NO_CXX)
629 _gperf= gnu/usr.bin/gperf
630 .if ${BOOTSTRAPPING} < 500113
631 _groff=         gnu/usr.bin/groff
632 .else
633 _groff=         gnu/usr.bin/groff/tmac
634 .endif
635 .endif
636
637 .if ${BOOTSTRAPPING} < 450005 || \
638     ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500034
639 _uudecode=      usr.bin/uudecode
640 .endif
641
642 .if ${BOOTSTRAPPING} < 430002 || \
643     ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500019
644 _xargs=         usr.bin/xargs
645 .endif
646
647 .if ${BOOTSTRAPPING} < 430002 || \
648     ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500018
649 _yacc=          usr.bin/yacc
650 .endif
651
652 .if !defined(NO_RESCUE) && \
653     ${BOOTSTRAPPING} < 501100
654 _crunchgen=     usr.sbin/crunch/crunchgen
655 .endif
656
657 .if ${BOOTSTRAPPING} < 500019
658 _kbdcontrol=    usr.sbin/kbdcontrol
659 .endif
660
661 bootstrap-tools:
662 .for _tool in \
663     ${_strfile} \
664     ${_gperf} \
665     ${_groff} \
666     gnu/usr.bin/texinfo \
667     usr.bin/colldef \
668     usr.bin/makewhatis \
669     usr.bin/rpcgen \
670     ${_uudecode} \
671     ${_xargs} \
672     usr.bin/xinstall \
673     ${_yacc} \
674     usr.sbin/config \
675     ${_crunchgen} \
676     ${_kbdcontrol}
677         @${ECHODIR} "===> ${_tool}"; \
678                 cd ${.CURDIR}/${_tool}; \
679                 ${MAKE} DIRPRFX=${_tool}/ obj; \
680                 ${MAKE} DIRPRFX=${_tool}/ depend; \
681                 ${MAKE} DIRPRFX=${_tool}/ all; \
682                 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
683 .endfor
684
685 #
686 # build-tools: Build special purpose build tools
687 #
688 .if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
689 _aicasm= sys/modules/aic7xxx/aicasm
690 .endif
691
692 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
693 _share= share/syscons/scrnmaps
694 .endif
695
696 .if !defined(NO_FORTRAN)
697 _fortran= gnu/usr.bin/cc/f771
698 .endif
699
700 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
701     !defined(NOCRYPT) && !defined(NO_OPENSSL) && !defined(NO_KERBEROS)
702 _libkrb5= kerberos5/lib/libroken kerberos5/lib/libvers \
703     kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl
704 .endif
705
706 .if exists(${.CURDIR}/rescue) && !defined(NO_RESCUE)
707 _rescue= rescue/rescue
708 .endif
709
710 build-tools:
711 .for _tool in \
712     bin/csh \
713     bin/sh \
714     ${_rescue} \
715     gnu/usr.bin/cc/cc_tools \
716     ${_fortran} \
717     ${_libkrb5} \
718     lib/libncurses \
719     ${_share} \
720     ${_aicasm} \
721     usr.bin/awk \
722     usr.bin/file \
723     usr.sbin/sysinstall
724         @${ECHODIR} "===> ${_tool}"; \
725                 cd ${.CURDIR}/${_tool}; \
726                 ${MAKE} DIRPRFX=${_tool}/ obj; \
727                 ${MAKE} DIRPRFX=${_tool}/ build-tools
728 .endfor
729
730 #
731 # cross-tools: Build cross-building tools
732 #
733 .if ${TARGET_ARCH} == "sparc64" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
734     ${BOOTSTRAPPING} < 500037
735 _elf2aout=      usr.bin/elf2aout
736 .endif
737
738 .if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH}
739 _btxld=         usr.sbin/btxld
740 .endif
741
742 .if (!defined(NO_RESCUE) || \
743     defined(RELEASEDIR)) && \
744     (${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 501101)
745 _crunchide=     usr.sbin/crunch/crunchide
746 .endif
747
748 .if ${TARGET_ARCH} == "alpha" && ${TARGET_ARCH} != ${MACHINE_ARCH}
749 _elf2exe=       usr.sbin/elf2exe
750 .endif
751
752 .if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
753     defined(RELEASEDIR)
754 _kgzip=         usr.sbin/kgzip
755 .endif
756
757 cross-tools:
758 .for _tool in \
759     gnu/usr.bin/binutils \
760     gnu/usr.bin/cc \
761     ${_elf2aout} \
762     usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
763     ${_btxld} \
764     ${_crunchide} \
765     ${_elf2exe} \
766     ${_kgzip}
767         @${ECHODIR} "===> ${_tool}"; \
768                 cd ${.CURDIR}/${_tool}; \
769                 ${MAKE} DIRPRFX=${_tool}/ obj; \
770                 ${MAKE} DIRPRFX=${_tool}/ depend; \
771                 ${MAKE} DIRPRFX=${_tool}/ all; \
772                 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
773 .endfor
774
775 #
776 # hierarchy - ensure that all the needed directories are present
777 #
778 hierarchy:
779         cd ${.CURDIR}/etc;              ${MAKE} distrib-dirs
780
781 #
782 # libraries - build all libraries, and install them under ${DESTDIR}.
783 #
784 # The list of libraries with dependents (${_prebuild_libs}) and their
785 # interdependencies (__L) are built automatically by the
786 # ${.CURDIR}/tools/make_libdeps.sh script.
787 #
788 libraries:
789         cd ${.CURDIR}; \
790             ${MAKE} -f Makefile.inc1 _startup_libs; \
791             ${MAKE} -f Makefile.inc1 _prebuild_libs; \
792             ${MAKE} -f Makefile.inc1 _generic_libs;
793
794 # These dependencies are not automatically generated:
795 #
796 # gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all
797 # shared libraries for ELF.
798 #
799 _startup_libs=  gnu/lib/csu gnu/lib/libgcc
800 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
801 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
802 .else
803 _startup_libs+= lib/csu/${MACHINE_ARCH}
804 .endif
805
806 _prebuild_libs=
807
808 _generic_libs=  gnu/lib
809
810 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
811     !defined(NOCRYPT) && !defined(NO_OPENSSL) && !defined(NO_KERBEROS)
812 _prebuild_libs+=        kerberos5/lib/libasn1
813 _prebuild_libs+=        kerberos5/lib/libgssapi
814 _prebuild_libs+=        kerberos5/lib/libkrb5
815 _prebuild_libs+=        kerberos5/lib/libroken
816 _generic_libs+= kerberos5/lib
817 .endif
818
819 _prebuild_libs+= lib/libcom_err lib/libcrypt lib/libexpat \
820                 lib/libkvm lib/libmd \
821                 lib/libncurses lib/libopie lib/libpam lib/libradius \
822                 lib/librpcsvc \
823                 lib/libsbuf lib/libtacplus lib/libutil lib/libypclnt \
824                 lib/libz lib/msun
825
826 lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L
827 lib/libypclnt__L: lib/librpcsvc__L
828
829 _generic_libs+= lib
830
831 .if !defined(NOCRYPT)
832 .if !defined(NO_OPENSSL)
833 _prebuild_libs+=        secure/lib/libcrypto secure/lib/libssl
834 .if !defined(NO_OPENSSH)
835 _prebuild_libs+=        secure/lib/libssh
836 secure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L
837 .endif
838 .endif
839 _generic_libs+= secure/lib
840 .endif
841
842 _generic_libs+= usr.bin/lex/lib
843
844 .if ${MACHINE_ARCH} == "i386"
845 _generic_libs+= usr.sbin/pcvt/keycap
846 .endif
847
848 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
849 ${_lib}__L: .PHONY
850 .if exists(${.CURDIR}/${_lib})
851         @${ECHODIR} "===> ${_lib}"; \
852                 cd ${.CURDIR}/${_lib}; \
853                 ${MAKE} DIRPRFX=${_lib}/ depend; \
854                 ${MAKE} DIRPRFX=${_lib}/ all; \
855                 ${MAKE} DIRPRFX=${_lib}/ install
856 .endif
857 .endfor
858
859 # libpam is special: we need to build static PAM modules before
860 # static PAM library, and dynamic PAM library before dynamic PAM
861 # modules.
862 lib/libpam__L: .PHONY
863         @${ECHODIR} "===> lib/libpam"; \
864                 cd ${.CURDIR}/lib/libpam; \
865                 ${MAKE} DIRPRFX=lib/libpam/ depend; \
866                 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
867                 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
868
869 _startup_libs: ${_startup_libs:S/$/__L/}
870 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
871 _generic_libs: ${_generic_libs:S/$/__L/}
872
873 .for __target in all clean cleandepend cleandir depend includes obj
874 .for entry in ${SUBDIR}
875 ${entry}.${__target}__D: .PHONY
876         @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
877                 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
878                 edir=${entry}.${MACHINE_ARCH}; \
879                 cd ${.CURDIR}/$${edir}; \
880         else \
881                 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
882                 edir=${entry}; \
883                 cd ${.CURDIR}/$${edir}; \
884         fi; \
885         ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
886 .endfor
887 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
888 .endfor
889
890 .include <bsd.subdir.mk>