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