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