1#
2# $Id: Makefile,v 1.209 1998/08/04 17:13:38 bde Exp $
3#
4# While porting to the another architecture include the bootstrap instead
5# of the normal build.
6#
7.if exists(${.CURDIR}/Makefile.${MACHINE}) && defined(BOOTSTRAP_WORLD)
8.include "${.CURDIR}/Makefile.${MACHINE}"
9.else
10#
11# Make command line options:
12# -DCLOBBER will remove /usr/include
13# -DMAKE_KERBEROS4 to build KerberosIV
14# -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
15# -DNOCLEAN do not clean at all
16# -DNOTOOLS do not rebuild any tools first
17# -DNOCRYPT will prevent building of crypt versions
18# -DNOLKM do not build loadable kernel modules
19# -DNOOBJDIR do not run ``${MAKE} obj''
20# -DNOPROFILE do not build profiled libraries
21# -DNOSECURE do not go into secure subdir
22# -DNOGAMES do not go into games subdir
23# -DNOSHARE do not go into share subdir
24# -DNOINFO do not make or install info files
25# -DNOLIBC_R do not build libc_r.
26# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
27
28#
29# The intended user-driven targets are:
30# buildworld - rebuild *everything*, including glue to help do upgrades
31# installworld- install everything built by "buildworld"
32# world - buildworld + installworld
33# update - convenient way to update your source tree (eg: sup/cvs)
34# most - build user commands, no libraries or include files
35# installmost - install user commands, no libraries or include files
36#
37# Standard targets (not defined here) are documented in the makefiles in
38# /usr/share/mk. These include:
39# obj depend all install clean cleandepend cleanobj
40
41.if (!make(world)) && (!make(buildworld)) && (!make(installworld))
42.MAKEFLAGS:= -m ${.CURDIR}/share/mk ${.MAKEFLAGS}
43.endif
44
45#
46# Pick up any macros that are defined in the src-relative bsd.own.mk
47# but not in the "system" bsd.own.mk. The "system" version has
48# unfortunately already been included by the "system" sys.mk, so this
49# only works for new macros. First undefine old macros that cause
50# problems.
51#
52.undef LIBDIR
53.include "${.CURDIR}/share/mk/bsd.own.mk"
54
55# Put initial settings here.
56SUBDIR=
57
58# We must do share/info early so that installation of info `dir'
59# entries works correctly. Do it first since it is less likely to
60# grow dependencies on include and lib than vice versa.
61.if exists(share/info)
62SUBDIR+= share/info
63.endif
64
65# We must do include and lib early so that the perl *.ph generation
66# works correctly as it uses the header files installed by this.
67.if exists(include)
68SUBDIR+= include
69.endif
70.if exists(lib)
71SUBDIR+= lib
72.endif
73
74.if exists(bin)
75SUBDIR+= bin
76.endif
77.if exists(games) && !defined(NOGAMES)
78SUBDIR+= games
79.endif
80.if exists(gnu)
81SUBDIR+= gnu
82.endif
83.if exists(kerberosIV) && exists(crypto) && !defined(NOCRYPT) && \
84 defined(MAKE_KERBEROS4)
85SUBDIR+= kerberosIV
86.endif
87.if exists(libexec)
88SUBDIR+= libexec
89.endif
90.if exists(sbin)
91SUBDIR+= sbin
92.endif
93.if exists(share) && !defined(NOSHARE)
94SUBDIR+= share
95.endif
96.if exists(sys)
97SUBDIR+= sys
98.endif
99.if exists(usr.bin)
100SUBDIR+= usr.bin
101.endif
102.if exists(usr.sbin)
103SUBDIR+= usr.sbin
104.endif
105.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
106SUBDIR+= secure
107.endif
108.if exists(lkm) && !defined(NOLKM)
109SUBDIR+= lkm
110.endif
111
112# etc must be last for "distribute" to work
113.if exists(etc)
114SUBDIR+= etc
115.endif
116
117# These are last, since it is nice to at least get the base system
118# rebuilt before you do them.
119.if defined(LOCAL_DIRS)
120.for _DIR in ${LOCAL_DIRS}
121.if exists(${_DIR}) & exists(${_DIR}/Makefile)
122SUBDIR+= ${_DIR}
123.endif
124.endfor
125.endif
126
127# Handle -DNOOBJDIR, -DNOCLEAN and -DNOCLEANDIR
128.if defined(NOOBJDIR)
129OBJDIR=
130.else
131OBJDIR= obj
132.endif
133
134.if defined(NOCLEAN)
135CLEANDIR=
136.else
137.if defined(NOCLEANDIR)
138CLEANDIR= clean cleandepend
139.else
140CLEANDIR= cleandir
141.endif
142.endif
143
144.if !defined(NOCLEAN)
145_NODEPEND= true
146.endif
147.if defined(_NODEPEND)
148_DEPEND= cleandepend
149.else
150_DEPEND= depend
151.endif
152
153SUP?= cvsup
154SUPFLAGS?= -g -L 2 -P -
155
156#
157# While building tools for bootstrapping, we don't need to waste time on
158# shared or profiled libraries, shared linkage, or documentation, except
159# when the tools won't get cleaned we must use the defaults for shared
160# libraries and shared linkage (and this doesn't waste time).
161# XXX actually, we do need to waste time building shared libraries.
162#
163.if defined(NOCLEAN)
164MK_FLAGS= -DNOINFO -DNOMAN -DNOPROFILE
165.else
166MK_FLAGS= -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED
167.endif
168
169#
170# world
171#
172# Attempt to rebuild and reinstall *everything*, with reasonable chance of
173# success, regardless of how old your existing system is.
174#
175# >> Beware, it overwrites the local build environment! <<
176#
177world:
178 @echo "--------------------------------------------------------------"
179 @echo "make world started on `LC_TIME=C date`"
180 @echo "--------------------------------------------------------------"
181.if target(pre-world)
182 @echo
183 @echo "--------------------------------------------------------------"
184 @echo " Making 'pre-world' target"
185 @echo "--------------------------------------------------------------"
186 cd ${.CURDIR}; ${MAKE} pre-world
187.endif
188 cd ${.CURDIR}; ${MAKE} buildworld
189 cd ${.CURDIR}; ${MAKE} -B installworld
190.if target(post-world)
191 @echo
192 @echo "--------------------------------------------------------------"
193 @echo " Making 'post-world' target"
194 @echo "--------------------------------------------------------------"
195 cd ${.CURDIR}; ${MAKE} post-world
196.endif
197 @echo
198 @echo "--------------------------------------------------------------"
199 @echo "make world completed on `LC_TIME=C date`"
200 @echo "--------------------------------------------------------------"
201
202.if defined(MAKEOBJDIRPREFIX)
203WORLDTMP= ${MAKEOBJDIRPREFIX}${.CURDIR}/tmp
204.else
205WORLDTMP= /usr/obj${.CURDIR}/tmp
206.endif
207STRICTTMPPATH= ${WORLDTMP}/sbin:${WORLDTMP}/usr/sbin:${WORLDTMP}/bin:${WORLDTMP}/usr/bin
208TMPPATH= ${STRICTTMPPATH}:${PATH}
209
210# XXX COMPILER_PATH is needed for finding cc1, ld and as
211# XXX GCC_EXEC_PREFIX is for *crt.o. It is probably unnecessary now
212# that LIBRARY_PATH is set. We still can't use -nostdlib, since gcc
213# wouldn't link *crt.o or libgcc if it were used.
214# XXX LD_LIBRARY_PATH is for ld.so. It is also used by ld, although we don't
215# want that - all compile-time library paths should be resolved by gcc.
216# It fails for set[ug]id executables (are any used?).
217COMPILER_ENV= BISON_SIMPLE=${WORLDTMP}/usr/share/misc/bison.simple \
218 COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \
219 GCC_EXEC_PREFIX=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib/ \
220 LD_LIBRARY_PATH=${WORLDTMP}${SHLIBDIR} \
221 LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib
222
223BMAKEENV= PATH=${TMPPATH} ${COMPILER_ENV} NOEXTRADEPEND=t \
224 OBJFORMAT_PATH=${WORLDTMP}/usr/libexec:/usr/libexec
225XMAKEENV= PATH=${STRICTTMPPATH} ${COMPILER_ENV} \
226 OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \
227 CFLAGS="-nostdinc ${CFLAGS}" # XXX -nostdlib
228
229# used to compile and install 'make' in temporary build tree
230MAKETMP= ${WORLDTMP}/make
231IBMAKE= ${BMAKEENV} MAKEOBJDIR=${MAKETMP} ${MAKE} DESTDIR=${WORLDTMP}
232# bootstrap make
233BMAKE= ${BMAKEENV} ${WORLDTMP}/usr/bin/make DESTDIR=${WORLDTMP}
234# cross make used for compilation
235XMAKE= ${XMAKEENV} ${WORLDTMP}/usr/bin/make DESTDIR=${WORLDTMP}
236# cross make used for final installation
237IXMAKE= ${XMAKEENV} ${WORLDTMP}/usr/bin/make
238
239#
240# buildworld
241#
242# Attempt to rebuild the entire system, with reasonable chance of
243# success, regardless of how old your existing system is.
244#
245buildworld:
246.if !defined(NOCLEAN)
247 @echo
248 @echo "--------------------------------------------------------------"
249 @echo " Cleaning up the temporary build tree"
250 @echo "--------------------------------------------------------------"
251 mkdir -p ${WORLDTMP}
252 chflags -R noschg ${WORLDTMP}/
253 rm -rf ${WORLDTMP}
254.endif
255.if !defined(NOTOOLS)
256 @echo
257 @echo "--------------------------------------------------------------"
258 @echo " Making make"
259 @echo "--------------------------------------------------------------"
260 mkdir -p ${WORLDTMP}/usr/bin ${MAKETMP}
261 ( \
262 cd ${.CURDIR}/usr.bin/make; \
263 MAKEOBJDIRPREFIX=""; unset MAKEOBJDIRPREFIX; \
264 ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} all; \
265 ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} install; \
266 ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} clean \
267 )
268 @echo
269 @echo "--------------------------------------------------------------"
270 @echo " Making mtree"
271 @echo "--------------------------------------------------------------"
272 mkdir -p ${WORLDTMP}/usr/sbin ${WORLDTMP}/mtree
273 ( \
274 cd ${.CURDIR}/usr.sbin/mtree; \
275 MAKEOBJDIRPREFIX=""; unset MAKEOBJDIRPREFIX; \
276 export MAKEOBJDIR=${WORLDTMP}/mtree; \
277 ${BMAKE} ${MK_FLAGS} all; \
278 ${BMAKE} ${MK_FLAGS} -B install clean \
279 )
280.endif
281 @echo
282 @echo "--------------------------------------------------------------"
283 @echo " Making hierarchy"
284 @echo "--------------------------------------------------------------"
285 cd ${.CURDIR}; ${BMAKE} hierarchy
286.if !defined(NOCLEAN)
287 @echo
288 @echo "--------------------------------------------------------------"
289 @echo " Cleaning up the obj tree"
290 @echo "--------------------------------------------------------------"
291 cd ${.CURDIR}; ${BMAKE} ${CLEANDIR:S/^/par-/}
292.endif
293.if !defined(NOOBJDIR)
294 @echo
295 @echo "--------------------------------------------------------------"
296 @echo " Rebuilding the obj tree"
297 @echo "--------------------------------------------------------------"
298 cd ${.CURDIR}; ${BMAKE} par-${OBJDIR}
299.endif
300.if !defined(NOTOOLS)
301 @echo
302 @echo "--------------------------------------------------------------"
303 @echo " Rebuilding bootstrap tools"
304 @echo "--------------------------------------------------------------"
305 cd ${.CURDIR}; ${BMAKE} bootstrap
306 @echo
307 @echo "--------------------------------------------------------------"
308 @echo " Rebuilding tools necessary to build the include files"
309 @echo "--------------------------------------------------------------"
310 cd ${.CURDIR}; ${BMAKE} include-tools
311.endif
312 @echo
313 @echo "--------------------------------------------------------------"
314 @echo " Rebuilding ${DESTDIR}/usr/include"
315 @echo "--------------------------------------------------------------"
316 cd ${.CURDIR}; SHARED=copies ${BMAKE} includes
317 @echo
318 @echo "--------------------------------------------------------------"
319 @echo " Rebuilding bootstrap libraries"
320 @echo "--------------------------------------------------------------"
321 cd ${.CURDIR}; ${BMAKE} bootstrap-libraries
322.if !defined(NOTOOLS)
323 @echo
324 @echo "--------------------------------------------------------------"
325 @echo " Rebuilding tools needed to build libraries"
326 @echo "--------------------------------------------------------------"
327 cd ${.CURDIR}; ${BMAKE} lib-tools
328.endif
329.if !defined(NOTOOLS)
330 @echo
331 @echo "--------------------------------------------------------------"
332 @echo " Rebuilding all other tools needed to build the world"
333 @echo "--------------------------------------------------------------"
334 cd ${.CURDIR}; ${BMAKE} build-tools
335.endif
336.if !defined(_NODEPEND)
337 @echo
338 @echo "--------------------------------------------------------------"
339 @echo " Rebuilding dependencies"
340 @echo "--------------------------------------------------------------"
341 cd ${.CURDIR}; ${XMAKE} par-depend
342.endif
343 @echo
344 @echo "--------------------------------------------------------------"
345 @echo " Building libraries"
346 @echo "--------------------------------------------------------------"
347 cd ${.CURDIR}; ${XMAKE} -DNOINFO -DNOMAN libraries
348 @echo
349 @echo "--------------------------------------------------------------"
350 @echo " Building everything.."
351 @echo "--------------------------------------------------------------"
352 cd ${.CURDIR}; ${XMAKE} all
353
354#
355# installworld
356#
357# Installs everything compiled by a 'buildworld'.
358#
359installworld:
360 cd ${.CURDIR}; ${IXMAKE} reinstall
361
362#
363# reinstall
364#
365# If you have a build server, you can NFS mount the source and obj directories
366# and do a 'make reinstall' on the *client* to install new binaries from the
367# most recent server build.
368#
369reinstall:
370 @echo "--------------------------------------------------------------"
371 @echo " Making hierarchy"
372 @echo "--------------------------------------------------------------"
373 cd ${.CURDIR}; ${MAKE} hierarchy
374 @echo
375 @echo "--------------------------------------------------------------"
376 @echo " Installing everything.."
377 @echo "--------------------------------------------------------------"
378 cd ${.CURDIR}; ${MAKE} install
379.if ${MACHINE_ARCH} == "i386"
380 @echo
381 @echo "--------------------------------------------------------------"
382 @echo " Re-scanning the shared libraries.."
383 @echo "--------------------------------------------------------------"
384 cd ${.CURDIR}; /sbin/ldconfig -R
385.endif
386 @echo
387 @echo "--------------------------------------------------------------"
388 @echo " Rebuilding man page indexes"
389 @echo "--------------------------------------------------------------"
390 cd ${.CURDIR}/share/man; ${MAKE} makedb
391
392#
393# update
394#
395# Update the source tree, by running sup and/or running cvs to update to the
396# latest copy.
397#
398update:
399.if defined(SUP_UPDATE)
400 @echo "--------------------------------------------------------------"
401 @echo "Running ${SUP}"
402 @echo "--------------------------------------------------------------"
403 @${SUP} ${SUPFLAGS} ${SUPFILE}
404.if defined(SUPFILE1)
405 @${SUP} ${SUPFLAGS} ${SUPFILE1}
406.endif
407.if defined(SUPFILE2)
408 @${SUP} ${SUPFLAGS} ${SUPFILE2}
409.endif
410.endif
411.if defined(CVS_UPDATE)
412 @echo "--------------------------------------------------------------"
413 @echo "Updating /usr/src from cvs repository" ${CVSROOT}
414 @echo "--------------------------------------------------------------"
415 cd ${.CURDIR}; cvs -q update -P -d
416.endif
417
418#
419# most
420#
421# Build most of the user binaries on the existing system libs and includes.
422#
423most:
424 @echo "--------------------------------------------------------------"
425 @echo " Building programs only"
426 @echo "--------------------------------------------------------------"
427 cd ${.CURDIR}/bin; ${MAKE} all
428 cd ${.CURDIR}/sbin; ${MAKE} all
429 cd ${.CURDIR}/libexec; ${MAKE} all
430 cd ${.CURDIR}/usr.bin; ${MAKE} all
431 cd ${.CURDIR}/usr.sbin; ${MAKE} all
432 cd ${.CURDIR}/gnu/libexec; ${MAKE} all
433 cd ${.CURDIR}/gnu/usr.bin; ${MAKE} all
434 cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} all
435#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
436# cd ${.CURDIR}/kerberosIV; ${MAKE} most
437#.endif
438#.if !defined(NOSECURE) && !defined(NOCRYPT)
439# cd ${.CURDIR}/secure; ${MAKE} most
440#.endif
441
442#
443# installmost
444#
445# Install the binaries built by the 'most' target. This does not include
446# libraries or include files.
447#
448installmost:
449 @echo "--------------------------------------------------------------"
450 @echo " Installing programs only"
451 @echo "--------------------------------------------------------------"
452 cd ${.CURDIR}/bin; ${MAKE} install
453 cd ${.CURDIR}/sbin; ${MAKE} install
454 cd ${.CURDIR}/libexec; ${MAKE} install
455 cd ${.CURDIR}/usr.bin; ${MAKE} install
456 cd ${.CURDIR}/usr.sbin; ${MAKE} install
457 cd ${.CURDIR}/gnu/libexec; ${MAKE} install
458 cd ${.CURDIR}/gnu/usr.bin; ${MAKE} install
459 cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} install
460#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
461# cd ${.CURDIR}/kerberosIV; ${MAKE} installmost
462#.endif
463#.if !defined(NOSECURE) && !defined(NOCRYPT)
464# cd ${.CURDIR}/secure; ${MAKE} installmost
465#.endif
466
467#
468# ------------------------------------------------------------------------
469#
470# From here onwards are utility targets used by the 'make world' and
471# related targets. If your 'world' breaks, you may like to try to fix
472# the problem and manually run the following targets to attempt to
473# complete the build. Beware, this is *not* guaranteed to work, you
474# need to have a pretty good grip on the current state of the system
475# to attempt to manually finish it. If in doubt, 'make world' again.
476#
477
478#
479# heirarchy - ensure that all the needed directories are present
480#
481hierarchy:
482 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
483
484#
485# bootstrap - [re]build tools needed to run the actual build, this includes
486# tools needed by 'make depend', as some tools are needed to generate source
487# for the dependency information to be gathered from.
488#
489bootstrap:
490.if defined(DESTDIR)
491 rm -f ${DESTDIR}/usr/src/sys
492 ln -s ${.CURDIR}/sys ${DESTDIR}/usr/src
493 cd ${.CURDIR}/include; find -dx . | cpio -dump ${DESTDIR}/usr/include
494.for d in net netinet posix4 sys vm machine
495 if [ -h ${DESTDIR}/usr/include/$d ]; then \
496 rm -f ${DESTDIR}/usr/include/$d ; \
497 fi
498.endfor
499 cd ${.CURDIR}/sys; \
500 find -dx net netinet posix4 sys vm -name '*.h' -o -type d | \
501 cpio -dump ${DESTDIR}/usr/include
502 mkdir -p ${DESTDIR}/usr/include/machine
503 cd ${.CURDIR}/sys/${MACHINE_ARCH}/include; find -dx . -name '*.h' -o -type d | \
504 cpio -dump ${DESTDIR}/usr/include/machine
505.endif
506 cd ${.CURDIR}/usr.bin/make; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
507 ${MAKE} ${MK_FLAGS} all; \
508 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
509 cd ${.CURDIR}/usr.bin/xinstall; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
510 ${MAKE} ${MK_FLAGS} all; \
511 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
512 cd ${.CURDIR}/usr.bin/yacc; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
513 ${MAKE} ${MK_FLAGS} all; \
514 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
515 cd ${.CURDIR}/usr.bin/lex; ${MAKE} bootstrap; \
516 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
517 ${MAKE} ${MK_FLAGS} -DNOLIB all; \
518 ${MAKE} ${MK_FLAGS} -DNOLIB -B install ${CLEANDIR}
519.if !defined(NOOBJDIR)
520 cd ${.CURDIR}/usr.bin/lex; ${MAKE} ${OBJDIR}
521.endif
522 cd ${.CURDIR}/usr.sbin/mtree; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
523 ${MAKE} ${MK_FLAGS} all; \
524 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
525.if defined(DESTDIR)
526 cd ${.CURDIR}/include && ${MAKE} copies
527.endif
528
529#
530# include-tools - generally the same as 'bootstrap', except that it's for
531# things that are specifically needed to generate include files.
532#
533# XXX should be merged with bootstrap, it's not worth keeeping them separate.
534# Well, maybe it is now. We force 'cleandepend' here to avoid dependencies
535# on cleaned away headers in ${WORLDTMP}.
536#
537include-tools:
538.for d in usr.bin/compile_et usr.bin/rpcgen
539 cd ${.CURDIR}/$d; ${MAKE} cleandepend; \
540 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
541 ${MAKE} ${MK_FLAGS} all; \
542 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
543.endfor
544
545#
546# includes - possibly generate and install the include files.
547#
548includes:
549.if defined(CLOBBER)
550 rm -rf ${DESTDIR}/usr/include/*
551 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
552 -p ${DESTDIR}/usr/include
553.endif
554 cd ${.CURDIR}/include; ${MAKE} -B all install
555 cd ${.CURDIR}/gnu/include; ${MAKE} install
556 cd ${.CURDIR}/gnu/lib/libmp; ${MAKE} beforeinstall
557 cd ${.CURDIR}/gnu/lib/libobjc; ${MAKE} beforeinstall
558 cd ${.CURDIR}/gnu/lib/libreadline; ${MAKE} beforeinstall
559 cd ${.CURDIR}/gnu/lib/libregex; ${MAKE} beforeinstall
560 cd ${.CURDIR}/gnu/lib/libstdc++; ${MAKE} beforeinstall
561 cd ${.CURDIR}/gnu/lib/libg++; ${MAKE} beforeinstall
562 cd ${.CURDIR}/gnu/lib/libdialog; ${MAKE} beforeinstall
563 cd ${.CURDIR}/gnu/lib/libgmp; ${MAKE} beforeinstall
564.if exists(secure) && !defined(NOCRYPT)
565 cd ${.CURDIR}/secure/lib/libdes; ${MAKE} beforeinstall
566.endif
567.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
568 cd ${.CURDIR}/kerberosIV/lib/libacl; ${MAKE} beforeinstall
569 cd ${.CURDIR}/kerberosIV/lib/libkadm; ${MAKE} beforeinstall
570 cd ${.CURDIR}/kerberosIV/lib/libkafs; ${MAKE} beforeinstall
571 cd ${.CURDIR}/kerberosIV/lib/libkdb; ${MAKE} beforeinstall
572 cd ${.CURDIR}/kerberosIV/lib/libkrb; ${MAKE} beforeinstall
573 cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall
574.else
575 cd ${.CURDIR}/lib/libtelnet; ${MAKE} beforeinstall
576.endif
577.if exists(${.CURDIR}/lib/csu/${MACHINE})
578 cd ${.CURDIR}/lib/csu/${MACHINE}; ${MAKE} beforeinstall
579.endif
580 cd ${.CURDIR}/lib/libalias; ${MAKE} beforeinstall
581 cd ${.CURDIR}/lib/libc; ${MAKE} beforeinstall
582 cd ${.CURDIR}/lib/libcalendar; ${MAKE} beforeinstall
583 cd ${.CURDIR}/lib/libcurses; ${MAKE} beforeinstall
584 cd ${.CURDIR}/lib/libdisk; ${MAKE} beforeinstall
585 cd ${.CURDIR}/lib/libedit; ${MAKE} beforeinstall
586 cd ${.CURDIR}/lib/libftpio; ${MAKE} beforeinstall
587 cd ${.CURDIR}/lib/libmd; ${MAKE} beforeinstall
588 cd ${.CURDIR}/lib/libmytinfo; ${MAKE} beforeinstall
589 cd ${.CURDIR}/lib/libncurses; ${MAKE} beforeinstall
590.if !defined(WANT_CSRG_LIBM)
591 cd ${.CURDIR}/lib/msun; ${MAKE} beforeinstall
592.endif
593 cd ${.CURDIR}/lib/libopie; ${MAKE} beforeinstall
594 cd ${.CURDIR}/lib/libpcap; ${MAKE} beforeinstall
595 cd ${.CURDIR}/lib/librpcsvc; ${MAKE} beforeinstall
596 cd ${.CURDIR}/lib/libskey; ${MAKE} beforeinstall
597.if !defined(NOTCL) && exists (${.CURDIR}/contrib/tcl) && \
598 exists(${.CURDIR}/usr.bin/tclsh) && exists (${.CURDIR}/lib/libtcl)
599 cd ${.CURDIR}/lib/libtcl; ${MAKE} installhdrs
600.endif
601 cd ${.CURDIR}/lib/libtermcap; ${MAKE} beforeinstall
602 cd ${.CURDIR}/lib/libcom_err; ${MAKE} beforeinstall
603 cd ${.CURDIR}/lib/libss; ${MAKE} -B hdrs beforeinstall
604 cd ${.CURDIR}/lib/libscsi; ${MAKE} beforeinstall
605 cd ${.CURDIR}/lib/libutil; ${MAKE} beforeinstall
606 cd ${.CURDIR}/lib/libvgl; ${MAKE} beforeinstall
607 cd ${.CURDIR}/lib/libz; ${MAKE} beforeinstall
608 cd ${.CURDIR}/usr.bin/f2c; ${MAKE} beforeinstall
609 cd ${.CURDIR}/usr.bin/lex; ${MAKE} beforeinstall
610
611#
612# Declare tools if they are not required on all architectures.
613#
614.if ${MACHINE_ARCH} == "i386"
615# aout tools:
616_aout_ar = usr.bin/ar
617_aout_as = gnu/usr.bin/as
618_aout_ld = gnu/usr.bin/ld
619_aout_nm = usr.bin/nm
620_aout_ranlib = usr.bin/ranlib
621_aout_size = usr.bin/size
622_aout_strip = usr.bin/strip
623.endif
624
625#
626# lib-tools - build tools to compile and install the libraries.
627#
628# XXX gperf is required for cc
629# XXX a new ld and tsort is required for cc
630lib-tools:
631.for d in \
632 gnu/usr.bin/gperf \
633 ${_aout_ld} \
634 usr.bin/tsort \
635 ${_aout_as} \
636 gnu/usr.bin/bison \
637 gnu/usr.bin/cc \
638 ${_aout_ar} \
639 usr.bin/env \
640 usr.bin/lex/lib \
641 usr.bin/mk_cmds \
642 ${_aout_nm} \
643 ${_aout_ranlib} \
644 ${_aout_strip} \
645 gnu/usr.bin/binutils \
646 usr.bin/uudecode \
647 usr.bin/objformat
648 cd ${.CURDIR}/$d; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
649 ${MAKE} ${MK_FLAGS} all; \
650 ${MAKE} ${MK_FLAGS} -B install; \
651 ${MAKE} ${MK_FLAGS:S/-DNOPIC//} -B ${CLEANDIR} ${OBJDIR}
652.endfor
653
654#
655# We have to know too much about ordering and subdirs in the lib trees:
656#
657# To satisfy shared library linkage when only the libraries being built
658# are visible:
659#
660# libcom_err must be built before libss.
661# libcrypt and libmd must be built before libskey.
662# libm must be built before libtcl.
663# libmytinfo must be built before libdialog and libncurses.
664# libncurses must be built before libdialog.
665# libtermcap must be built before libcurses, libedit and libreadline.
666#
667# Some libraries are built conditionally and/or are in inconsistently
668# named directories:
669#
670.if exists(lib/csu/${MACHINE}.pcc)
671_csu=lib/csu/${MACHINE}.pcc
672.else
673_csu=lib/csu/${MACHINE}
674.endif
675
676.if !defined(NOSECURE) && !defined(NOCRYPT)
677_libcrypt= secure/lib/libcrypt lib/libcrypt
678.else
679_libcrypt= lib/libcrypt
680.endif
681
682.if defined(WANT_CSRG_LIBM)
683_libm= lib/libm
684.else
685_libm= lib/msun
686.endif
687
688#
689# bootstrap-libraries - build just enough libraries for the bootstrap
690# tools, and install them under ${WORLDTMP}.
691#
692# Build csu and libgcc early so that some tools get linked to the new
693# versions (too late for the main tools, however). Then build the
694# necessary prerequisite libraries (libtermcap just needs to be before
695# libcurses, and this only matters for the NOCLEAN case when NOPIC is
696# not set).
697#
698# This is mostly wrong. The build tools must run on the host system,
699# so they should use host libraries. We depend on the target being
700# similar enough to the host for new target libraries to work on the
701# host.
702#
703bootstrap-libraries:
704.for _lib in ${_csu} gnu/usr.bin/cc/libgcc lib/libtermcap \
705 gnu/lib/libregex gnu/lib/libreadline lib/libc \
706 ${_libcrypt} lib/libcurses lib/libedit ${_libm} \
707 lib/libmd lib/libutil lib/libz usr.bin/lex/lib
708.if exists(${.CURDIR}/${_lib})
709 cd ${.CURDIR}/${_lib}; \
710 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
711 ${MAKE} ${MK_FLAGS} all; \
712 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
713.endif
714.endfor
715
716#
717# libraries - build all libraries, and install them under ${DESTDIR}.
718#
719# The ordering is not as special as for bootstrap-libraries. Build
720# the prerequisites first, then build almost everything else in
721# alphabetical order.
722#
723libraries:
724.for _lib in lib/libcom_err ${_libcrypt} ${_libm} lib/libmytinfo \
725 lib/libncurses lib/libtermcap \
726 gnu/lib gnu/usr.bin/cc/libgcc lib usr.bin/lex/lib usr.sbin/pcvt/keycap
727.if exists(${.CURDIR}/${_lib})
728 cd ${.CURDIR}/${_lib}; ${MAKE} all; ${MAKE} -B install
729.endif
730.endfor
731.if exists(${.CURDIR}/secure/lib) && !defined(NOCRYPT) && !defined(NOSECURE)
732 cd ${.CURDIR}/secure/lib; ${MAKE} all; ${MAKE} -B install
733.endif
734.if exists(${.CURDIR}/kerberosIV/lib) && !defined(NOCRYPT) && \
735 defined(MAKE_KERBEROS4)
736 cd ${.CURDIR}/kerberosIV/lib; ${MAKE} all; ${MAKE} -B install
737.endif
738
739#
740# Exclude unused tools from build-tools.
741#
742.if !defined(NOGAMES) && exists(${.CURDIR}/games)
743_adventure= games/adventure
744_caesar= games/caesar
745_hack= games/hack
746_phantasia= games/phantasia
747_strfile= games/fortune/strfile
748.endif
749.if !defined(NOPERL)
750_perl= gnu/usr.bin/perl/perl
751.endif
752.if !defined(NOSHARE) && exists(${.CURDIR}/share)
753_scrnmaps= share/syscons/scrnmaps
754.endif
755.if !defined(NOLKM) && exists(${.CURDIR}/lkm)
756_linux= lkm/linux
757.endif
758
759BTMAKEFLAGS= ${MK_FLAGS} -D_BUILD_TOOLS
760
761#
762# build-tools - build and install any other tools needed to complete the
763# compile and install.
764# ifdef stale
765# bc and cpp are required to build groff. Otherwise, the order here is
766# mostly historical, i.e., bogus.
767# chmod is used to build gcc's tmpmultilib[2] at obscure times.
768# endif stale
769# XXX uname is a bug - the target should not depend on the host.
770#
771build-tools:
772.for d in \
773 bin/cat \
774 bin/chmod \
775 bin/cp \
776 bin/date \
777 bin/dd \
778 bin/echo \
779 bin/expr \
780 bin/hostname \
781 bin/ln \
782 bin/ls \
783 bin/mkdir \
784 bin/mv \
785 bin/rm \
786 bin/test \
787 ${_caesar} \
788 ${_strfile} \
789 gnu/usr.bin/awk \
790 gnu/usr.bin/bc \
791 gnu/usr.bin/grep \
792 gnu/usr.bin/groff \
793 gnu/usr.bin/gzip \
794 gnu/usr.bin/man/makewhatis \
795 gnu/usr.bin/patch \
796 ${_perl} \
797 gnu/usr.bin/sort \
798 gnu/usr.bin/texinfo \
799 usr.bin/basename \
800 usr.bin/cap_mkdb \
801 usr.bin/chflags \
802 usr.bin/cmp \
803 usr.bin/col \
804 usr.bin/colldef \
805 usr.bin/cpp \
806 usr.bin/expand \
807 usr.bin/file2c \
808 usr.bin/find \
809 usr.bin/gencat \
810 usr.bin/id \
811 usr.bin/join \
812 usr.bin/lorder \
813 usr.bin/m4 \
814 usr.bin/mkdep \
815 usr.bin/mklocale \
816 usr.bin/paste \
817 usr.bin/sed \
818 ${_aout_size} \
819 usr.bin/soelim \
820 usr.bin/symorder \
821 usr.bin/touch \
822 usr.bin/tr \
823 usr.bin/true \
824 usr.bin/uname \
825 usr.bin/uuencode \
826 usr.bin/vgrind \
827 usr.bin/vi \
828 usr.bin/wc \
829 usr.bin/xargs \
830 usr.bin/yacc \
831 usr.sbin/chown \
832 usr.sbin/mtree \
833 usr.sbin/zic \
834 bin/sh
835 cd ${.CURDIR}/$d; ${MAKE} ${BTMAKEFLAGS} ${_DEPEND}; \
836 ${MAKE} ${BTMAKEFLAGS} all; \
837 ${MAKE} ${BTMAKEFLAGS} -B install ${CLEANDIR} ${OBJDIR}
838.endfor
839.if !defined(NOGAMES) && exists(${.CURDIR}/games)
840 cd ${DESTDIR}/usr/games; cp -p caesar strfile ${DESTDIR}/usr/bin
841.endif
842.for d in \
843 bin/sh \
844 ${_adventure} \
845 ${_hack} \
846 ${_phantasia} \
847 gnu/usr.bin/cc/cc_tools \
848 lib/libmytinfo \
849 ${_linux} \
850 ${_scrnmaps} \
851 sys/i386/boot/netboot
852 cd ${.CURDIR}/$d; ${MAKE} ${BTMAKEFLAGS} build-tools
853.endfor
854 cd ${.CURDIR}/usr.bin/tn3270/tools; ${MAKE} ${BTMAKEFLAGS} all
855
856.for __target in clean cleandepend cleandir depend obj
857.for entry in ${SUBDIR}
858${entry}.${__target}__D: .PHONY
859 @if test -d ${.CURDIR}/${entry}.${MACHINE}; then \
860 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE}"; \
861 edir=${entry}.${MACHINE}; \
862 cd ${.CURDIR}/$${edir}; \
863 else \
864 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
865 edir=${entry}; \
866 cd ${.CURDIR}/$${edir}; \
867 fi; \
868 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
869.endfor
870par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
871.endfor
872
873.endif
874
875.include <bsd.subdir.mk>
2# $Id: Makefile,v 1.209 1998/08/04 17:13:38 bde Exp $
3#
4# While porting to the another architecture include the bootstrap instead
5# of the normal build.
6#
7.if exists(${.CURDIR}/Makefile.${MACHINE}) && defined(BOOTSTRAP_WORLD)
8.include "${.CURDIR}/Makefile.${MACHINE}"
9.else
10#
11# Make command line options:
12# -DCLOBBER will remove /usr/include
13# -DMAKE_KERBEROS4 to build KerberosIV
14# -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
15# -DNOCLEAN do not clean at all
16# -DNOTOOLS do not rebuild any tools first
17# -DNOCRYPT will prevent building of crypt versions
18# -DNOLKM do not build loadable kernel modules
19# -DNOOBJDIR do not run ``${MAKE} obj''
20# -DNOPROFILE do not build profiled libraries
21# -DNOSECURE do not go into secure subdir
22# -DNOGAMES do not go into games subdir
23# -DNOSHARE do not go into share subdir
24# -DNOINFO do not make or install info files
25# -DNOLIBC_R do not build libc_r.
26# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
27
28#
29# The intended user-driven targets are:
30# buildworld - rebuild *everything*, including glue to help do upgrades
31# installworld- install everything built by "buildworld"
32# world - buildworld + installworld
33# update - convenient way to update your source tree (eg: sup/cvs)
34# most - build user commands, no libraries or include files
35# installmost - install user commands, no libraries or include files
36#
37# Standard targets (not defined here) are documented in the makefiles in
38# /usr/share/mk. These include:
39# obj depend all install clean cleandepend cleanobj
40
41.if (!make(world)) && (!make(buildworld)) && (!make(installworld))
42.MAKEFLAGS:= -m ${.CURDIR}/share/mk ${.MAKEFLAGS}
43.endif
44
45#
46# Pick up any macros that are defined in the src-relative bsd.own.mk
47# but not in the "system" bsd.own.mk. The "system" version has
48# unfortunately already been included by the "system" sys.mk, so this
49# only works for new macros. First undefine old macros that cause
50# problems.
51#
52.undef LIBDIR
53.include "${.CURDIR}/share/mk/bsd.own.mk"
54
55# Put initial settings here.
56SUBDIR=
57
58# We must do share/info early so that installation of info `dir'
59# entries works correctly. Do it first since it is less likely to
60# grow dependencies on include and lib than vice versa.
61.if exists(share/info)
62SUBDIR+= share/info
63.endif
64
65# We must do include and lib early so that the perl *.ph generation
66# works correctly as it uses the header files installed by this.
67.if exists(include)
68SUBDIR+= include
69.endif
70.if exists(lib)
71SUBDIR+= lib
72.endif
73
74.if exists(bin)
75SUBDIR+= bin
76.endif
77.if exists(games) && !defined(NOGAMES)
78SUBDIR+= games
79.endif
80.if exists(gnu)
81SUBDIR+= gnu
82.endif
83.if exists(kerberosIV) && exists(crypto) && !defined(NOCRYPT) && \
84 defined(MAKE_KERBEROS4)
85SUBDIR+= kerberosIV
86.endif
87.if exists(libexec)
88SUBDIR+= libexec
89.endif
90.if exists(sbin)
91SUBDIR+= sbin
92.endif
93.if exists(share) && !defined(NOSHARE)
94SUBDIR+= share
95.endif
96.if exists(sys)
97SUBDIR+= sys
98.endif
99.if exists(usr.bin)
100SUBDIR+= usr.bin
101.endif
102.if exists(usr.sbin)
103SUBDIR+= usr.sbin
104.endif
105.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
106SUBDIR+= secure
107.endif
108.if exists(lkm) && !defined(NOLKM)
109SUBDIR+= lkm
110.endif
111
112# etc must be last for "distribute" to work
113.if exists(etc)
114SUBDIR+= etc
115.endif
116
117# These are last, since it is nice to at least get the base system
118# rebuilt before you do them.
119.if defined(LOCAL_DIRS)
120.for _DIR in ${LOCAL_DIRS}
121.if exists(${_DIR}) & exists(${_DIR}/Makefile)
122SUBDIR+= ${_DIR}
123.endif
124.endfor
125.endif
126
127# Handle -DNOOBJDIR, -DNOCLEAN and -DNOCLEANDIR
128.if defined(NOOBJDIR)
129OBJDIR=
130.else
131OBJDIR= obj
132.endif
133
134.if defined(NOCLEAN)
135CLEANDIR=
136.else
137.if defined(NOCLEANDIR)
138CLEANDIR= clean cleandepend
139.else
140CLEANDIR= cleandir
141.endif
142.endif
143
144.if !defined(NOCLEAN)
145_NODEPEND= true
146.endif
147.if defined(_NODEPEND)
148_DEPEND= cleandepend
149.else
150_DEPEND= depend
151.endif
152
153SUP?= cvsup
154SUPFLAGS?= -g -L 2 -P -
155
156#
157# While building tools for bootstrapping, we don't need to waste time on
158# shared or profiled libraries, shared linkage, or documentation, except
159# when the tools won't get cleaned we must use the defaults for shared
160# libraries and shared linkage (and this doesn't waste time).
161# XXX actually, we do need to waste time building shared libraries.
162#
163.if defined(NOCLEAN)
164MK_FLAGS= -DNOINFO -DNOMAN -DNOPROFILE
165.else
166MK_FLAGS= -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED
167.endif
168
169#
170# world
171#
172# Attempt to rebuild and reinstall *everything*, with reasonable chance of
173# success, regardless of how old your existing system is.
174#
175# >> Beware, it overwrites the local build environment! <<
176#
177world:
178 @echo "--------------------------------------------------------------"
179 @echo "make world started on `LC_TIME=C date`"
180 @echo "--------------------------------------------------------------"
181.if target(pre-world)
182 @echo
183 @echo "--------------------------------------------------------------"
184 @echo " Making 'pre-world' target"
185 @echo "--------------------------------------------------------------"
186 cd ${.CURDIR}; ${MAKE} pre-world
187.endif
188 cd ${.CURDIR}; ${MAKE} buildworld
189 cd ${.CURDIR}; ${MAKE} -B installworld
190.if target(post-world)
191 @echo
192 @echo "--------------------------------------------------------------"
193 @echo " Making 'post-world' target"
194 @echo "--------------------------------------------------------------"
195 cd ${.CURDIR}; ${MAKE} post-world
196.endif
197 @echo
198 @echo "--------------------------------------------------------------"
199 @echo "make world completed on `LC_TIME=C date`"
200 @echo "--------------------------------------------------------------"
201
202.if defined(MAKEOBJDIRPREFIX)
203WORLDTMP= ${MAKEOBJDIRPREFIX}${.CURDIR}/tmp
204.else
205WORLDTMP= /usr/obj${.CURDIR}/tmp
206.endif
207STRICTTMPPATH= ${WORLDTMP}/sbin:${WORLDTMP}/usr/sbin:${WORLDTMP}/bin:${WORLDTMP}/usr/bin
208TMPPATH= ${STRICTTMPPATH}:${PATH}
209
210# XXX COMPILER_PATH is needed for finding cc1, ld and as
211# XXX GCC_EXEC_PREFIX is for *crt.o. It is probably unnecessary now
212# that LIBRARY_PATH is set. We still can't use -nostdlib, since gcc
213# wouldn't link *crt.o or libgcc if it were used.
214# XXX LD_LIBRARY_PATH is for ld.so. It is also used by ld, although we don't
215# want that - all compile-time library paths should be resolved by gcc.
216# It fails for set[ug]id executables (are any used?).
217COMPILER_ENV= BISON_SIMPLE=${WORLDTMP}/usr/share/misc/bison.simple \
218 COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \
219 GCC_EXEC_PREFIX=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib/ \
220 LD_LIBRARY_PATH=${WORLDTMP}${SHLIBDIR} \
221 LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib
222
223BMAKEENV= PATH=${TMPPATH} ${COMPILER_ENV} NOEXTRADEPEND=t \
224 OBJFORMAT_PATH=${WORLDTMP}/usr/libexec:/usr/libexec
225XMAKEENV= PATH=${STRICTTMPPATH} ${COMPILER_ENV} \
226 OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \
227 CFLAGS="-nostdinc ${CFLAGS}" # XXX -nostdlib
228
229# used to compile and install 'make' in temporary build tree
230MAKETMP= ${WORLDTMP}/make
231IBMAKE= ${BMAKEENV} MAKEOBJDIR=${MAKETMP} ${MAKE} DESTDIR=${WORLDTMP}
232# bootstrap make
233BMAKE= ${BMAKEENV} ${WORLDTMP}/usr/bin/make DESTDIR=${WORLDTMP}
234# cross make used for compilation
235XMAKE= ${XMAKEENV} ${WORLDTMP}/usr/bin/make DESTDIR=${WORLDTMP}
236# cross make used for final installation
237IXMAKE= ${XMAKEENV} ${WORLDTMP}/usr/bin/make
238
239#
240# buildworld
241#
242# Attempt to rebuild the entire system, with reasonable chance of
243# success, regardless of how old your existing system is.
244#
245buildworld:
246.if !defined(NOCLEAN)
247 @echo
248 @echo "--------------------------------------------------------------"
249 @echo " Cleaning up the temporary build tree"
250 @echo "--------------------------------------------------------------"
251 mkdir -p ${WORLDTMP}
252 chflags -R noschg ${WORLDTMP}/
253 rm -rf ${WORLDTMP}
254.endif
255.if !defined(NOTOOLS)
256 @echo
257 @echo "--------------------------------------------------------------"
258 @echo " Making make"
259 @echo "--------------------------------------------------------------"
260 mkdir -p ${WORLDTMP}/usr/bin ${MAKETMP}
261 ( \
262 cd ${.CURDIR}/usr.bin/make; \
263 MAKEOBJDIRPREFIX=""; unset MAKEOBJDIRPREFIX; \
264 ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} all; \
265 ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} install; \
266 ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} clean \
267 )
268 @echo
269 @echo "--------------------------------------------------------------"
270 @echo " Making mtree"
271 @echo "--------------------------------------------------------------"
272 mkdir -p ${WORLDTMP}/usr/sbin ${WORLDTMP}/mtree
273 ( \
274 cd ${.CURDIR}/usr.sbin/mtree; \
275 MAKEOBJDIRPREFIX=""; unset MAKEOBJDIRPREFIX; \
276 export MAKEOBJDIR=${WORLDTMP}/mtree; \
277 ${BMAKE} ${MK_FLAGS} all; \
278 ${BMAKE} ${MK_FLAGS} -B install clean \
279 )
280.endif
281 @echo
282 @echo "--------------------------------------------------------------"
283 @echo " Making hierarchy"
284 @echo "--------------------------------------------------------------"
285 cd ${.CURDIR}; ${BMAKE} hierarchy
286.if !defined(NOCLEAN)
287 @echo
288 @echo "--------------------------------------------------------------"
289 @echo " Cleaning up the obj tree"
290 @echo "--------------------------------------------------------------"
291 cd ${.CURDIR}; ${BMAKE} ${CLEANDIR:S/^/par-/}
292.endif
293.if !defined(NOOBJDIR)
294 @echo
295 @echo "--------------------------------------------------------------"
296 @echo " Rebuilding the obj tree"
297 @echo "--------------------------------------------------------------"
298 cd ${.CURDIR}; ${BMAKE} par-${OBJDIR}
299.endif
300.if !defined(NOTOOLS)
301 @echo
302 @echo "--------------------------------------------------------------"
303 @echo " Rebuilding bootstrap tools"
304 @echo "--------------------------------------------------------------"
305 cd ${.CURDIR}; ${BMAKE} bootstrap
306 @echo
307 @echo "--------------------------------------------------------------"
308 @echo " Rebuilding tools necessary to build the include files"
309 @echo "--------------------------------------------------------------"
310 cd ${.CURDIR}; ${BMAKE} include-tools
311.endif
312 @echo
313 @echo "--------------------------------------------------------------"
314 @echo " Rebuilding ${DESTDIR}/usr/include"
315 @echo "--------------------------------------------------------------"
316 cd ${.CURDIR}; SHARED=copies ${BMAKE} includes
317 @echo
318 @echo "--------------------------------------------------------------"
319 @echo " Rebuilding bootstrap libraries"
320 @echo "--------------------------------------------------------------"
321 cd ${.CURDIR}; ${BMAKE} bootstrap-libraries
322.if !defined(NOTOOLS)
323 @echo
324 @echo "--------------------------------------------------------------"
325 @echo " Rebuilding tools needed to build libraries"
326 @echo "--------------------------------------------------------------"
327 cd ${.CURDIR}; ${BMAKE} lib-tools
328.endif
329.if !defined(NOTOOLS)
330 @echo
331 @echo "--------------------------------------------------------------"
332 @echo " Rebuilding all other tools needed to build the world"
333 @echo "--------------------------------------------------------------"
334 cd ${.CURDIR}; ${BMAKE} build-tools
335.endif
336.if !defined(_NODEPEND)
337 @echo
338 @echo "--------------------------------------------------------------"
339 @echo " Rebuilding dependencies"
340 @echo "--------------------------------------------------------------"
341 cd ${.CURDIR}; ${XMAKE} par-depend
342.endif
343 @echo
344 @echo "--------------------------------------------------------------"
345 @echo " Building libraries"
346 @echo "--------------------------------------------------------------"
347 cd ${.CURDIR}; ${XMAKE} -DNOINFO -DNOMAN libraries
348 @echo
349 @echo "--------------------------------------------------------------"
350 @echo " Building everything.."
351 @echo "--------------------------------------------------------------"
352 cd ${.CURDIR}; ${XMAKE} all
353
354#
355# installworld
356#
357# Installs everything compiled by a 'buildworld'.
358#
359installworld:
360 cd ${.CURDIR}; ${IXMAKE} reinstall
361
362#
363# reinstall
364#
365# If you have a build server, you can NFS mount the source and obj directories
366# and do a 'make reinstall' on the *client* to install new binaries from the
367# most recent server build.
368#
369reinstall:
370 @echo "--------------------------------------------------------------"
371 @echo " Making hierarchy"
372 @echo "--------------------------------------------------------------"
373 cd ${.CURDIR}; ${MAKE} hierarchy
374 @echo
375 @echo "--------------------------------------------------------------"
376 @echo " Installing everything.."
377 @echo "--------------------------------------------------------------"
378 cd ${.CURDIR}; ${MAKE} install
379.if ${MACHINE_ARCH} == "i386"
380 @echo
381 @echo "--------------------------------------------------------------"
382 @echo " Re-scanning the shared libraries.."
383 @echo "--------------------------------------------------------------"
384 cd ${.CURDIR}; /sbin/ldconfig -R
385.endif
386 @echo
387 @echo "--------------------------------------------------------------"
388 @echo " Rebuilding man page indexes"
389 @echo "--------------------------------------------------------------"
390 cd ${.CURDIR}/share/man; ${MAKE} makedb
391
392#
393# update
394#
395# Update the source tree, by running sup and/or running cvs to update to the
396# latest copy.
397#
398update:
399.if defined(SUP_UPDATE)
400 @echo "--------------------------------------------------------------"
401 @echo "Running ${SUP}"
402 @echo "--------------------------------------------------------------"
403 @${SUP} ${SUPFLAGS} ${SUPFILE}
404.if defined(SUPFILE1)
405 @${SUP} ${SUPFLAGS} ${SUPFILE1}
406.endif
407.if defined(SUPFILE2)
408 @${SUP} ${SUPFLAGS} ${SUPFILE2}
409.endif
410.endif
411.if defined(CVS_UPDATE)
412 @echo "--------------------------------------------------------------"
413 @echo "Updating /usr/src from cvs repository" ${CVSROOT}
414 @echo "--------------------------------------------------------------"
415 cd ${.CURDIR}; cvs -q update -P -d
416.endif
417
418#
419# most
420#
421# Build most of the user binaries on the existing system libs and includes.
422#
423most:
424 @echo "--------------------------------------------------------------"
425 @echo " Building programs only"
426 @echo "--------------------------------------------------------------"
427 cd ${.CURDIR}/bin; ${MAKE} all
428 cd ${.CURDIR}/sbin; ${MAKE} all
429 cd ${.CURDIR}/libexec; ${MAKE} all
430 cd ${.CURDIR}/usr.bin; ${MAKE} all
431 cd ${.CURDIR}/usr.sbin; ${MAKE} all
432 cd ${.CURDIR}/gnu/libexec; ${MAKE} all
433 cd ${.CURDIR}/gnu/usr.bin; ${MAKE} all
434 cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} all
435#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
436# cd ${.CURDIR}/kerberosIV; ${MAKE} most
437#.endif
438#.if !defined(NOSECURE) && !defined(NOCRYPT)
439# cd ${.CURDIR}/secure; ${MAKE} most
440#.endif
441
442#
443# installmost
444#
445# Install the binaries built by the 'most' target. This does not include
446# libraries or include files.
447#
448installmost:
449 @echo "--------------------------------------------------------------"
450 @echo " Installing programs only"
451 @echo "--------------------------------------------------------------"
452 cd ${.CURDIR}/bin; ${MAKE} install
453 cd ${.CURDIR}/sbin; ${MAKE} install
454 cd ${.CURDIR}/libexec; ${MAKE} install
455 cd ${.CURDIR}/usr.bin; ${MAKE} install
456 cd ${.CURDIR}/usr.sbin; ${MAKE} install
457 cd ${.CURDIR}/gnu/libexec; ${MAKE} install
458 cd ${.CURDIR}/gnu/usr.bin; ${MAKE} install
459 cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} install
460#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
461# cd ${.CURDIR}/kerberosIV; ${MAKE} installmost
462#.endif
463#.if !defined(NOSECURE) && !defined(NOCRYPT)
464# cd ${.CURDIR}/secure; ${MAKE} installmost
465#.endif
466
467#
468# ------------------------------------------------------------------------
469#
470# From here onwards are utility targets used by the 'make world' and
471# related targets. If your 'world' breaks, you may like to try to fix
472# the problem and manually run the following targets to attempt to
473# complete the build. Beware, this is *not* guaranteed to work, you
474# need to have a pretty good grip on the current state of the system
475# to attempt to manually finish it. If in doubt, 'make world' again.
476#
477
478#
479# heirarchy - ensure that all the needed directories are present
480#
481hierarchy:
482 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
483
484#
485# bootstrap - [re]build tools needed to run the actual build, this includes
486# tools needed by 'make depend', as some tools are needed to generate source
487# for the dependency information to be gathered from.
488#
489bootstrap:
490.if defined(DESTDIR)
491 rm -f ${DESTDIR}/usr/src/sys
492 ln -s ${.CURDIR}/sys ${DESTDIR}/usr/src
493 cd ${.CURDIR}/include; find -dx . | cpio -dump ${DESTDIR}/usr/include
494.for d in net netinet posix4 sys vm machine
495 if [ -h ${DESTDIR}/usr/include/$d ]; then \
496 rm -f ${DESTDIR}/usr/include/$d ; \
497 fi
498.endfor
499 cd ${.CURDIR}/sys; \
500 find -dx net netinet posix4 sys vm -name '*.h' -o -type d | \
501 cpio -dump ${DESTDIR}/usr/include
502 mkdir -p ${DESTDIR}/usr/include/machine
503 cd ${.CURDIR}/sys/${MACHINE_ARCH}/include; find -dx . -name '*.h' -o -type d | \
504 cpio -dump ${DESTDIR}/usr/include/machine
505.endif
506 cd ${.CURDIR}/usr.bin/make; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
507 ${MAKE} ${MK_FLAGS} all; \
508 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
509 cd ${.CURDIR}/usr.bin/xinstall; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
510 ${MAKE} ${MK_FLAGS} all; \
511 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
512 cd ${.CURDIR}/usr.bin/yacc; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
513 ${MAKE} ${MK_FLAGS} all; \
514 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
515 cd ${.CURDIR}/usr.bin/lex; ${MAKE} bootstrap; \
516 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
517 ${MAKE} ${MK_FLAGS} -DNOLIB all; \
518 ${MAKE} ${MK_FLAGS} -DNOLIB -B install ${CLEANDIR}
519.if !defined(NOOBJDIR)
520 cd ${.CURDIR}/usr.bin/lex; ${MAKE} ${OBJDIR}
521.endif
522 cd ${.CURDIR}/usr.sbin/mtree; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
523 ${MAKE} ${MK_FLAGS} all; \
524 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
525.if defined(DESTDIR)
526 cd ${.CURDIR}/include && ${MAKE} copies
527.endif
528
529#
530# include-tools - generally the same as 'bootstrap', except that it's for
531# things that are specifically needed to generate include files.
532#
533# XXX should be merged with bootstrap, it's not worth keeeping them separate.
534# Well, maybe it is now. We force 'cleandepend' here to avoid dependencies
535# on cleaned away headers in ${WORLDTMP}.
536#
537include-tools:
538.for d in usr.bin/compile_et usr.bin/rpcgen
539 cd ${.CURDIR}/$d; ${MAKE} cleandepend; \
540 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
541 ${MAKE} ${MK_FLAGS} all; \
542 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
543.endfor
544
545#
546# includes - possibly generate and install the include files.
547#
548includes:
549.if defined(CLOBBER)
550 rm -rf ${DESTDIR}/usr/include/*
551 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
552 -p ${DESTDIR}/usr/include
553.endif
554 cd ${.CURDIR}/include; ${MAKE} -B all install
555 cd ${.CURDIR}/gnu/include; ${MAKE} install
556 cd ${.CURDIR}/gnu/lib/libmp; ${MAKE} beforeinstall
557 cd ${.CURDIR}/gnu/lib/libobjc; ${MAKE} beforeinstall
558 cd ${.CURDIR}/gnu/lib/libreadline; ${MAKE} beforeinstall
559 cd ${.CURDIR}/gnu/lib/libregex; ${MAKE} beforeinstall
560 cd ${.CURDIR}/gnu/lib/libstdc++; ${MAKE} beforeinstall
561 cd ${.CURDIR}/gnu/lib/libg++; ${MAKE} beforeinstall
562 cd ${.CURDIR}/gnu/lib/libdialog; ${MAKE} beforeinstall
563 cd ${.CURDIR}/gnu/lib/libgmp; ${MAKE} beforeinstall
564.if exists(secure) && !defined(NOCRYPT)
565 cd ${.CURDIR}/secure/lib/libdes; ${MAKE} beforeinstall
566.endif
567.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
568 cd ${.CURDIR}/kerberosIV/lib/libacl; ${MAKE} beforeinstall
569 cd ${.CURDIR}/kerberosIV/lib/libkadm; ${MAKE} beforeinstall
570 cd ${.CURDIR}/kerberosIV/lib/libkafs; ${MAKE} beforeinstall
571 cd ${.CURDIR}/kerberosIV/lib/libkdb; ${MAKE} beforeinstall
572 cd ${.CURDIR}/kerberosIV/lib/libkrb; ${MAKE} beforeinstall
573 cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall
574.else
575 cd ${.CURDIR}/lib/libtelnet; ${MAKE} beforeinstall
576.endif
577.if exists(${.CURDIR}/lib/csu/${MACHINE})
578 cd ${.CURDIR}/lib/csu/${MACHINE}; ${MAKE} beforeinstall
579.endif
580 cd ${.CURDIR}/lib/libalias; ${MAKE} beforeinstall
581 cd ${.CURDIR}/lib/libc; ${MAKE} beforeinstall
582 cd ${.CURDIR}/lib/libcalendar; ${MAKE} beforeinstall
583 cd ${.CURDIR}/lib/libcurses; ${MAKE} beforeinstall
584 cd ${.CURDIR}/lib/libdisk; ${MAKE} beforeinstall
585 cd ${.CURDIR}/lib/libedit; ${MAKE} beforeinstall
586 cd ${.CURDIR}/lib/libftpio; ${MAKE} beforeinstall
587 cd ${.CURDIR}/lib/libmd; ${MAKE} beforeinstall
588 cd ${.CURDIR}/lib/libmytinfo; ${MAKE} beforeinstall
589 cd ${.CURDIR}/lib/libncurses; ${MAKE} beforeinstall
590.if !defined(WANT_CSRG_LIBM)
591 cd ${.CURDIR}/lib/msun; ${MAKE} beforeinstall
592.endif
593 cd ${.CURDIR}/lib/libopie; ${MAKE} beforeinstall
594 cd ${.CURDIR}/lib/libpcap; ${MAKE} beforeinstall
595 cd ${.CURDIR}/lib/librpcsvc; ${MAKE} beforeinstall
596 cd ${.CURDIR}/lib/libskey; ${MAKE} beforeinstall
597.if !defined(NOTCL) && exists (${.CURDIR}/contrib/tcl) && \
598 exists(${.CURDIR}/usr.bin/tclsh) && exists (${.CURDIR}/lib/libtcl)
599 cd ${.CURDIR}/lib/libtcl; ${MAKE} installhdrs
600.endif
601 cd ${.CURDIR}/lib/libtermcap; ${MAKE} beforeinstall
602 cd ${.CURDIR}/lib/libcom_err; ${MAKE} beforeinstall
603 cd ${.CURDIR}/lib/libss; ${MAKE} -B hdrs beforeinstall
604 cd ${.CURDIR}/lib/libscsi; ${MAKE} beforeinstall
605 cd ${.CURDIR}/lib/libutil; ${MAKE} beforeinstall
606 cd ${.CURDIR}/lib/libvgl; ${MAKE} beforeinstall
607 cd ${.CURDIR}/lib/libz; ${MAKE} beforeinstall
608 cd ${.CURDIR}/usr.bin/f2c; ${MAKE} beforeinstall
609 cd ${.CURDIR}/usr.bin/lex; ${MAKE} beforeinstall
610
611#
612# Declare tools if they are not required on all architectures.
613#
614.if ${MACHINE_ARCH} == "i386"
615# aout tools:
616_aout_ar = usr.bin/ar
617_aout_as = gnu/usr.bin/as
618_aout_ld = gnu/usr.bin/ld
619_aout_nm = usr.bin/nm
620_aout_ranlib = usr.bin/ranlib
621_aout_size = usr.bin/size
622_aout_strip = usr.bin/strip
623.endif
624
625#
626# lib-tools - build tools to compile and install the libraries.
627#
628# XXX gperf is required for cc
629# XXX a new ld and tsort is required for cc
630lib-tools:
631.for d in \
632 gnu/usr.bin/gperf \
633 ${_aout_ld} \
634 usr.bin/tsort \
635 ${_aout_as} \
636 gnu/usr.bin/bison \
637 gnu/usr.bin/cc \
638 ${_aout_ar} \
639 usr.bin/env \
640 usr.bin/lex/lib \
641 usr.bin/mk_cmds \
642 ${_aout_nm} \
643 ${_aout_ranlib} \
644 ${_aout_strip} \
645 gnu/usr.bin/binutils \
646 usr.bin/uudecode \
647 usr.bin/objformat
648 cd ${.CURDIR}/$d; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
649 ${MAKE} ${MK_FLAGS} all; \
650 ${MAKE} ${MK_FLAGS} -B install; \
651 ${MAKE} ${MK_FLAGS:S/-DNOPIC//} -B ${CLEANDIR} ${OBJDIR}
652.endfor
653
654#
655# We have to know too much about ordering and subdirs in the lib trees:
656#
657# To satisfy shared library linkage when only the libraries being built
658# are visible:
659#
660# libcom_err must be built before libss.
661# libcrypt and libmd must be built before libskey.
662# libm must be built before libtcl.
663# libmytinfo must be built before libdialog and libncurses.
664# libncurses must be built before libdialog.
665# libtermcap must be built before libcurses, libedit and libreadline.
666#
667# Some libraries are built conditionally and/or are in inconsistently
668# named directories:
669#
670.if exists(lib/csu/${MACHINE}.pcc)
671_csu=lib/csu/${MACHINE}.pcc
672.else
673_csu=lib/csu/${MACHINE}
674.endif
675
676.if !defined(NOSECURE) && !defined(NOCRYPT)
677_libcrypt= secure/lib/libcrypt lib/libcrypt
678.else
679_libcrypt= lib/libcrypt
680.endif
681
682.if defined(WANT_CSRG_LIBM)
683_libm= lib/libm
684.else
685_libm= lib/msun
686.endif
687
688#
689# bootstrap-libraries - build just enough libraries for the bootstrap
690# tools, and install them under ${WORLDTMP}.
691#
692# Build csu and libgcc early so that some tools get linked to the new
693# versions (too late for the main tools, however). Then build the
694# necessary prerequisite libraries (libtermcap just needs to be before
695# libcurses, and this only matters for the NOCLEAN case when NOPIC is
696# not set).
697#
698# This is mostly wrong. The build tools must run on the host system,
699# so they should use host libraries. We depend on the target being
700# similar enough to the host for new target libraries to work on the
701# host.
702#
703bootstrap-libraries:
704.for _lib in ${_csu} gnu/usr.bin/cc/libgcc lib/libtermcap \
705 gnu/lib/libregex gnu/lib/libreadline lib/libc \
706 ${_libcrypt} lib/libcurses lib/libedit ${_libm} \
707 lib/libmd lib/libutil lib/libz usr.bin/lex/lib
708.if exists(${.CURDIR}/${_lib})
709 cd ${.CURDIR}/${_lib}; \
710 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
711 ${MAKE} ${MK_FLAGS} all; \
712 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
713.endif
714.endfor
715
716#
717# libraries - build all libraries, and install them under ${DESTDIR}.
718#
719# The ordering is not as special as for bootstrap-libraries. Build
720# the prerequisites first, then build almost everything else in
721# alphabetical order.
722#
723libraries:
724.for _lib in lib/libcom_err ${_libcrypt} ${_libm} lib/libmytinfo \
725 lib/libncurses lib/libtermcap \
726 gnu/lib gnu/usr.bin/cc/libgcc lib usr.bin/lex/lib usr.sbin/pcvt/keycap
727.if exists(${.CURDIR}/${_lib})
728 cd ${.CURDIR}/${_lib}; ${MAKE} all; ${MAKE} -B install
729.endif
730.endfor
731.if exists(${.CURDIR}/secure/lib) && !defined(NOCRYPT) && !defined(NOSECURE)
732 cd ${.CURDIR}/secure/lib; ${MAKE} all; ${MAKE} -B install
733.endif
734.if exists(${.CURDIR}/kerberosIV/lib) && !defined(NOCRYPT) && \
735 defined(MAKE_KERBEROS4)
736 cd ${.CURDIR}/kerberosIV/lib; ${MAKE} all; ${MAKE} -B install
737.endif
738
739#
740# Exclude unused tools from build-tools.
741#
742.if !defined(NOGAMES) && exists(${.CURDIR}/games)
743_adventure= games/adventure
744_caesar= games/caesar
745_hack= games/hack
746_phantasia= games/phantasia
747_strfile= games/fortune/strfile
748.endif
749.if !defined(NOPERL)
750_perl= gnu/usr.bin/perl/perl
751.endif
752.if !defined(NOSHARE) && exists(${.CURDIR}/share)
753_scrnmaps= share/syscons/scrnmaps
754.endif
755.if !defined(NOLKM) && exists(${.CURDIR}/lkm)
756_linux= lkm/linux
757.endif
758
759BTMAKEFLAGS= ${MK_FLAGS} -D_BUILD_TOOLS
760
761#
762# build-tools - build and install any other tools needed to complete the
763# compile and install.
764# ifdef stale
765# bc and cpp are required to build groff. Otherwise, the order here is
766# mostly historical, i.e., bogus.
767# chmod is used to build gcc's tmpmultilib[2] at obscure times.
768# endif stale
769# XXX uname is a bug - the target should not depend on the host.
770#
771build-tools:
772.for d in \
773 bin/cat \
774 bin/chmod \
775 bin/cp \
776 bin/date \
777 bin/dd \
778 bin/echo \
779 bin/expr \
780 bin/hostname \
781 bin/ln \
782 bin/ls \
783 bin/mkdir \
784 bin/mv \
785 bin/rm \
786 bin/test \
787 ${_caesar} \
788 ${_strfile} \
789 gnu/usr.bin/awk \
790 gnu/usr.bin/bc \
791 gnu/usr.bin/grep \
792 gnu/usr.bin/groff \
793 gnu/usr.bin/gzip \
794 gnu/usr.bin/man/makewhatis \
795 gnu/usr.bin/patch \
796 ${_perl} \
797 gnu/usr.bin/sort \
798 gnu/usr.bin/texinfo \
799 usr.bin/basename \
800 usr.bin/cap_mkdb \
801 usr.bin/chflags \
802 usr.bin/cmp \
803 usr.bin/col \
804 usr.bin/colldef \
805 usr.bin/cpp \
806 usr.bin/expand \
807 usr.bin/file2c \
808 usr.bin/find \
809 usr.bin/gencat \
810 usr.bin/id \
811 usr.bin/join \
812 usr.bin/lorder \
813 usr.bin/m4 \
814 usr.bin/mkdep \
815 usr.bin/mklocale \
816 usr.bin/paste \
817 usr.bin/sed \
818 ${_aout_size} \
819 usr.bin/soelim \
820 usr.bin/symorder \
821 usr.bin/touch \
822 usr.bin/tr \
823 usr.bin/true \
824 usr.bin/uname \
825 usr.bin/uuencode \
826 usr.bin/vgrind \
827 usr.bin/vi \
828 usr.bin/wc \
829 usr.bin/xargs \
830 usr.bin/yacc \
831 usr.sbin/chown \
832 usr.sbin/mtree \
833 usr.sbin/zic \
834 bin/sh
835 cd ${.CURDIR}/$d; ${MAKE} ${BTMAKEFLAGS} ${_DEPEND}; \
836 ${MAKE} ${BTMAKEFLAGS} all; \
837 ${MAKE} ${BTMAKEFLAGS} -B install ${CLEANDIR} ${OBJDIR}
838.endfor
839.if !defined(NOGAMES) && exists(${.CURDIR}/games)
840 cd ${DESTDIR}/usr/games; cp -p caesar strfile ${DESTDIR}/usr/bin
841.endif
842.for d in \
843 bin/sh \
844 ${_adventure} \
845 ${_hack} \
846 ${_phantasia} \
847 gnu/usr.bin/cc/cc_tools \
848 lib/libmytinfo \
849 ${_linux} \
850 ${_scrnmaps} \
851 sys/i386/boot/netboot
852 cd ${.CURDIR}/$d; ${MAKE} ${BTMAKEFLAGS} build-tools
853.endfor
854 cd ${.CURDIR}/usr.bin/tn3270/tools; ${MAKE} ${BTMAKEFLAGS} all
855
856.for __target in clean cleandepend cleandir depend obj
857.for entry in ${SUBDIR}
858${entry}.${__target}__D: .PHONY
859 @if test -d ${.CURDIR}/${entry}.${MACHINE}; then \
860 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE}"; \
861 edir=${entry}.${MACHINE}; \
862 cd ${.CURDIR}/$${edir}; \
863 else \
864 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
865 edir=${entry}; \
866 cd ${.CURDIR}/$${edir}; \
867 fi; \
868 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
869.endfor
870par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
871.endfor
872
873.endif
874
875.include <bsd.subdir.mk>