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