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