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