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