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