Fix a minor bug... install cvsup and mkisofs in the correct
[dragonfly.git] / Makefile.inc1
1 #
2 # $FreeBSD: src/Makefile.inc1,v 1.141.2.62 2003/04/06 19:54:00 dwmalone Exp $
3 # $DragonFly: src/Makefile.inc1,v 1.9 2003/12/01 09:59:42 dillon Exp $
4 #
5 # Make command line options:
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 #       -DNOMAN do not build the manual pages
11 #       -DNOPROFILE do not build profiled libraries
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 .if exists(${.CURDIR}/nrelease)
56 SUBDIR+= nrelease
57 .endif
58
59 .if exists(${.CURDIR}/bin)
60 SUBDIR+= bin
61 .endif
62 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
63 SUBDIR+= games
64 .endif
65 .if exists(${.CURDIR}/gnu)
66 SUBDIR+= gnu
67 .endif
68 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
69     !defined(NOCRYPT) && !defined(NO_OPENSSL) && defined(MAKE_KERBEROS5)
70 SUBDIR+= kerberos5
71 .endif
72 .if exists(${.CURDIR}/libexec)
73 SUBDIR+= libexec
74 .endif
75 .if exists(${.CURDIR}/sbin)
76 SUBDIR+= sbin
77 .endif
78 .if exists(${.CURDIR}/secure) && !defined(NOCRYPT)
79 SUBDIR+= secure
80 .endif
81 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
82 SUBDIR+= share
83 .endif
84 .if exists(${.CURDIR}/sys)
85 SUBDIR+= sys
86 .endif
87 .if exists(${.CURDIR}/usr.bin)
88 SUBDIR+= usr.bin
89 .endif
90 .if exists(${.CURDIR}/usr.sbin)
91 SUBDIR+= usr.sbin
92 .endif
93
94 # etc must be last for "distribute" to work
95 .if exists(${.CURDIR}/etc)
96 SUBDIR+= etc
97 .endif
98
99 # These are last, since it is nice to at least get the base system
100 # rebuilt before you do them.
101 .if defined(LOCAL_DIRS)
102 .for _DIR in ${LOCAL_DIRS}
103 .if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile)
104 SUBDIR+= ${_DIR}
105 .endif
106 .endfor
107 .endif
108
109 .if defined(SUBDIR_OVERRIDE)
110 SUBDIR=         ${SUBDIR_OVERRIDE}
111 .endif
112
113 .if defined(NOCLEANDIR)
114 CLEANDIR=       clean cleandepend
115 .else
116 CLEANDIR=       cleandir
117 .endif
118
119 SUP?=           /usr/local/bin/cvsup
120 SUPFLAGS?=      -g -L 2 -P -
121 .if defined(SUPHOST)
122 SUPFLAGS+=      -h ${SUPHOST}
123 .endif
124
125 MAKEOBJDIRPREFIX?=      /usr/obj
126 TARGET_ARCH?=   ${MACHINE_ARCH}
127 .if ${TARGET_ARCH} == ${MACHINE_ARCH}
128 TARGET?=        ${MACHINE}
129 .else
130 TARGET?=        ${TARGET_ARCH}
131 .endif
132 .if make(buildworld)
133 BUILD_ARCH!=    sysctl -n hw.machine_arch
134 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
135 .error To cross-build, set TARGET_ARCH.
136 .endif
137 .endif
138 .if ${MACHINE} == ${TARGET}
139 OBJTREE=        ${MAKEOBJDIRPREFIX}
140 .else
141 OBJTREE=        ${MAKEOBJDIRPREFIX}/${TARGET}
142 .endif
143 WORLDTMP=       ${OBJTREE}${.CURDIR}/${MACHINE_ARCH}
144 # /usr/games added for fortune which depend on strfile
145 STRICTTMPPATH=  ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
146 TMPPATH=        ${STRICTTMPPATH}:${PATH}
147 OBJFORMAT_PATH?=        /usr/libexec
148
149 TMPDIR?=        /tmp
150 TMPPID!=        echo $$$$
151 INSTALLTMP=     ${TMPDIR}/install.${TMPPID}
152
153 #
154 # Building a world goes through the following stages
155 #
156 # 1. bootstrap-tool stage [BMAKE]
157 #       This stage is responsible for creating programs that
158 #       are needed for backward compatibility reasons. They
159 #       are not built as cross-tools.
160 # 2. build-tool stage [TMAKE]
161 #       This stage is responsible for creating the object
162 #       tree and building any tools that are needed during
163 #       the build process.
164 # 3. cross-tool stage [XMAKE]
165 #       This stage is responsible for creating any tools that
166 #       are needed for cross-builds. A cross-compiler is one
167 #       of them.
168 # 4. world stage [WMAKE]
169 #       This stage actually builds the world.
170 # 5. install stage (optional) [IMAKE]
171 #       This stage installs a previously built world.
172 #
173
174 # Common environment for world related stages
175 CROSSENV=       MAKEOBJDIRPREFIX=${OBJTREE} \
176                 MACHINE_ARCH=${TARGET_ARCH} \
177                 MACHINE=${TARGET} \
178                 OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \
179                 PERL5LIB=${WORLDTMP}/usr/libdata/perl/5.00503 \
180                 GROFF_BIN_PATH=${WORLDTMP}/usr/bin \
181                 GROFF_FONT_PATH=${WORLDTMP}/usr/share/groff_font \
182                 GROFF_TMAC_PATH=${WORLDTMP}/usr/share/tmac
183
184 # bootstrap-tool stage
185 BMAKEENV=       MAKEOBJDIRPREFIX=${WORLDTMP} \
186                 DESTDIR= \
187                 INSTALL="sh ${.CURDIR}/tools/install.sh"
188 BMAKE=          ${BMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING \
189                 -DNOHTML -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED \
190                 -DNO_WERROR
191
192 # build-tool stage
193 TMAKEENV=       MAKEOBJDIRPREFIX=${OBJTREE} \
194                 DESTDIR= \
195                 INSTALL="sh ${.CURDIR}/tools/install.sh"
196 TMAKE=          ${TMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING
197
198 # cross-tool stage
199 XMAKE=          TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB
200
201 # world stage
202 WMAKEENV=       ${CROSSENV} \
203                 DESTDIR=${WORLDTMP} \
204                 INSTALL="sh ${.CURDIR}/tools/install.sh" \
205                 PATH=${TMPPATH}
206 WMAKE=          ${WMAKEENV} ${MAKE} -f Makefile.inc1
207
208 # install stage
209 IMAKEENV=       ${CROSSENV} \
210                 PATH=${STRICTTMPPATH}:${INSTALLTMP}
211 IMAKE=          ${IMAKEENV} ${MAKE} -f Makefile.inc1
212
213 # kernel stage
214 KMAKEENV=       ${WMAKEENV} \
215                 OBJFORMAT_PATH=${WORLDTMP}/usr/libexec:${OBJFORMAT_PATH}
216
217 USRDIRS=        usr/bin usr/lib/compat/aout usr/games usr/libdata/ldscripts \
218                 usr/libexec/${OBJFORMAT} usr/sbin usr/share/misc \
219                 usr/share/dict \
220                 usr/share/groff_font/devX100 \
221                 usr/share/groff_font/devX100-12 \
222                 usr/share/groff_font/devX75 \
223                 usr/share/groff_font/devX75-12 \
224                 usr/share/groff_font/devascii \
225                 usr/share/groff_font/devcp1047 \
226                 usr/share/groff_font/devdvi \
227                 usr/share/groff_font/devhtml \
228                 usr/share/groff_font/devkoi8-r \
229                 usr/share/groff_font/devlatin1 \
230                 usr/share/groff_font/devlbp \
231                 usr/share/groff_font/devlj4 \
232                 usr/share/groff_font/devps \
233                 usr/share/groff_font/devutf8 \
234                 usr/share/tmac/mdoc usr/share/tmac/mm
235
236 # XXX remove in favor of the BSD.include.dist mtree that we already have.
237 #
238 INCDIRS=        arpa dev g++/std isc libmilter objc openssl \
239                 protocols readline rpc rpcsvc security
240
241 #
242 # buildworld
243 #
244 # Attempt to rebuild the entire system, with reasonable chance of
245 # success, regardless of how old your existing system is.
246 #
247 _worldtmp:
248         @echo
249         @echo "--------------------------------------------------------------"
250         @echo ">>> Rebuilding the temporary build tree"
251         @echo "--------------------------------------------------------------"
252 .if !defined(NOCLEAN)
253         rm -rf ${WORLDTMP}
254 .else
255         # XXX - These two can depend on any header file.
256         rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
257         rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
258 .endif
259 .for _dir in ${USRDIRS}
260         mkdir -p ${WORLDTMP}/${_dir}
261 .endfor
262 .for _dir in ${INCDIRS}
263         mkdir -p ${WORLDTMP}/usr/include/${_dir}
264 .endfor
265         ln -sf ${.CURDIR}/sys ${WORLDTMP}
266 _bootstrap-tools:
267         @echo
268         @echo "--------------------------------------------------------------"
269         @echo ">>> stage 1: bootstrap tools"
270         @echo "--------------------------------------------------------------"
271         cd ${.CURDIR}; ${BMAKE} bootstrap-tools
272 _cleanobj:
273 .if !defined(NOCLEAN)
274         @echo
275         @echo "--------------------------------------------------------------"
276         @echo ">>> stage 2: cleaning up the object tree"
277         @echo "--------------------------------------------------------------"
278         cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
279 .endif
280 _obj:
281         @echo
282         @echo "--------------------------------------------------------------"
283         @echo ">>> stage 2: rebuilding the object tree"
284         @echo "--------------------------------------------------------------"
285         cd ${.CURDIR}; ${WMAKE} par-obj
286 _build-tools:
287         @echo
288         @echo "--------------------------------------------------------------"
289         @echo ">>> stage 2: build tools"
290         @echo "--------------------------------------------------------------"
291         cd ${.CURDIR}; ${TMAKE} build-tools
292 _cross-tools:
293         @echo
294         @echo "--------------------------------------------------------------"
295         @echo ">>> stage 3: cross tools"
296         @echo "--------------------------------------------------------------"
297         cd ${.CURDIR}; ${XMAKE} cross-tools
298 _includes:
299         @echo
300         @echo "--------------------------------------------------------------"
301         @echo ">>> stage 4: populating ${WORLDTMP}/usr/include"
302         @echo "--------------------------------------------------------------"
303         cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
304 _libraries:
305         @echo
306         @echo "--------------------------------------------------------------"
307         @echo ">>> stage 4: building libraries"
308         @echo "--------------------------------------------------------------"
309         cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries
310 _depend:
311         @echo
312         @echo "--------------------------------------------------------------"
313         @echo ">>> stage 4: make dependencies"
314         @echo "--------------------------------------------------------------"
315         cd ${.CURDIR}; ${WMAKE} par-depend
316 everything:
317         @echo
318         @echo "--------------------------------------------------------------"
319         @echo ">>> stage 4: building everything.."
320         @echo "--------------------------------------------------------------"
321         cd ${.CURDIR}; ${WMAKE} all
322
323
324 WMAKE_TGTS=
325 .if !defined(SUBDIR_OVERRIDE)
326 WMAKE_TGTS+=    _worldtmp _bootstrap-tools
327 .endif
328 WMAKE_TGTS+=    _cleanobj _obj _build-tools
329 .if !defined(SUBDIR_OVERRIDE)
330 WMAKE_TGTS+=    _cross-tools
331 .endif
332 WMAKE_TGTS+=    _includes _libraries _depend everything
333
334 buildworld: ${WMAKE_TGTS}
335 .ORDER: ${WMAKE_TGTS}
336
337 #
338 # installcheck
339 #
340 # Checks to be sure system is ready for installworld
341 #
342 installcheck:
343 .if !defined(NO_SENDMAIL)
344         @if ! `grep -q '^smmsp:' /etc/passwd`; then \
345                 echo "ERROR: Required smmsp user is missing, see /usr/src/UPDATING."; \
346                 false; \
347         fi
348         @if ! `grep -q '^smmsp:' /etc/group`; then \
349                 echo "ERROR: Required smmsp group is missing, see /usr/src/UPDATING."; \
350                 false; \
351         fi
352 .endif
353
354 #
355 # distributeworld
356 #
357 # Distributes everything compiled by a `buildworld'.
358 #
359 # installworld
360 #
361 # Installs everything compiled by a 'buildworld'.
362 #
363 distributeworld installworld: installcheck
364         mkdir -p ${INSTALLTMP}
365         for prog in [ awk cap_mkdb cat chflags chmod chown \
366             date echo egrep find grep \
367             ln make makewhatis mkdir mtree mv perl pwd_mkdb rm sed sh sysctl \
368             test true uname wc zic; do \
369                 cp `which $$prog` ${INSTALLTMP}; \
370         done
371         cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
372         rm -rf ${INSTALLTMP}
373
374 #
375 # reinstall
376 #
377 # If you have a build server, you can NFS mount the source and obj directories
378 # and do a 'make reinstall' on the *client* to install new binaries from the
379 # most recent server build.
380 #
381 reinstall:
382         @echo "--------------------------------------------------------------"
383         @echo ">>> Making hierarchy"
384         @echo "--------------------------------------------------------------"
385         cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
386         @echo
387         @echo "--------------------------------------------------------------"
388         @echo ">>> Installing everything.."
389         @echo "--------------------------------------------------------------"
390         cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
391 .if !defined(NOMAN) && !defined(NO_MAKEDB_RUN)
392         @echo
393         @echo "--------------------------------------------------------------"
394         @echo ">>> Rebuilding man page indices"
395         @echo "--------------------------------------------------------------"
396         cd ${.CURDIR}/share/man; ${MAKE} makedb
397 .endif
398
399 redistribute:
400         @echo "--------------------------------------------------------------"
401         @echo ">>> Distributing everything.."
402         @echo "--------------------------------------------------------------"
403         cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
404
405 #
406 # buildkernel and installkernel
407 #
408 # Which kernels to build and/or install is specified by setting
409 # KERNCONF. If not defined a GENERIC kernel is built/installed.
410 # Only the existing (depending TARGET) config files are used
411 # for building kernels and only the first of these is designated
412 # as the one being installed.
413 #
414 # Note that we have to use TARGET instead of TARGET_ARCH when
415 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
416 # be set to cross-build, we have to make sure TARGET is set
417 # properly.
418
419 .if !defined(KERNCONF) && defined(KERNEL)
420 KERNCONF=       ${KERNEL}
421 KERNWARN=       yes
422 .else
423 KERNCONF?=      GENERIC
424 .endif
425 INSTKERNNAME?=  kernel
426
427 KRNLSRCDIR=     ${.CURDIR}/sys
428 KRNLCONFDIR=    ${KRNLSRCDIR}/${TARGET}/conf
429 KRNLOBJDIR=     ${OBJTREE}${KRNLSRCDIR}
430 KERNCONFDIR?=   ${KRNLCONFDIR}
431
432 BUILDKERNELS=
433 INSTALLKERNEL=
434 .for _kernel in ${KERNCONF}
435 .if exists(${KERNCONFDIR}/${_kernel})
436 BUILDKERNELS+=  ${_kernel}
437 .if empty(INSTALLKERNEL)
438 INSTALLKERNEL= ${_kernel}
439 .endif
440 .endif
441 .endfor
442
443 #
444 # buildkernel
445 #
446 # Builds all kernels defined by BUILDKERNELS.
447 #
448 buildkernel:
449 .if empty(BUILDKERNELS)
450         @echo ">>> ERROR: Missing kernel configuration file(s) (${KERNCONF})."
451         @false
452 .endif
453 .if defined(KERNWARN)
454         @echo "--------------------------------------------------------------"
455         @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
456         @echo "--------------------------------------------------------------"
457         @sleep 3
458 .endif
459         @echo
460 .for _kernel in ${BUILDKERNELS}
461         @echo "--------------------------------------------------------------"
462         @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
463         @echo "--------------------------------------------------------------"
464         @echo "===> ${_kernel}"
465         mkdir -p ${KRNLOBJDIR}
466 .if !defined(NO_KERNELCONFIG)
467         cd ${KRNLCONFDIR}; \
468                 PATH=${TMPPATH} \
469                     config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
470                         ${KERNCONFDIR}/${_kernel}
471 .endif
472 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
473         cd ${KRNLOBJDIR}/${_kernel}; \
474             ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} -DNO_MODULES clean
475 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KRNLSRCDIR}/modules)
476         cd ${KRNLOBJDIR}/${_kernel}; \
477             ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} cleandir
478 .endif
479 .endif
480         cd ${KRNLOBJDIR}/${_kernel}; \
481             MAKESRCPATH=${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm \
482             ${MAKE} -DBOOTSTRAPPING -f ${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm/Makefile
483 .if !defined(NO_KERNELDEPEND)
484         cd ${KRNLOBJDIR}/${_kernel}; \
485             ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend
486 .endif
487         cd ${KRNLOBJDIR}/${_kernel}; \
488             ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all
489         @echo "--------------------------------------------------------------"
490         @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
491         @echo "--------------------------------------------------------------"
492 .endfor
493
494 #
495 # installkernel
496 #
497 # Install the kernel defined by INSTALLKERNEL
498 #
499 installkernel reinstallkernel:
500         cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
501             ${CROSSENV} ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
502
503 #
504 # update
505 #
506 # Update the source tree, by running sup and/or running cvs to update to the
507 # latest copy.
508 #
509 update:
510 .if defined(SUP_UPDATE)
511         @echo "--------------------------------------------------------------"
512         @echo ">>> Running ${SUP}"
513         @echo "--------------------------------------------------------------"
514 .if defined(SUPFILE)
515         @${SUP} ${SUPFLAGS} ${SUPFILE}
516 .endif
517 .if defined(SUPFILE1)
518         @${SUP} ${SUPFLAGS} ${SUPFILE1}
519 .endif
520 .if defined(SUPFILE2)
521         @${SUP} ${SUPFLAGS} ${SUPFILE2}
522 .endif
523 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
524         @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
525 .endif
526 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
527         @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
528 .endif
529 .endif
530 .if defined(CVS_UPDATE)
531         @echo "--------------------------------------------------------------"
532         @echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
533         @echo "--------------------------------------------------------------"
534         cd ${.CURDIR}; cvs -q update -rRELENG_4 -P -d
535 .endif
536
537 #
538 # most
539 #
540 # Build most of the user binaries on the existing system libs and includes.
541 #
542 most:
543         @echo "--------------------------------------------------------------"
544         @echo ">>> Building programs only"
545         @echo "--------------------------------------------------------------"
546 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin
547         cd ${.CURDIR}/${_dir};          ${MAKE} DIRPRFX=${_dir}/ all
548 .endfor
549
550 #
551 # installmost
552 #
553 # Install the binaries built by the 'most' target.  This does not include
554 # libraries or include files.
555 #
556 installmost:
557         @echo "--------------------------------------------------------------"
558         @echo ">>> Installing programs only"
559         @echo "--------------------------------------------------------------"
560 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin
561         cd ${.CURDIR}/${_dir};          ${MAKE} DIRPRFX=${_dir}/ install
562 .endfor
563
564 #
565 # ------------------------------------------------------------------------
566 #
567 # From here onwards are utility targets used by the 'make world' and
568 # related targets.  If your 'world' breaks, you may like to try to fix
569 # the problem and manually run the following targets to attempt to
570 # complete the build.  Beware, this is *not* guaranteed to work, you
571 # need to have a pretty good grip on the current state of the system
572 # to attempt to manually finish it.  If in doubt, 'make world' again.
573 #
574
575 #
576 # bootstrap-tools: Build tools needed for compatibility
577 #
578 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
579 _strfile=       games/fortune/strfile
580 .endif
581
582 bootstrap-tools:
583 .for _tool in ${_strfile} usr.bin/yacc usr.bin/colldef \
584     usr.bin/uudecode usr.bin/xinstall \
585     usr.sbin/config \
586     gnu/usr.bin/gperf gnu/usr.bin/groff gnu/usr.bin/texinfo
587         ${ECHODIR} "===> ${_tool}"; \
588                 cd ${.CURDIR}/${_tool}; \
589                 ${MAKE} DIRPRFX=${_tool}/ obj; \
590                 ${MAKE} DIRPRFX=${_tool}/ depend; \
591                 ${MAKE} DIRPRFX=${_tool}/ all; \
592                 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
593 .endfor
594
595 #
596 # build-tools: Build special purpose build tools
597 #
598 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
599 _games= games/adventure games/hack games/phantasia
600 .endif
601
602 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
603 _share= share/syscons/scrnmaps
604 .endif
605
606 .if !defined(NO_FORTRAN)
607 _fortran= gnu/usr.bin/cc/f771
608 .endif
609
610 .if !defined(NOPERL)
611 _perl=  gnu/usr.bin/perl/miniperl
612 .endif
613
614 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
615     !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
616 _libkrb5= kerberos5/lib/libroken kerberos5/lib/libvers \
617     kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl
618 .endif
619
620 .if defined(RELEASEDIR)
621 _sysinstall= release/sysinstall
622 .endif
623
624 build-tools:
625 .for _tool in bin/csh bin/sh ${_games} gnu/usr.bin/cc/cc_tools ${_fortran} \
626     ${_perl} ${_libroken4} ${_libkrb5} lib/libncurses ${_share} \
627     usr.bin/awk usr.bin/file ${_sysinstall}
628         ${ECHODIR} "===> ${_tool}"; \
629                 cd ${.CURDIR}/${_tool}; \
630                 ${MAKE} DIRPRFX=${_tool}/ obj; \
631                 ${MAKE} DIRPRFX=${_tool}/ build-tools
632 .endfor
633
634 #
635 # cross-tools: Build cross-building tools
636 #
637 .if ${TARGET_ARCH} == "alpha" && ${MACHINE_ARCH} != "alpha"
638 _elf2exe=       usr.sbin/elf2exe
639 .endif
640
641 .if ${TARGET_ARCH} == "i386" && ${MACHINE_ARCH} != "i386"
642 _btxld= usr.sbin/btxld
643 .endif
644
645 cross-tools:
646 .for _tool in ${_btxld} ${_elf2exe} usr.bin/genassym usr.bin/gensetdefs \
647     gnu/usr.bin/binutils usr.bin/objformat usr.sbin/crunch/crunchide \
648     gnu/usr.bin/cc
649         ${ECHODIR} "===> ${_tool}"; \
650                 cd ${.CURDIR}/${_tool}; \
651                 ${MAKE} DIRPRFX=${_tool}/ obj; \
652                 ${MAKE} DIRPRFX=${_tool}/ depend; \
653                 ${MAKE} DIRPRFX=${_tool}/ all; \
654                 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
655 .endfor
656
657 #
658 # hierarchy - ensure that all the needed directories are present
659 #
660 hierarchy:
661         cd ${.CURDIR}/etc;              ${MAKE} distrib-dirs
662
663 #
664 # libraries - build all libraries, and install them under ${DESTDIR}.
665 #
666 # The list of libraries with dependents (${_prebuild_libs}) and their
667 # interdependencies (__L) are built automatically by the
668 # ${.CURDIR}/tools/make_libdeps.sh script.
669 #
670 libraries:
671         cd ${.CURDIR}; \
672             ${MAKE} -f Makefile.inc1 _startup_libs; \
673             ${MAKE} -f Makefile.inc1 _prebuild_libs; \
674             ${MAKE} -f Makefile.inc1 _generic_libs;
675
676 # These dependencies are not automatically generated:
677 #
678 # gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all
679 # shared libraries for ELF.
680 #
681 _startup_libs=  gnu/lib/csu gnu/lib/libgcc
682 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-${OBJFORMAT})
683 _startup_libs+= lib/csu/${MACHINE_ARCH}-${OBJFORMAT}
684 .else
685 _startup_libs+= lib/csu/${MACHINE_ARCH}
686 .endif
687
688 _prebuild_libs=
689
690 _generic_libs=  gnu/lib
691
692 .if !defined(NOPERL)
693 _generic_libs+= gnu/usr.bin/perl/libperl
694 .endif
695
696 .if !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
697 _prebuild_libs+=        kerberos5/lib/libasn1
698 _prebuild_libs+=        kerberos5/lib/libgssapi
699 _prebuild_libs+=        kerberos5/lib/libkrb5
700 _prebuild_libs+=        kerberos5/lib/libroken
701 _generic_libs+= kerberos5/lib
702 .endif
703
704 _prebuild_libs+= lib/libcom_err lib/libcrypt lib/libmd \
705                 lib/libncurses lib/libopie lib/libradius lib/libskey \
706                 lib/libtacplus lib/libutil \
707                 lib/libz lib/msun
708
709 lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L
710 lib/libskey__L: lib/libcrypt__L lib/libmd__L
711
712 _generic_libs+= lib
713
714 .if !defined(NOCRYPT)
715 .if !defined(NO_OPENSSL)
716 _prebuild_libs+=        secure/lib/libcrypto secure/lib/libssl
717 .if !defined(NO_OPENSSH)
718 _prebuild_libs+=        secure/lib/libssh
719 secure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L
720 .endif
721 .endif
722 _generic_libs+= secure/lib
723 .endif
724
725 _generic_libs+= usr.bin/lex/lib
726
727 .if ${MACHINE_ARCH} == "i386"
728 _generic_libs+= usr.sbin/pcvt/keycap
729 .endif
730
731 .for _lib in ${_startup_libs} ${_prebuild_libs} ${_generic_libs}
732 ${_lib}__L: .PHONY
733 .if exists(${.CURDIR}/${_lib})
734         ${ECHODIR} "===> ${_lib}"; \
735                 cd ${.CURDIR}/${_lib}; \
736                 ${MAKE} DIRPRFX=${_lib}/ depend; \
737                 ${MAKE} DIRPRFX=${_lib}/ all; \
738                 ${MAKE} DIRPRFX=${_lib}/ install
739 .endif
740 .endfor
741
742 _startup_libs: ${_startup_libs:S/$/__L/}
743 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
744 _generic_libs: ${_generic_libs:S/$/__L/}
745
746 .for __target in clean cleandepend cleandir depend includes obj
747 .for entry in ${SUBDIR}
748 ${entry}.${__target}__D: .PHONY
749         @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
750                 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
751                 edir=${entry}.${MACHINE_ARCH}; \
752                 cd ${.CURDIR}/$${edir}; \
753         else \
754                 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
755                 edir=${entry}; \
756                 cd ${.CURDIR}/$${edir}; \
757         fi; \
758         ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
759 .endfor
760 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
761 .endfor
762
763 # The wmake target is used by /usr/bin/wmake to run make in a
764 # world build environment.
765 #
766 wmake:
767         @echo '${WMAKEENV} ${MAKE} ${WMAKE_ARGS}'
768
769 wmakeenv:
770         @echo '${WMAKEENV} /bin/sh'
771
772 .include <bsd.subdir.mk>
773