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