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