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