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