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