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