]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - Makefile.inc1
This commit was generated by cvs2svn to compensate for changes in r94880,
[FreeBSD/FreeBSD.git] / Makefile.inc1
1 #
2 # $FreeBSD$
3 #
4 # Make command line options:
5 #       -DMAKE_KERBEROS4 to build KerberosIV
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 #       -DNOPROFILE do not build profiled libraries
11 #       -DNOSECURE do not go into secure subdir
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_PERL do not build perl5 and related libraries
21 #       -DNO_PORTSUPDATE do not update ports in ${MAKE} update
22 #       -DNO_DOCUPDATE do not update doc in ${MAKE} update
23 #       LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
24 #       TARGET_ARCH="arch" to crossbuild world to a different arch
25
26 #
27 # The intended user-driven targets are:
28 # buildworld  - rebuild *everything*, including glue to help do upgrades
29 # installworld- install everything built by "buildworld"
30 # update      - convenient way to update your source tree (eg: sup/cvs)
31 # most        - build user commands, no libraries or include files
32 # installmost - install user commands, no libraries or include files
33 #
34 # Standard targets (not defined here) are documented in the makefiles in
35 # /usr/share/mk.  These include:
36 #               obj depend all install clean cleandepend cleanobj
37
38 # Put initial settings here.
39 SUBDIR=
40
41 # We must do share/info early so that installation of info `dir'
42 # entries works correctly.  Do it first since it is less likely to
43 # grow dependencies on include and lib than vice versa.
44 .if exists(${.CURDIR}/share/info)
45 SUBDIR+= share/info
46 .endif
47
48 # We must do include and lib early so that the perl *.ph generation
49 # works correctly as it uses the header files installed by this.
50 .if exists(${.CURDIR}/include)
51 SUBDIR+= include
52 .endif
53 .if exists(${.CURDIR}/lib)
54 SUBDIR+= lib
55 .endif
56
57 .if exists(${.CURDIR}/bin)
58 SUBDIR+= bin
59 .endif
60 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
61 SUBDIR+= games
62 .endif
63 .if exists(${.CURDIR}/gnu)
64 SUBDIR+= gnu
65 .endif
66 .if exists(${.CURDIR}/kerberosIV) && exists(${.CURDIR}/crypto) && \
67     !defined(NOCRYPT) && !defined(NO_OPENSSL) && defined(MAKE_KERBEROS4)
68 SUBDIR+= kerberosIV
69 .endif
70 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
71     !defined(NOCRYPT) && !defined(NO_OPENSSL) && defined(MAKE_KERBEROS5)
72 SUBDIR+= kerberos5
73 .endif
74 .if exists(${.CURDIR}/libexec)
75 SUBDIR+= libexec
76 .endif
77 .if exists(${.CURDIR}/sbin)
78 SUBDIR+= sbin
79 .endif
80 .if exists(${.CURDIR}/secure) && !defined(NOCRYPT) && !defined(NOSECURE)
81 SUBDIR+= secure
82 .endif
83 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
84 SUBDIR+= share
85 .endif
86 .if exists(${.CURDIR}/sys)
87 SUBDIR+= sys
88 .endif
89 .if exists(${.CURDIR}/usr.bin)
90 SUBDIR+= usr.bin
91 .endif
92 .if exists(${.CURDIR}/usr.sbin)
93 SUBDIR+= usr.sbin
94 .endif
95
96 # etc must be last for "distribute" to work
97 .if exists(${.CURDIR}/etc)
98 SUBDIR+= etc
99 .endif
100
101 # These are last, since it is nice to at least get the base system
102 # rebuilt before you do them.
103 .if defined(LOCAL_DIRS)
104 .for _DIR in ${LOCAL_DIRS}
105 .if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile)
106 SUBDIR+= ${_DIR}
107 .endif
108 .endfor
109 .endif
110
111 .if defined(NOCLEANDIR)
112 CLEANDIR=       clean cleandepend
113 .else
114 CLEANDIR=       cleandir
115 .endif
116
117 CVS?=           cvs
118 SUP?=           /usr/local/bin/cvsup
119 SUPFLAGS?=      -g -L 2 -P -
120 .if defined(SUPHOST)
121 SUPFLAGS+=      -h ${SUPHOST}
122 .endif
123
124 MAKEOBJDIRPREFIX?=      /usr/obj
125 TARGET_ARCH?=   ${MACHINE_ARCH}
126 .if ${TARGET_ARCH} == ${MACHINE_ARCH}
127 TARGET?=        ${MACHINE}
128 .else
129 TARGET?=        ${TARGET_ARCH}
130 .endif
131 .if make(buildworld)
132 BUILD_ARCH!=    sysctl -n hw.machine_arch
133 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
134 .error To cross-build, set TARGET_ARCH.
135 .endif
136 .endif
137 .if ${MACHINE} == ${TARGET}
138 OBJTREE=        ${MAKEOBJDIRPREFIX}
139 .else
140 OBJTREE=        ${MAKEOBJDIRPREFIX}/${TARGET}
141 .endif
142 WORLDTMP=       ${OBJTREE}${.CURDIR}/${MACHINE_ARCH}
143 # /usr/games added for fortune which depend on strfile
144 STRICTTMPPATH=  ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
145 TMPPATH=        ${STRICTTMPPATH}:${PATH}
146 OBJFORMAT_PATH?=        /usr/libexec
147
148 INSTALLTMP!=    /usr/bin/mktemp -d -u -t install
149
150 #
151 # Building a world goes through the following stages
152 #
153 # 1. bootstrap-tool stage [BMAKE]
154 #       This stage is responsible for creating programs that
155 #       are needed for backward compatibility reasons. They
156 #       are not built as cross-tools.
157 # 2. build-tool stage [TMAKE]
158 #       This stage is responsible for creating the object
159 #       tree and building any tools that are needed during
160 #       the build process.
161 # 3. cross-tool stage [XMAKE]
162 #       This stage is responsible for creating any tools that
163 #       are needed for cross-builds. A cross-compiler is one
164 #       of them.
165 # 4. world stage [WMAKE]
166 #       This stage actually builds the world.
167 # 5. install stage (optional) [IMAKE]
168 #       This stage installs a previously built world.
169 #
170
171 # Common environment for world related stages
172 CROSSENV=       MAKEOBJDIRPREFIX=${OBJTREE} \
173                 MACHINE_ARCH=${TARGET_ARCH} \
174                 MACHINE=${TARGET} \
175                 OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \
176                 PERL5LIB=${WORLDTMP}/usr/libdata/perl/5.6.1 \
177                 GROFF_BIN_PATH=${WORLDTMP}/usr/bin \
178                 GROFF_FONT_PATH=${WORLDTMP}/usr/share/groff_font \
179                 GROFF_TMAC_PATH=${WORLDTMP}/usr/share/tmac
180
181 # bootstrap-tool stage
182 BMAKEENV=       MAKEOBJDIRPREFIX=${WORLDTMP} \
183                 DESTDIR= \
184                 INSTALL="sh ${.CURDIR}/tools/install.sh"
185 BMAKE=          ${BMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING \
186                 -DNOHTML -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED \
187                 -DNO_WERROR
188
189 # build-tool stage
190 TMAKEENV=       MAKEOBJDIRPREFIX=${OBJTREE} \
191                 DESTDIR= \
192                 INSTALL="sh ${.CURDIR}/tools/install.sh"
193 TMAKE=          ${TMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING
194
195 # cross-tool stage
196 XMAKE=          TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB
197
198 # world stage
199 WMAKEENV=       ${CROSSENV} \
200                 DESTDIR=${WORLDTMP} \
201                 INSTALL="sh ${.CURDIR}/tools/install.sh" \
202                 PATH=${TMPPATH}
203 WMAKE=          ${WMAKEENV} ${MAKE} -f Makefile.inc1
204
205 # install stage
206 IMAKEENV=       ${CROSSENV} \
207                 PATH=${STRICTTMPPATH}:${INSTALLTMP}
208 IMAKE=          ${IMAKEENV} ${MAKE} -f Makefile.inc1
209
210 # kernel stage
211 KMAKEENV=       ${WMAKEENV} \
212                 OBJFORMAT_PATH=${WORLDTMP}/usr/libexec:${OBJFORMAT_PATH}
213
214 USRDIRS=        usr/bin usr/lib/compat/aout usr/games usr/libdata/ldscripts \
215                 usr/libexec/${OBJFORMAT} usr/sbin usr/share/misc \
216                 usr/share/dict \
217                 usr/share/groff_font/devX100 \
218                 usr/share/groff_font/devX100-12 \
219                 usr/share/groff_font/devX75 \
220                 usr/share/groff_font/devX75-12 \
221                 usr/share/groff_font/devascii \
222                 usr/share/groff_font/devcp1047 \
223                 usr/share/groff_font/devdvi \
224                 usr/share/groff_font/devhtml \
225                 usr/share/groff_font/devkoi8-r \
226                 usr/share/groff_font/devlatin1 \
227                 usr/share/groff_font/devlbp \
228                 usr/share/groff_font/devlj4 \
229                 usr/share/groff_font/devps \
230                 usr/share/groff_font/devutf8 \
231                 usr/share/tmac/mdoc usr/share/tmac/mm
232
233 INCDIRS=        arpa dev fs g++/std isc isofs objc protocols \
234                 readline rpc rpcsvc openssl security ufs
235
236 #
237 # buildworld
238 #
239 # Attempt to rebuild the entire system, with reasonable chance of
240 # success, regardless of how old your existing system is.
241 #
242 buildworld:
243         @echo
244         @echo "--------------------------------------------------------------"
245         @echo ">>> Rebuilding the temporary build tree"
246         @echo "--------------------------------------------------------------"
247 .if !defined(NOCLEAN)
248         rm -rf ${WORLDTMP}
249 .else
250         # XXX - These two can depend on any header file.
251         rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
252         rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
253 .endif
254 .for _dir in ${USRDIRS}
255         mkdir -p ${WORLDTMP}/${_dir}
256 .endfor
257 .for _dir in ${INCDIRS}
258         mkdir -p ${WORLDTMP}/usr/include/${_dir}
259 .endfor
260         ln -sf ${.CURDIR}/sys ${WORLDTMP}
261         @echo
262         @echo "--------------------------------------------------------------"
263         @echo ">>> stage 1: bootstrap tools"
264         @echo "--------------------------------------------------------------"
265         cd ${.CURDIR}; ${BMAKE} bootstrap-tools
266 .if !defined(NOCLEAN)
267         @echo
268         @echo "--------------------------------------------------------------"
269         @echo ">>> stage 2: cleaning up the object tree"
270         @echo "--------------------------------------------------------------"
271         cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
272 .endif
273         @echo
274         @echo "--------------------------------------------------------------"
275         @echo ">>> stage 2: rebuilding the object tree"
276         @echo "--------------------------------------------------------------"
277         cd ${.CURDIR}; ${WMAKE} par-obj
278         @echo
279         @echo "--------------------------------------------------------------"
280         @echo ">>> stage 2: build tools"
281         @echo "--------------------------------------------------------------"
282         cd ${.CURDIR}; ${TMAKE} build-tools
283         @echo
284         @echo "--------------------------------------------------------------"
285         @echo ">>> stage 3: cross tools"
286         @echo "--------------------------------------------------------------"
287         cd ${.CURDIR}; ${XMAKE} cross-tools
288         @echo
289         @echo "--------------------------------------------------------------"
290         @echo ">>> stage 4: populating ${WORLDTMP}/usr/include"
291         @echo "--------------------------------------------------------------"
292         cd ${.CURDIR}; ${WMAKE} SHARED=symlinks includes
293         @echo
294         @echo "--------------------------------------------------------------"
295         @echo ">>> stage 4: building libraries"
296         @echo "--------------------------------------------------------------"
297         cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries
298         @echo
299         @echo "--------------------------------------------------------------"
300         @echo ">>> stage 4: make dependencies"
301         @echo "--------------------------------------------------------------"
302         cd ${.CURDIR}; ${WMAKE} par-depend
303         @echo
304         @echo "--------------------------------------------------------------"
305         @echo ">>> stage 4: building everything.."
306         @echo "--------------------------------------------------------------"
307         cd ${.CURDIR}; ${WMAKE} all
308
309 everything:
310         @echo "--------------------------------------------------------------"
311         @echo ">>> Building everything.."
312         @echo "--------------------------------------------------------------"
313         cd ${.CURDIR}; ${WMAKE} all
314
315 #
316 # installworld
317 #
318 # Installs everything compiled by a 'buildworld'.
319 #
320 installworld:
321         mkdir -p ${INSTALLTMP}
322         for prog in [ awk cat chflags chmod chown date echo egrep find grep \
323             ln make makewhatis mkdir mtree mv perl rm sed sh sysctl \
324             test true uname wc zic; do \
325                 cp `which $$prog` ${INSTALLTMP}; \
326         done
327         cd ${.CURDIR}; ${IMAKE} reinstall
328         rm -rf ${INSTALLTMP}
329
330 #
331 # reinstall
332 #
333 # If you have a build server, you can NFS mount the source and obj directories
334 # and do a 'make reinstall' on the *client* to install new binaries from the
335 # most recent server build.
336 #
337 reinstall:
338         @echo "--------------------------------------------------------------"
339         @echo ">>> Making hierarchy"
340         @echo "--------------------------------------------------------------"
341         cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
342         @echo
343         @echo "--------------------------------------------------------------"
344         @echo ">>> Installing everything.."
345         @echo "--------------------------------------------------------------"
346         cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
347 .if !defined(NOMAN)
348         @echo
349         @echo "--------------------------------------------------------------"
350         @echo ">>> Rebuilding man page indices"
351         @echo "--------------------------------------------------------------"
352         cd ${.CURDIR}/share/man; ${MAKE} makedb
353 .endif
354
355 #
356 # distribworld
357 #
358 # Front-end to distribute to make sure the search path contains
359 # the object directory. Needed for miniperl.
360 #
361 distribworld:
362         cd ${.CURDIR}; PATH=${TMPPATH} ${MAKE} -f Makefile.inc1 distribute
363
364 #
365 # buildkernel and installkernel
366 #
367 # Which kernels to build and/or install is specified by setting
368 # KERNCONF. If not defined a GENERIC kernel is built/installed.
369 # Only the existing (depending TARGET) config files are used
370 # for building kernels and only the first of these is designated
371 # as the one being installed.
372 #
373 # Note that we have to use TARGET instead of TARGET_ARCH when
374 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
375 # be set to cross-build, we have to make sure TARGET is set
376 # properly.
377
378 .if !defined(KERNCONF) && defined(KERNEL)
379 KERNCONF=       ${KERNEL}
380 KERNWARN=       yes
381 .else
382 KERNCONF?=      GENERIC
383 .endif
384 INSTKERNNAME?=  kernel
385
386 KRNLSRCDIR=     ${.CURDIR}/sys
387 KRNLCONFDIR=    ${KRNLSRCDIR}/${TARGET}/conf
388 KRNLOBJDIR=     ${OBJTREE}${KRNLSRCDIR}
389 KERNCONFDIR?=   ${KRNLCONFDIR}
390
391 BUILDKERNELS=
392 INSTALLKERNEL=
393 .for _kernel in ${KERNCONF}
394 .if exists(${KERNCONFDIR}/${_kernel})
395 BUILDKERNELS+=  ${_kernel}
396 .if empty(INSTALLKERNEL)
397 INSTALLKERNEL= ${_kernel}
398 .endif
399 .endif
400 .endfor
401
402 #
403 # buildkernel
404 #
405 # Builds all kernels defined by BUILDKERNELS.
406 #
407 buildkernel:
408 .if empty(BUILDKERNELS)
409         @echo ">>> ERROR: Missing kernel configuration file(s) (${KERNCONF})."
410         @false
411 .endif
412 .if defined(KERNWARN)
413         @echo "--------------------------------------------------------------"
414         @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
415         @echo "--------------------------------------------------------------"
416         @sleep 3
417 .endif
418         @echo
419 .for _kernel in ${BUILDKERNELS}
420         @echo "--------------------------------------------------------------"
421         @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
422         @echo "--------------------------------------------------------------"
423         @echo "===> ${_kernel}"
424         mkdir -p ${KRNLOBJDIR}
425 .if !defined(NO_KERNELCONFIG)
426         cd ${KRNLCONFDIR}; \
427                 PATH=${TMPPATH} \
428                     config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
429                         ${KERNCONFDIR}/${_kernel}
430 .endif
431 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
432         cd ${KRNLOBJDIR}/${_kernel}; \
433             ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} -DNO_MODULES clean
434 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KRNLSRCDIR}/modules)
435         cd ${KRNLOBJDIR}/${_kernel}; \
436             ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} cleandir
437 .endif
438 .endif
439         cd ${KRNLOBJDIR}/${_kernel}; \
440                 MAKESRCPATH=${KRNLSRCDIR}/dev/aic7xxx/aicasm \
441                     ${MAKE} -f ${KRNLSRCDIR}/dev/aic7xxx/aicasm/Makefile
442 .if !defined(NO_KERNELDEPEND)
443         cd ${KRNLOBJDIR}/${_kernel}; \
444             ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend
445 .endif
446         cd ${KRNLOBJDIR}/${_kernel}; \
447             ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all
448         @echo "--------------------------------------------------------------"
449         @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
450         @echo "--------------------------------------------------------------"
451 .endfor
452
453 #
454 # installkernel
455 #
456 # Install the kernel defined by INSTALLKERNEL
457 #
458 installkernel:
459         cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
460             ${CROSSENV} ${MAKE} KERNEL=${INSTKERNNAME} install
461 reinstallkernel:
462         cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
463             ${CROSSENV} ${MAKE} KERNEL=${INSTKERNNAME} reinstall
464
465 #
466 # kernel
467 #
468 # Short hand for `make buildkernel installkernel'
469 #
470 kernel: buildkernel installkernel
471
472 #
473 # update
474 #
475 # Update the source tree, by running sup and/or running cvs to update to the
476 # latest copy.
477 #
478 update:
479 .if defined(SUP_UPDATE)
480         @echo "--------------------------------------------------------------"
481         @echo ">>> Running ${SUP}"
482         @echo "--------------------------------------------------------------"
483 .if defined(SUPFILE)
484         @${SUP} ${SUPFLAGS} ${SUPFILE}
485 .endif
486 .if defined(SUPFILE1)
487         @${SUP} ${SUPFLAGS} ${SUPFILE1}
488 .endif
489 .if defined(SUPFILE2)
490         @${SUP} ${SUPFLAGS} ${SUPFILE2}
491 .endif
492 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
493         @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
494 .endif
495 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
496         @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
497 .endif
498 .endif
499 .if defined(CVS_UPDATE)
500         @echo "--------------------------------------------------------------"
501         @echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
502         @echo "--------------------------------------------------------------"
503         cd ${.CURDIR}; ${CVS} -q update -A -P -d
504 .endif
505
506 #
507 # most
508 #
509 # Build most of the user binaries on the existing system libs and includes.
510 #
511 most:
512         @echo "--------------------------------------------------------------"
513         @echo ">>> Building programs only"
514         @echo "--------------------------------------------------------------"
515         cd ${.CURDIR}/bin;              ${MAKE} all
516         cd ${.CURDIR}/sbin;             ${MAKE} all
517         cd ${.CURDIR}/libexec;          ${MAKE} all
518         cd ${.CURDIR}/usr.bin;          ${MAKE} all
519         cd ${.CURDIR}/usr.sbin;         ${MAKE} all
520         cd ${.CURDIR}/gnu/usr.bin;      ${MAKE} all
521         cd ${.CURDIR}/gnu/usr.sbin;     ${MAKE} all
522
523 #
524 # installmost
525 #
526 # Install the binaries built by the 'most' target.  This does not include
527 # libraries or include files.
528 #
529 installmost:
530         @echo "--------------------------------------------------------------"
531         @echo ">>> Installing programs only"
532         @echo "--------------------------------------------------------------"
533         cd ${.CURDIR}/bin;              ${MAKE} install
534         cd ${.CURDIR}/sbin;             ${MAKE} install
535         cd ${.CURDIR}/libexec;          ${MAKE} install
536         cd ${.CURDIR}/usr.bin;          ${MAKE} install
537         cd ${.CURDIR}/usr.sbin;         ${MAKE} install
538         cd ${.CURDIR}/gnu/usr.bin;      ${MAKE} install
539         cd ${.CURDIR}/gnu/usr.sbin;     ${MAKE} install
540
541 #
542 # ------------------------------------------------------------------------
543 #
544 # From here onwards are utility targets used by the 'make world' and
545 # related targets.  If your 'world' breaks, you may like to try to fix
546 # the problem and manually run the following targets to attempt to
547 # complete the build.  Beware, this is *not* guaranteed to work, you
548 # need to have a pretty good grip on the current state of the system
549 # to attempt to manually finish it.  If in doubt, 'make world' again.
550 #
551
552 #
553 # bootstrap-tools: Build tools needed for compatibility
554 #
555 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
556 _strfile=       games/fortune/strfile
557 .endif
558
559 bootstrap-tools:
560 .for _tool in ${_strfile} usr.bin/yacc usr.bin/colldef \
561     usr.bin/xargs usr.bin/xinstall \
562     usr.sbin/config usr.sbin/kbdcontrol \
563     gnu/usr.bin/gperf gnu/usr.bin/groff gnu/usr.bin/texinfo
564         cd ${.CURDIR}/${_tool}; \
565                 ${MAKE} obj; \
566                 ${MAKE} depend; \
567                 ${MAKE} all; \
568                 ${MAKE} DESTDIR=${MAKEOBJDIRPREFIX} install
569 .endfor
570
571 #
572 # build-tools: Build special purpose build tools
573 #
574 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
575 _games= games/adventure games/hack games/phantasia
576 .endif
577
578 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
579 _share= share/syscons/scrnmaps
580 .endif
581
582 .if !defined(NO_FORTRAN)
583 _fortran= gnu/usr.bin/cc/f771
584 .endif
585
586 .if !defined(NOPERL) && !defined(NO_PERL)
587 _perl=  gnu/usr.bin/perl/miniperl
588 .endif
589
590 .if exists(${.CURDIR}/kerberosIV) && exists(${.CURDIR}/crypto) && \
591     !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
592 _libroken4= kerberosIV/lib/libroken
593 .endif
594
595 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
596     !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
597 _libkrb5= kerberos5/lib/libroken kerberos5/lib/libvers \
598     kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl
599 .endif
600
601 build-tools:
602 .for _tool in bin/csh bin/sh ${_games} gnu/usr.bin/cc/cc_tools ${_fortran} \
603     ${_perl} ${_libroken4} ${_libkrb5} lib/libncurses ${_share} \
604     usr.bin/awk usr.bin/file usr.sbin/sysinstall
605         cd ${.CURDIR}/${_tool}; ${MAKE} build-tools
606 .endfor
607
608 #
609 # cross-tools: Build cross-building tools
610 #
611 .if ${TARGET_ARCH} == "alpha" && ${MACHINE_ARCH} != "alpha"
612 _elf2exe=       usr.sbin/elf2exe
613 .endif
614
615 .if ${TARGET_ARCH} == "i386" && ${MACHINE_ARCH} != "i386"
616 _btxld= usr.sbin/btxld
617 .endif
618
619 _xlint= usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint
620
621 cross-tools:
622 .for _tool in ${_btxld} ${_elf2exe} \
623     gnu/usr.bin/binutils usr.bin/objformat gnu/usr.bin/cc ${_xlint}
624         cd ${.CURDIR}/${_tool}; \
625                 ${MAKE} obj; \
626                 ${MAKE} depend; \
627                 ${MAKE} all; \
628                 ${MAKE} DESTDIR=${MAKEOBJDIRPREFIX} install
629 .endfor
630
631 #
632 # hierarchy - ensure that all the needed directories are present
633 #
634 hierarchy:
635         cd ${.CURDIR}/etc;              ${MAKE} distrib-dirs
636
637 #
638 # includes - possibly generate and install the include files.
639 #
640 includes:
641         cd ${.CURDIR}/include;                  ${MAKE} -B all install
642         cd ${.CURDIR}/gnu/include;              ${MAKE} install
643         cd ${.CURDIR}/gnu/lib/libobjc;          ${MAKE} beforeinstall
644         cd ${.CURDIR}/gnu/lib/libreadline/readline;     ${MAKE} beforeinstall
645         cd ${.CURDIR}/gnu/lib/libregex;         ${MAKE} beforeinstall
646         cd ${.CURDIR}/gnu/lib/libstdc++;        ${MAKE} beforeinstall
647         cd ${.CURDIR}/gnu/lib/libdialog;        ${MAKE} beforeinstall
648         cd ${.CURDIR}/gnu/usr.bin/cc/cc1plus;   ${MAKE} beforeinstall
649 .if exists(${.CURDIR}/secure) && !defined(NOCRYPT) && !defined(NOSECURE)
650 .if exists(${.CURDIR}/secure/lib/libcrypto)
651         cd ${.CURDIR}/secure/lib/libcrypto;     ${MAKE} beforeinstall
652 .endif
653 .if exists(${.CURDIR}/secure/lib/libssl)
654         cd ${.CURDIR}/secure/lib/libssl;        ${MAKE} beforeinstall
655 .endif
656 .endif
657 .if exists(${.CURDIR}/kerberosIV) && !defined(NOCRYPT) && \
658     defined(MAKE_KERBEROS4)
659         cd ${.CURDIR}/kerberosIV/lib/libacl;    ${MAKE} beforeinstall
660         cd ${.CURDIR}/kerberosIV/lib/libkadm;   ${MAKE} beforeinstall
661         cd ${.CURDIR}/kerberosIV/lib/libkafs;   ${MAKE} beforeinstall
662         cd ${.CURDIR}/kerberosIV/lib/libkdb;    ${MAKE} beforeinstall
663         cd ${.CURDIR}/kerberosIV/lib/libkrb;    ${MAKE} beforeinstall
664         cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall
665 .elif exists(${.CURDIR}/secure) && !defined(NOCRYPT) && !defined(NOSECURE)
666         cd ${.CURDIR}/secure/lib/libtelnet;     ${MAKE} beforeinstall
667 .else
668         cd ${.CURDIR}/lib/libtelnet;            ${MAKE} beforeinstall
669 .endif
670 .if exists(${.CURDIR}/kerberos5) && !defined(NOCRYPT) && \
671     defined(MAKE_KERBEROS5)
672         cd ${.CURDIR}/kerberos5/lib/libasn1;            ${MAKE} beforeinstall
673         cd ${.CURDIR}/kerberos5/lib/libhdb;             ${MAKE} beforeinstall
674         cd ${.CURDIR}/kerberos5/lib/libkadm5clnt;       ${MAKE} beforeinstall
675         cd ${.CURDIR}/kerberos5/lib/libkadm5srv;        ${MAKE} beforeinstall
676         cd ${.CURDIR}/kerberos5/lib/libkafs5;           ${MAKE} beforeinstall
677         cd ${.CURDIR}/kerberos5/lib/libkrb5;            ${MAKE} beforeinstall
678         cd ${.CURDIR}/kerberos5/lib/libsl;              ${MAKE} beforeinstall
679 .endif
680 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
681         cd ${.CURDIR}/lib/csu/${MACHINE_ARCH};  ${MAKE} beforeinstall
682 .endif
683         cd ${.CURDIR}/gnu/lib/csu;              ${MAKE} beforeinstall
684         cd ${.CURDIR}/lib/libalias;             ${MAKE} beforeinstall
685         cd ${.CURDIR}/lib/libatm;               ${MAKE} beforeinstall
686         cd ${.CURDIR}/lib/libdevstat;           ${MAKE} beforeinstall
687         cd ${.CURDIR}/lib/libc;                 ${MAKE} beforeinstall
688         cd ${.CURDIR}/lib/libcalendar;          ${MAKE} beforeinstall
689         cd ${.CURDIR}/lib/libcam;               ${MAKE} beforeinstall
690         cd ${.CURDIR}/lib/libdisk;              ${MAKE} beforeinstall
691         cd ${.CURDIR}/lib/libedit;              ${MAKE} beforeinstall
692         cd ${.CURDIR}/lib/libfetch;             ${MAKE} beforeinstall
693         cd ${.CURDIR}/lib/libftpio;             ${MAKE} beforeinstall
694         cd ${.CURDIR}/lib/libkvm;               ${MAKE} beforeinstall
695         cd ${.CURDIR}/lib/libmd;                ${MAKE} beforeinstall
696         cd ${.CURDIR}/lib/libmp;                ${MAKE} beforeinstall
697         cd ${.CURDIR}/lib/msun;                 ${MAKE} beforeinstall
698         cd ${.CURDIR}/lib/libncp;               ${MAKE} beforeinstall
699         cd ${.CURDIR}/lib/libncurses;           ${MAKE} beforeinstall
700         cd ${.CURDIR}/lib/libnetgraph;          ${MAKE} beforeinstall
701         cd ${.CURDIR}/lib/libopie;              ${MAKE} beforeinstall
702         cd ${.CURDIR}/lib/libpcap;              ${MAKE} beforeinstall
703         cd ${.CURDIR}/lib/libradius;            ${MAKE} beforeinstall
704         cd ${.CURDIR}/lib/librpcsvc;            ${MAKE} beforeinstall
705         cd ${.CURDIR}/lib/libpam/libpam;        ${MAKE} beforeinstall
706         cd ${.CURDIR}/lib/libsbuf;              ${MAKE} beforeinstall
707         cd ${.CURDIR}/lib/libstand;             ${MAKE} beforeinstall
708         cd ${.CURDIR}/lib/libtacplus;           ${MAKE} beforeinstall
709         cd ${.CURDIR}/lib/libcom_err;           ${MAKE} beforeinstall
710         cd ${.CURDIR}/lib/libusbhid;            ${MAKE} beforeinstall
711         cd ${.CURDIR}/lib/libutil;              ${MAKE} beforeinstall
712         cd ${.CURDIR}/lib/libvgl;               ${MAKE} beforeinstall
713         cd ${.CURDIR}/lib/libwrap;              ${MAKE} beforeinstall
714         cd ${.CURDIR}/lib/libypclnt;            ${MAKE} beforeinstall
715         cd ${.CURDIR}/lib/libz;                 ${MAKE} beforeinstall
716         cd ${.CURDIR}/usr.bin/lex;              ${MAKE} beforeinstall
717
718 #
719 # libraries - build all libraries, and install them under ${DESTDIR}.
720 #
721 # The list of libraries with dependents (${_prebuild_libs}) and their
722 # interdependencies (__L) are built automatically by the
723 # ${.CURDIR}/tools/make_libdeps.sh script.
724 #
725 libraries:
726         cd ${.CURDIR}; \
727             ${MAKE} -f Makefile.inc1 _startup_libs; \
728             ${MAKE} -f Makefile.inc1 _prebuild_libs; \
729             ${MAKE} -f Makefile.inc1 _generic_libs;
730
731 # These dependencies are not automatically generated:
732 #
733 # gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all
734 # shared libraries for ELF.
735 #
736 _startup_libs=  gnu/lib/csu gnu/lib/libgcc
737 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-${OBJFORMAT})
738 _startup_libs+= lib/csu/${MACHINE_ARCH}-${OBJFORMAT}
739 .else
740 _startup_libs+= lib/csu/${MACHINE_ARCH}
741 .endif
742
743 _prebuild_libs=
744
745 _generic_libs=  gnu/lib
746
747 .if !defined(NOPERL) && !defined(NO_PERL)
748 _generic_libs+= gnu/usr.bin/perl/libperl
749 .endif
750
751 .if !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
752 _prebuild_libs+=        kerberos5/lib/libasn1
753 _prebuild_libs+=        kerberos5/lib/libgssapi
754 _prebuild_libs+=        kerberos5/lib/libkrb5
755 _prebuild_libs+=        kerberos5/lib/libroken
756 _generic_libs+= kerberos5/lib
757 .endif
758
759 .if !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
760 _prebuild_libs+=        kerberosIV/lib/libkrb
761 kerberosIV/lib/libkrb__L: lib/libcrypt__L
762 _generic_libs+= kerberosIV/lib
763 .endif
764
765 _prebuild_libs+= lib/libcom_err lib/libcrypt lib/libkvm lib/libmd \
766                 lib/libncurses lib/libopie lib/libradius lib/librpcsvc \
767                 lib/libsbuf lib/libtacplus lib/libutil lib/libypclnt \
768                 lib/libz lib/msun
769
770 lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L
771 lib/libypclnt__L: lib/librpcsvc__L
772
773 _generic_libs+= lib
774
775 .if !defined(NOCRYPT) && !defined(NOSECURE)
776 _prebuild_libs+=        secure/lib/libcrypto
777 .if !defined(NO_OPENSSH)
778 _prebuild_libs+=        secure/lib/libssh
779 secure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L
780 .endif
781 _generic_libs+= secure/lib
782 .endif
783
784 _generic_libs+= usr.bin/lex/lib
785
786 .if ${MACHINE_ARCH} == "i386"
787 _generic_libs+= usr.sbin/pcvt/keycap
788 .endif
789
790 .for _lib in ${_startup_libs} ${_prebuild_libs} ${_generic_libs}
791 ${_lib}__L: .PHONY
792 .if exists(${.CURDIR}/${_lib})
793         cd ${.CURDIR}/${_lib}; \
794                 ${MAKE} depend; \
795                 ${MAKE} all; \
796                 ${MAKE} install
797 .endif
798 .endfor
799
800 _startup_libs: ${_startup_libs:S/$/__L/}
801 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
802 _generic_libs: ${_generic_libs:S/$/__L/}
803
804 .for __target in clean cleandepend cleandir depend obj
805 .for entry in ${SUBDIR}
806 ${entry}.${__target}__D: .PHONY
807         @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
808                 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
809                 edir=${entry}.${MACHINE_ARCH}; \
810                 cd ${.CURDIR}/$${edir}; \
811         else \
812                 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
813                 edir=${entry}; \
814                 cd ${.CURDIR}/$${edir}; \
815         fi; \
816         ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
817 .endfor
818 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
819 .endfor
820
821 .include <bsd.subdir.mk>