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