]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - Makefile.inc1
Set KERNEL=${INSTALLKERNEL} doing a make install in /sys/conf
[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(NO_OPENSSL) && defined(MAKE_KERBEROS4)
61 SUBDIR+= kerberosIV
62 .endif
63 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
64     !defined(NOCRYPT) && !defined(NO_OPENSSL) && 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) && !defined(NO_OPENSSL) && 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
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         mkdir -p ${KRNLOBJDIR}
382         cd ${KRNLCONFDIR}; \
383                 PATH=${TMPPATH} \
384                     config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} ${_kernel}
385         cd ${KRNLOBJDIR}/${_kernel}; \
386                 MAKESRCPATH=${KRNLSRCDIR}/dev/aic7xxx \
387                     ${MAKE} -f ${KRNLSRCDIR}/dev/aic7xxx/Makefile; \
388                 ${WMAKEENV} MACHINE=${MACHINE} KERNEL=${_kernel} \
389                     ${MAKE} depend; \
390                 ${WMAKEENV} MACHINE=${MACHINE} KERNEL=${_kernel} ${MAKE} all
391 .endfor
392
393 #
394 # installkernel
395 #
396 # Install the kernel defined by INSTALLKERNEL
397 #
398 installkernel:
399         cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
400                 ${IMAKEENV} MACHINE=${MACHINE} KERNEL=${INSTALLKERNEL} \
401                     ${MAKE} KERNEL=${INSTALLKERNEL} install
402
403 #
404 # update
405 #
406 # Update the source tree, by running sup and/or running cvs to update to the
407 # latest copy.
408 #
409 update:
410 .if defined(SUP_UPDATE)
411         @echo "--------------------------------------------------------------"
412         @echo ">>> Running ${SUP}"
413         @echo "--------------------------------------------------------------"
414 .if defined(SUPFILE)
415         @${SUP} ${SUPFLAGS} ${SUPFILE}
416 .endif
417 .if defined(SUPFILE1)
418         @${SUP} ${SUPFLAGS} ${SUPFILE1}
419 .endif
420 .if defined(SUPFILE2)
421         @${SUP} ${SUPFLAGS} ${SUPFILE2}
422 .endif
423 .if defined(PORTSSUPFILE)
424         @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
425 .endif
426 .endif
427 .if defined(CVS_UPDATE)
428         @echo "--------------------------------------------------------------"
429         @echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
430         @echo "--------------------------------------------------------------"
431         cd ${.CURDIR}; cvs -q update -A -P -d
432 .endif
433
434 #
435 # most
436 #
437 # Build most of the user binaries on the existing system libs and includes.
438 #
439 most:
440         @echo "--------------------------------------------------------------"
441         @echo ">>> Building programs only"
442         @echo "--------------------------------------------------------------"
443         cd ${.CURDIR}/bin;              ${MAKE} all
444         cd ${.CURDIR}/sbin;             ${MAKE} all
445         cd ${.CURDIR}/libexec;          ${MAKE} all
446         cd ${.CURDIR}/usr.bin;          ${MAKE} all
447         cd ${.CURDIR}/usr.sbin;         ${MAKE} all
448         cd ${.CURDIR}/gnu/libexec;      ${MAKE} all
449         cd ${.CURDIR}/gnu/usr.bin;      ${MAKE} all
450         cd ${.CURDIR}/gnu/usr.sbin;     ${MAKE} all
451
452 #
453 # installmost
454 #
455 # Install the binaries built by the 'most' target.  This does not include
456 # libraries or include files.
457 #
458 installmost:
459         @echo "--------------------------------------------------------------"
460         @echo ">>> Installing programs only"
461         @echo "--------------------------------------------------------------"
462         cd ${.CURDIR}/bin;              ${MAKE} install
463         cd ${.CURDIR}/sbin;             ${MAKE} install
464         cd ${.CURDIR}/libexec;          ${MAKE} install
465         cd ${.CURDIR}/usr.bin;          ${MAKE} install
466         cd ${.CURDIR}/usr.sbin;         ${MAKE} install
467         cd ${.CURDIR}/gnu/libexec;      ${MAKE} install
468         cd ${.CURDIR}/gnu/usr.bin;      ${MAKE} install
469         cd ${.CURDIR}/gnu/usr.sbin;     ${MAKE} install
470
471 #
472 # ------------------------------------------------------------------------
473 #
474 # From here onwards are utility targets used by the 'make world' and
475 # related targets.  If your 'world' breaks, you may like to try to fix
476 # the problem and manually run the following targets to attempt to
477 # complete the build.  Beware, this is *not* guaranteed to work, you
478 # need to have a pretty good grip on the current state of the system
479 # to attempt to manually finish it.  If in doubt, 'make world' again.
480 #
481
482 #
483 # bootstrap-tools: Build tools needed for compatibility
484 #
485 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
486 _strfile=       games/fortune/strfile
487 .endif
488
489 bootstrap-tools:
490 .for _tool in ${_strfile} usr.bin/yacc usr.bin/colldef usr.sbin/config \
491     gnu/usr.bin/gperf gnu/usr.bin/texinfo
492         cd ${.CURDIR}/${_tool}; \
493                 ${MAKE} obj; \
494                 ${MAKE} depend; \
495                 ${MAKE} all; \
496                 ${MAKE} install
497 .endfor
498
499 #
500 # build-tools: Build special purpose build tools
501 #
502 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
503 _games= games/adventure games/hack games/phantasia
504 .endif
505
506 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
507 _share= share/syscons/scrnmaps
508 .endif
509
510 .if !defined(NO_FORTRAN)
511 _fortran= gnu/usr.bin/cc/f771
512 .endif
513
514 .if exists(${.CURDIR}/kerberosIV) && exists(${.CURDIR}/crypto) && \
515     !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
516 _libroken4= kerberosIV/lib/libroken
517 .endif
518
519 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
520     !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
521 _libkrb5= kerberos5/lib/libroken kerberos5/lib/libasn1 kerberos5/lib/libhdb \
522         kerberos5/lib/libsl
523 .endif
524
525 build-tools:
526 .for _tool in bin/sh ${_games} gnu/usr.bin/cc/cc_tools ${_fortran} \
527     ${_libroken4} ${_libkrb5} lib/libncurses ${_share}
528         cd ${.CURDIR}/${_tool}; ${MAKE} build-tools
529 .endfor
530
531 #
532 # cross-tools: Build cross-building tools
533 #
534 # WARNING: Because the bootstrap tools are expected to run on the
535 # build-machine, MACHINE_ARCH is *always* set to BUILD_ARCH when this
536 # target is being made. TARGET_ARCH is *always* set to reflect the
537 # target-machine (which you can set by specifying MACHINE_ARCH on
538 # make's command-line, get it?).
539 # The reason is simple: we build these tools not to be run on the
540 # architecture we're cross-building, but on the architecture we're
541 # currently building on (ie the host-machine) and we expect these
542 # tools to produce output for the architecture we're trying to
543 # cross-build.
544 #
545 .if ${TARGET_ARCH} == "alpha" && ${MACHINE_ARCH} != "alpha"
546 _elf2exe=       usr.sbin/elf2exe
547 .endif
548
549 .if ${TARGET_ARCH} == "i386" && ${MACHINE_ARCH} != "i386"
550 _btxld= usr.sbin/btxld
551 .endif
552
553 # XXX - MACHINE should actually be TARGET. But we don't set that...
554 .if ${TARGET_ARCH} == "i386" && ${MACHINE} == "pc98"
555 _aout_tools=    usr.bin/size usr.bin/strip gnu/usr.bin/as gnu/usr.bin/ld
556 .endif
557
558 cross-tools:
559 .for _tool in ${_aout_tools} ${_btxld} ${_elf2exe} usr.bin/genassym \
560     usr.bin/gensetdefs gnu/usr.bin/binutils usr.bin/objformat gnu/usr.bin/cc
561         cd ${.CURDIR}/${_tool}; \
562                 ${MAKE} obj; \
563                 ${MAKE} depend; \
564                 ${MAKE} all; \
565                 ${MAKE} install
566 .endfor
567
568 #
569 # hierarchy - ensure that all the needed directories are present
570 #
571 hierarchy:
572         cd ${.CURDIR}/etc;              ${MAKE} distrib-dirs
573
574 #
575 # includes - possibly generate and install the include files.
576 #
577 includes:
578         cd ${.CURDIR}/include;                  ${MAKE} -B all install
579         cd ${.CURDIR}/gnu/include;              ${MAKE} install
580         cd ${.CURDIR}/gnu/lib/libmp;            ${MAKE} beforeinstall
581         cd ${.CURDIR}/gnu/lib/libobjc;          ${MAKE} beforeinstall
582         cd ${.CURDIR}/gnu/lib/libreadline/readline;     ${MAKE} beforeinstall
583         cd ${.CURDIR}/gnu/lib/libregex;         ${MAKE} beforeinstall
584         cd ${.CURDIR}/gnu/lib/libstdc++;        ${MAKE} beforeinstall
585         cd ${.CURDIR}/gnu/lib/libdialog;        ${MAKE} beforeinstall
586         cd ${.CURDIR}/gnu/lib/libgmp;           ${MAKE} beforeinstall
587         cd ${.CURDIR}/gnu/usr.bin/cc/cc1plus;   ${MAKE} beforeinstall
588 .if exists(${.CURDIR}/secure) && !defined(NOCRYPT)
589 .if exists(${.CURDIR}/secure/lib/libcrypto)
590         cd ${.CURDIR}/secure/lib/libcrypto;     ${MAKE} beforeinstall
591 .endif
592 .if exists(${.CURDIR}/secure/lib/libssl)
593         cd ${.CURDIR}/secure/lib/libssl;        ${MAKE} beforeinstall
594 .endif
595 .endif
596 .if exists(${.CURDIR}/kerberosIV) && !defined(NOCRYPT) && \
597     defined(MAKE_KERBEROS4)
598         cd ${.CURDIR}/kerberosIV/lib/libacl;    ${MAKE} beforeinstall
599         cd ${.CURDIR}/kerberosIV/lib/libkadm;   ${MAKE} beforeinstall
600         cd ${.CURDIR}/kerberosIV/lib/libkafs;   ${MAKE} beforeinstall
601         cd ${.CURDIR}/kerberosIV/lib/libkdb;    ${MAKE} beforeinstall
602         cd ${.CURDIR}/kerberosIV/lib/libkrb;    ${MAKE} beforeinstall
603         cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall
604 .else
605         cd ${.CURDIR}/lib/libtelnet;            ${MAKE} beforeinstall
606 .endif
607 .if exists(${.CURDIR}/kerberos5) && !defined(NOCRYPT) && \
608     defined(MAKE_KERBEROS5)
609         cd ${.CURDIR}/kerberos5/lib/libasn1;            ${MAKE} beforeinstall
610         cd ${.CURDIR}/kerberos5/lib/libhdb;             ${MAKE} beforeinstall
611         cd ${.CURDIR}/kerberos5/lib/libkadm5clnt;       ${MAKE} beforeinstall
612         cd ${.CURDIR}/kerberos5/lib/libkadm5srv;        ${MAKE} beforeinstall
613         cd ${.CURDIR}/kerberos5/lib/libkafs5;           ${MAKE} beforeinstall
614         cd ${.CURDIR}/kerberos5/lib/libkrb5;            ${MAKE} beforeinstall
615         cd ${.CURDIR}/kerberos5/lib/libsl;              ${MAKE} beforeinstall
616 .endif
617 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
618         cd ${.CURDIR}/lib/csu/${MACHINE_ARCH};  ${MAKE} beforeinstall
619 .endif
620         cd ${.CURDIR}/lib/libalias;             ${MAKE} beforeinstall
621         cd ${.CURDIR}/lib/libatm;               ${MAKE} beforeinstall
622         cd ${.CURDIR}/lib/libdevstat;           ${MAKE} beforeinstall
623         cd ${.CURDIR}/lib/libc;                 ${MAKE} beforeinstall
624         cd ${.CURDIR}/lib/libcalendar;          ${MAKE} beforeinstall
625         cd ${.CURDIR}/lib/libcam;               ${MAKE} beforeinstall
626         cd ${.CURDIR}/lib/libdisk;              ${MAKE} beforeinstall
627         cd ${.CURDIR}/lib/libedit;              ${MAKE} beforeinstall
628         cd ${.CURDIR}/lib/libftpio;             ${MAKE} beforeinstall
629         cd ${.CURDIR}/lib/libkvm;               ${MAKE} beforeinstall
630         cd ${.CURDIR}/lib/libmd;                ${MAKE} beforeinstall
631 .if !defined(WANT_CSRG_LIBM)
632         cd ${.CURDIR}/lib/msun;                 ${MAKE} beforeinstall
633 .endif
634         cd ${.CURDIR}/lib/libncp;               ${MAKE} beforeinstall
635         cd ${.CURDIR}/lib/libncurses;           ${MAKE} beforeinstall
636         cd ${.CURDIR}/lib/libnetgraph;          ${MAKE} beforeinstall
637         cd ${.CURDIR}/lib/libopie;              ${MAKE} beforeinstall
638         cd ${.CURDIR}/lib/libpam/libpam;        ${MAKE} beforeinstall
639         cd ${.CURDIR}/lib/libpcap;              ${MAKE} beforeinstall
640         cd ${.CURDIR}/lib/libradius;            ${MAKE} beforeinstall
641         cd ${.CURDIR}/lib/librpcsvc;            ${MAKE} beforeinstall
642         cd ${.CURDIR}/lib/libskey;              ${MAKE} beforeinstall
643         cd ${.CURDIR}/lib/libstand;             ${MAKE} beforeinstall
644         cd ${.CURDIR}/lib/libtacplus;           ${MAKE} beforeinstall
645         cd ${.CURDIR}/lib/libcom_err;           ${MAKE} beforeinstall
646         cd ${.CURDIR}/lib/libss;                ${MAKE} -B hdrs beforeinstall
647         cd ${.CURDIR}/lib/libutil;              ${MAKE} beforeinstall
648         cd ${.CURDIR}/lib/libvgl;               ${MAKE} beforeinstall
649         cd ${.CURDIR}/lib/libwrap;              ${MAKE} beforeinstall
650         cd ${.CURDIR}/lib/libz;                 ${MAKE} beforeinstall
651         cd ${.CURDIR}/usr.bin/lex;              ${MAKE} beforeinstall
652
653 #
654 # libraries - build all libraries, and install them under ${DESTDIR}.
655 #
656 # The following dependencies exist between the libraries:
657 #
658 # lib*: csu
659 # libatm: libmd
660 # libcrypt: libmd
661 # libdialog: libncurses
662 # libedit: libncurses
663 # libg++: libm
664 # libkrb: libcrypt
665 # libopie: libmd
666 # libpam: libcom_err libcrypt libcrypto libgcc_pic libkrb libopie libradius \
667 #         libskey libtacplus libutil libz libssh
668 # libradius: libmd
669 # libreadline: libncurses
670 # libskey: libcrypt libmd
671 # libss: libcom_err
672 # libstc++: libm
673 # libtacplus: libmd
674 #
675 # Across directories this comes down to (rougly):
676 #
677 # gnu/lib: lib/libm lib/libncurses
678 # kerberosIV/lib kerberos5/lib: lib/libcrypt
679 # lib/libpam: secure/lib/libcrypto kerberosIV/lib/libkrb gnu/lib/libgcc \
680 #             secure/lib/libssh lib/libz
681 # secure/lib: lib/libmd
682 #
683 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}.pcc)
684 _csu=   lib/csu/${MACHINE_ARCH}.pcc
685 .elif ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf"
686 _csu=   lib/csu/i386-elf
687 .else
688 _csu=   lib/csu/${MACHINE_ARCH}
689 .endif
690
691 .if !defined(NOSECURE) && !defined(NOCRYPT)
692 _secure_lib=    secure/lib
693 .endif
694
695 .if !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
696 _kerberosIV_lib=        kerberosIV/lib
697 .endif
698
699 .if !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
700 _kerberos5_lib= kerberos5/lib
701 .endif
702
703 .if defined(WANT_CSRG_LIBM)
704 _libm=  lib/libm
705 .else
706 _libm=  lib/msun
707 .endif
708
709 .if !defined(NOPERL)
710 _libperl=       gnu/usr.bin/perl/libperl
711 .endif
712
713 .if ${MACHINE_ARCH} == "i386"
714 _libkeycap=     usr.sbin/pcvt/keycap
715 .endif
716
717 libraries:
718 .for _lib in ${_csu} lib/libmd lib/libcrypt ${_secure_lib} ${_kerberosIV_lib} \
719     ${_kerberos5_lib} gnu/lib/libgcc lib/libcom_err ${_libm} lib/libncurses \
720     lib/libopie lib/libradius lib/libskey lib/libtacplus lib/libutil \
721     lib/libz lib gnu/lib \
722     ${_libperl} usr.bin/lex/lib ${_libkeycap}
723 .if exists(${.CURDIR}/${_lib})
724         cd ${.CURDIR}/${_lib}; \
725                 ${MAKE} depend; \
726                 ${MAKE} all; \
727                 ${MAKE} install
728 .endif
729 .endfor
730
731 .for __target in clean cleandepend cleandir depend obj
732 .for entry in ${SUBDIR}
733 ${entry}.${__target}__D: .PHONY
734         @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
735                 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
736                 edir=${entry}.${MACHINE_ARCH}; \
737                 cd ${.CURDIR}/$${edir}; \
738         else \
739                 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
740                 edir=${entry}; \
741                 cd ${.CURDIR}/$${edir}; \
742         fi; \
743         ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
744 .endfor
745 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
746 .endfor
747
748 .include <bsd.subdir.mk>