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