Makefile.inc1 revision 55060
125451Speter#
225451Speter# $FreeBSD: head/Makefile.inc1 55060 1999-12-23 19:18:28Z marcel $
325451Speter#
425451Speter# Make command line options:
525451Speter#	-DMAKE_KERBEROS4 to build KerberosIV
625451Speter#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
725451Speter#	-DNOCLEAN do not clean at all
825451Speter#	-DNOCRYPT will prevent building of crypt versions
925451Speter#	-DNOPROFILE do not build profiled libraries
1025451Speter#	-DNOSECURE do not go into secure subdir
1125451Speter#	-DNOGAMES do not go into games subdir
1225451Speter#	-DNOSHARE do not go into share subdir
1325451Speter#	-DNOINFO do not make or install info files
1425451Speter#	-DNOLIBC_R do not build libc_r.
1525451Speter#	-DNO_FORTRAN do not build g77 and related libraries.
1625451Speter#	LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
1725451Speter
1825451Speter#
1925451Speter# The intended user-driven targets are:
2025451Speter# buildworld  - rebuild *everything*, including glue to help do upgrades
2125451Speter# installworld- install everything built by "buildworld"
2225451Speter# update      - convenient way to update your source tree (eg: sup/cvs)
2325451Speter# most        - build user commands, no libraries or include files
2425451Speter# installmost - install user commands, no libraries or include files
2525451Speter#
2625451Speter# Standard targets (not defined here) are documented in the makefiles in
2725451Speter# /usr/share/mk.  These include:
2825451Speter#		obj depend all install clean cleandepend cleanobj
2925451Speter
3025451Speter# Put initial settings here.
3125451SpeterSUBDIR=
3225451Speter
3325451Speter# We must do share/info early so that installation of info `dir'
3450476Speter# entries works correctly.  Do it first since it is less likely to
3525451Speter# grow dependencies on include and lib than vice versa.
3625451Speter.if exists(${.CURDIR}/share/info)
37138593SsamSUBDIR+= share/info
3825451Speter.endif
3925660Speter
40138593Ssam# We must do include and lib early so that the perl *.ph generation
4125451Speter# works correctly as it uses the header files installed by this.
42138593Ssam.if exists(${.CURDIR}/include)
43138593SsamSUBDIR+= include
4444764Swpaul.endif
45138593Ssam.if exists(${.CURDIR}/lib)
46138593SsamSUBDIR+= lib
47138593Ssam.endif
48138593Ssam
49138593Ssam.if exists(${.CURDIR}/bin)
50138593SsamSUBDIR+= bin
51138593Ssam.endif
52138593Ssam.if exists(${.CURDIR}/games) && !defined(NOGAMES)
53138593SsamSUBDIR+= games
54144818Sstefanf.endif
55177799Ssam.if exists(${.CURDIR}/gnu)
56138593SsamSUBDIR+= gnu
57138593Ssam.endif
58138593Ssam.if exists(${.CURDIR}/kerberosIV) && exists(${.CURDIR}/crypto) && \
5977217Sphk    !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
60138671SsamSUBDIR+= kerberosIV
61138671Ssam.endif
62138671Ssam.if exists(${.CURDIR}/libexec)
63138593SsamSUBDIR+= libexec
64138593Ssam.endif
65138593Ssam.if exists(${.CURDIR}/sbin)
66138593SsamSUBDIR+= sbin
67138593Ssam.endif
68138593Ssam.if exists(${.CURDIR}/share) && !defined(NOSHARE)
69138593SsamSUBDIR+= share
70138593Ssam.endif
71194799Sdelphij.if exists(${.CURDIR}/sys)
72194799SdelphijSUBDIR+= sys
73194799Sdelphij.endif
74194799Sdelphij.if exists(${.CURDIR}/usr.bin)
75194799SdelphijSUBDIR+= usr.bin
76194799Sdelphij.endif
77138593Ssam.if exists(${.CURDIR}/usr.sbin)
78166956SsamSUBDIR+= usr.sbin
79138593Ssam.endif
80138593Ssam.if exists(${.CURDIR}/secure) && !defined(NOCRYPT) && !defined(NOSECURE)
81138593SsamSUBDIR+= secure
82138593Ssam.endif
83138593Ssam
84138593Ssam# etc must be last for "distribute" to work
85138593Ssam.if exists(${.CURDIR}/etc)
86138593SsamSUBDIR+= etc
87138593Ssam.endif
88138593Ssam
89138593Ssam# These are last, since it is nice to at least get the base system
90138593Ssam# rebuilt before you do them.
91139494Ssam.if defined(LOCAL_DIRS)
92139494Ssam.for _DIR in ${LOCAL_DIRS}
93139494Ssam.if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile)
94139494SsamSUBDIR+= ${_DIR}
95139494Ssam.endif
96139494Ssam.endfor
97139494Ssam.endif
98139494Ssam
99139494Ssam.if defined(NOCLEANDIR)
100166956SsamCLEANDIR=	clean cleandepend
101139494Ssam.else
102138593SsamCLEANDIR=	cleandir
103138593Ssam.endif
104138593Ssam
105138593SsamSUP?=		cvsup
106138593SsamSUPFLAGS?=	-g -L 2 -P -
107138593Ssam
108138593SsamMAKEOBJDIRPREFIX?=	/usr/obj
109138593SsamTARGET_ARCH?=	${MACHINE_ARCH}
110138593SsamBUILD_ARCH!=	sysctl -n hw.machine_arch
111138593Ssam.if ${BUILD_ARCH} == ${MACHINE_ARCH}
112138593SsamOBJTREE=	${MAKEOBJDIRPREFIX}
113138593Ssam.else
114138593SsamOBJTREE=	${MAKEOBJDIRPREFIX}/${MACHINE_ARCH}
115138593Ssam.endif
116138593SsamWORLDTMP=	${OBJTREE}${.CURDIR}/${BUILD_ARCH}
117138593Ssam# /usr/games added for fortune which depend on strfile
118138593SsamSTRICTTMPPATH=	${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
119138593SsamTMPPATH=	${STRICTTMPPATH}:${PATH}
120138593Ssam
121138593Ssam#
122138593Ssam# Building a world goes through the following stages
123138593Ssam#
124138593Ssam# bootstrap-tool stage [BMAKE]
125138593Ssam#	This stage is responsible for creating programs that
126138593Ssam#	are needed for backward compatibility reasons. They
127138593Ssam#	are not built as cross-tools.
128138593Ssam# build-tool stage [TMAKE]
129138593Ssam#	This stage is responsible for creating the object
130138593Ssam#	tree and building any tools that are needed during
131138593Ssam#	the build process.
132148001Srwatson# cross-tool stage [XMAKE]
133138593Ssam#	This stage is responsible for creating any tools that
134138593Ssam#	are needed for cross-builds. A cross-compiler is one
135138593Ssam#	of them.
136138593Ssam# world stage [WMAKE]
137138593Ssam#	This stage actually builds the world.
138138593Ssam# install stage (optional) [IMAKE]
139138593Ssam#	This stage installs a previously built world.
140138593Ssam#
141166956Ssam
142138593Ssam# Common environment for bootstrap related stages
143160196SsamBOOTSTRAPENV=	MAKEOBJDIRPREFIX=${WORLDTMP} \
144189096Srpaulo		DESTDIR=${WORLDTMP} \
145170531Ssam		INSTALL="sh ${.CURDIR}/tools/install.sh" \
146170531Ssam		MACHINE_ARCH=${BUILD_ARCH} \
147170531Ssam		PATH=${TMPPATH}
148170531Ssam
149170531Ssam# Common environment for world related stages
150170531SsamCROSSENV=	MAKEOBJDIRPREFIX=${OBJTREE} \
151		COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \
152		LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib \
153		OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \
154		PERL5LIB=${WORLDTMP}/usr/libdata/perl/5.00503
155
156# bootstrap-tool stage
157BMAKEENV=	${BOOTSTRAPENV}
158BMAKE=		${BMAKEENV} ${MAKE} -f Makefile.inc1 -DNOMAN -DNOINFO
159
160# build-tool stage
161TMAKEENV=	MAKEOBJDIRPREFIX=${OBJTREE} \
162		INSTALL="sh ${.CURDIR}/tools/install.sh" \
163		PATH=${TMPPATH}
164TMAKE=		${TMAKEENV} ${MAKE} -f Makefile.inc1
165
166# cross-tool stage
167XMAKEENV=	${BOOTSTRAPENV} \
168		TARGET_ARCH=${MACHINE_ARCH}
169XMAKE=		${XMAKEENV} ${MAKE} -f Makefile.inc1 -DNOMAN -DNOINFO \
170		-DNO_FORTRAN -DNO_GDB
171
172# world stage
173WMAKEENV=	${CROSSENV} \
174		DESTDIR=${WORLDTMP} \
175		INSTALL="sh ${.CURDIR}/tools/install.sh" \
176		PATH=${TMPPATH}
177WMAKE=		${WMAKEENV} ${MAKE} -f Makefile.inc1
178
179# install stage
180IMAKEENV=	${CROSSENV}
181IMAKE=		${IMAKEENV} ${MAKE} -f Makefile.inc1
182
183USRDIRS=	usr/bin usr/lib/compat/aout usr/games usr/libdata/ldscripts \
184		usr/libexec/${OBJFORMAT} usr/sbin usr/share/misc
185
186.if ${MACHINE_ARCH} == "i386" && ${MACHINE} == "pc98"
187USRDIRS+=	usr/libexec/aout
188.endif
189
190INCDIRS=	arpa g++/std objc protocols readline rpc rpcsvc security ss
191
192#
193# buildworld
194#
195# Attempt to rebuild the entire system, with reasonable chance of
196# success, regardless of how old your existing system is.
197#
198buildworld:
199	@echo
200	@echo "--------------------------------------------------------------"
201	@echo ">>> Rebuilding the temporary build tree"
202	@echo "--------------------------------------------------------------"
203.if !defined(NOCLEAN)
204	rm -rf ${WORLDTMP}
205.else
206	for dir in bin games include lib sbin; do \
207		rm -rf ${WORLDTMP}/usr/$$dir; \
208	done
209	rm -f ${WORLDTMP}/sys
210.endif
211.for _dir in ${USRDIRS}
212	mkdir -p ${WORLDTMP}/${_dir}
213.endfor
214.for _dir in ${INCDIRS}
215	mkdir -p ${WORLDTMP}/usr/include/${_dir}
216.endfor
217	ln -sf ${.CURDIR}/sys ${WORLDTMP}/sys
218	@echo
219	@echo "--------------------------------------------------------------"
220	@echo ">>> stage 1: bootstrap tools"
221	@echo "--------------------------------------------------------------"
222	cd ${.CURDIR}; ${BMAKE} bootstrap-tools
223.if !defined(NOCLEAN)
224	@echo
225	@echo "--------------------------------------------------------------"
226	@echo ">>> stage 2: cleaning up the object tree"
227	@echo "--------------------------------------------------------------"
228	cd ${.CURDIR}; ${TMAKE} ${CLEANDIR:S/^/par-/}
229.endif
230	@echo
231	@echo "--------------------------------------------------------------"
232	@echo ">>> stage 2: rebuilding the object tree"
233	@echo "--------------------------------------------------------------"
234	cd ${.CURDIR}; ${TMAKE} par-obj
235	@echo
236	@echo "--------------------------------------------------------------"
237	@echo ">>> stage 2: build tools"
238	@echo "--------------------------------------------------------------"
239	cd ${.CURDIR}; ${TMAKE} build-tools
240	@echo
241	@echo "--------------------------------------------------------------"
242	@echo ">>> stage 3: cross tools"
243	@echo "--------------------------------------------------------------"
244	cd ${.CURDIR}; ${XMAKE} cross-tools
245	@echo
246	@echo "--------------------------------------------------------------"
247	@echo ">>> stage 4: populating ${WORLDTMP}/usr/include"
248	@echo "--------------------------------------------------------------"
249	cd ${.CURDIR}; ${WMAKE} SHARED=symlinks includes
250	@echo
251	@echo "--------------------------------------------------------------"
252	@echo ">>> stage 4: building libraries"
253	@echo "--------------------------------------------------------------"
254	cd ${.CURDIR}; ${WMAKE} -DNOINFO -DNOMAN libraries
255	@echo
256	@echo "--------------------------------------------------------------"
257	@echo ">>> stage 4: make dependencies"
258	@echo "--------------------------------------------------------------"
259	cd ${.CURDIR}; ${WMAKE} par-depend
260	@echo
261	@echo "--------------------------------------------------------------"
262	@echo ">>> stage 4: building everything.."
263	@echo "--------------------------------------------------------------"
264	cd ${.CURDIR}; ${WMAKE} all
265
266everything:
267	@echo "--------------------------------------------------------------"
268	@echo ">>> Building everything.."
269	@echo "--------------------------------------------------------------"
270	cd ${.CURDIR}; ${WMAKE} all
271
272#
273# installworld
274#
275# Installs everything compiled by a 'buildworld'.
276#
277installworld:
278	cd ${.CURDIR}; ${IMAKE} reinstall
279
280#
281# reinstall
282#
283# If you have a build server, you can NFS mount the source and obj directories
284# and do a 'make reinstall' on the *client* to install new binaries from the
285# most recent server build.
286#
287reinstall:
288	@echo "--------------------------------------------------------------"
289	@echo ">>> Making hierarchy"
290	@echo "--------------------------------------------------------------"
291	cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
292	@echo
293	@echo "--------------------------------------------------------------"
294	@echo ">>> Installing everything.."
295	@echo "--------------------------------------------------------------"
296	cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
297.if !defined(NOMAN)
298	@echo
299	@echo "--------------------------------------------------------------"
300	@echo ">>> Rebuilding man page indices"
301	@echo "--------------------------------------------------------------"
302	cd ${.CURDIR}/share/man; ${MAKE} makedb
303.endif
304
305#
306# update
307#
308# Update the source tree, by running sup and/or running cvs to update to the
309# latest copy.
310#
311update:
312.if defined(SUP_UPDATE)
313	@echo "--------------------------------------------------------------"
314	@echo ">>> Running ${SUP}"
315	@echo "--------------------------------------------------------------"
316.if defined(SUPFILE)
317	@${SUP} ${SUPFLAGS} ${SUPFILE}
318.endif
319.if defined(SUPFILE1)
320	@${SUP} ${SUPFLAGS} ${SUPFILE1}
321.endif
322.if defined(SUPFILE2)
323	@${SUP} ${SUPFLAGS} ${SUPFILE2}
324.endif
325.if defined(PORTSSUPFILE)
326	@${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
327.endif
328.endif
329.if defined(CVS_UPDATE)
330	@echo "--------------------------------------------------------------"
331	@echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
332	@echo "--------------------------------------------------------------"
333	cd ${.CURDIR}; cvs -q update -P -d
334.endif
335
336#
337# most
338#
339# Build most of the user binaries on the existing system libs and includes.
340#
341most:
342	@echo "--------------------------------------------------------------"
343	@echo ">>> Building programs only"
344	@echo "--------------------------------------------------------------"
345	cd ${.CURDIR}/bin;		${MAKE} all
346	cd ${.CURDIR}/sbin;		${MAKE} all
347	cd ${.CURDIR}/libexec;		${MAKE} all
348	cd ${.CURDIR}/usr.bin;		${MAKE} all
349	cd ${.CURDIR}/usr.sbin;		${MAKE} all
350	cd ${.CURDIR}/gnu/libexec;	${MAKE} all
351	cd ${.CURDIR}/gnu/usr.bin;	${MAKE} all
352	cd ${.CURDIR}/gnu/usr.sbin;	${MAKE} all
353
354#
355# installmost
356#
357# Install the binaries built by the 'most' target.  This does not include
358# libraries or include files.
359#
360installmost:
361	@echo "--------------------------------------------------------------"
362	@echo ">>> Installing programs only"
363	@echo "--------------------------------------------------------------"
364	cd ${.CURDIR}/bin;		${MAKE} install
365	cd ${.CURDIR}/sbin;		${MAKE} install
366	cd ${.CURDIR}/libexec;		${MAKE} install
367	cd ${.CURDIR}/usr.bin;		${MAKE} install
368	cd ${.CURDIR}/usr.sbin;		${MAKE} install
369	cd ${.CURDIR}/gnu/libexec;	${MAKE} install
370	cd ${.CURDIR}/gnu/usr.bin;	${MAKE} install
371	cd ${.CURDIR}/gnu/usr.sbin;	${MAKE} install
372
373#
374# ------------------------------------------------------------------------
375#
376# From here onwards are utility targets used by the 'make world' and
377# related targets.  If your 'world' breaks, you may like to try to fix
378# the problem and manually run the following targets to attempt to
379# complete the build.  Beware, this is *not* guaranteed to work, you
380# need to have a pretty good grip on the current state of the system
381# to attempt to manually finish it.  If in doubt, 'make world' again.
382#
383
384#
385# bootstrap-tools: Build tools needed for compatibility
386#
387.if exists(${.CURDIR}/games) && !defined(NOGAMES)
388_strfile=	games/fortune/strfile
389.endif
390
391bootstrap-tools:
392.for _tool in ${_strfile} usr.bin/yacc usr.bin/colldef gnu/usr.bin/bison
393	cd ${.CURDIR}/${_tool}; \
394		${MAKE} obj; \
395		${MAKE} depend; \
396		${MAKE} all; \
397		${MAKE} install
398.endfor
399
400#
401# build-tools: Build special purpose build tools
402#
403.if exists(${.CURDIR}/games) && !defined(NOGAMES)
404_games=	games/adventure games/hack games/phantasia
405.endif
406
407.if exists(${.CURDIR}/share) && !defined(NOSHARE)
408_share=	share/syscons/scrnmaps
409.endif
410
411.if !defined(NO_FORTRAN)
412_fortran= gnu/usr.bin/cc/f771
413.endif
414
415build-tools:
416.for _tool in bin/sh ${_games} gnu/usr.bin/cc/cc_tools ${_fortran} \
417    lib/libncurses ${_share}
418	cd ${.CURDIR}/${_tool}; ${MAKE} build-tools
419.endfor
420
421#
422# cross-tools: Build cross-building tools
423#
424# WARNING: Because the bootstrap tools are expected to run on the
425# build-machine, MACHINE_ARCH is *always* set to BUILD_ARCH when this
426# target is being made. TARGET_ARCH is *always* set to reflect the
427# target-machine (which you can set by specifying MACHINE_ARCH on
428# make's command-line, get it?).
429# The reason is simple: we build these tools not to be run on the
430# architecture we're cross-building, but on the architecture we're
431# currently building on (ie the host-machine) and we expect these
432# tools to produce output for the architecture we're trying to
433# cross-build.
434#
435.if ${TARGET_ARCH} == "alpha" && ${MACHINE_ARCH} != "alpha"
436_elf2exe=	usr.sbin/elf2exe
437.endif
438
439# XXX - MACHINE should actually be TARGET. But we don't set that...
440.if ${TARGET_ARCH} == "i386" && ${MACHINE} == "pc98"
441_aout_tools=	usr.bin/size usr.bin/strip gnu/usr.bin/as gnu/usr.bin/ld
442.endif
443
444cross-tools:
445.for _tool in ${_aout_tools} ${_elf2exe} usr.bin/genassym usr.bin/gensetdefs \
446    gnu/usr.bin/binutils usr.bin/objformat gnu/usr.bin/cc
447	cd ${.CURDIR}/${_tool}; \
448		${MAKE} obj; \
449		${MAKE} depend; \
450		${MAKE} all; \
451		${MAKE} install
452.endfor
453
454#
455# hierarchy - ensure that all the needed directories are present
456#
457hierarchy:
458	cd ${.CURDIR}/etc;		${MAKE} distrib-dirs
459
460#
461# includes - possibly generate and install the include files.
462#
463includes:
464	cd ${.CURDIR}/include;			${MAKE} -B all install
465	cd ${.CURDIR}/gnu/include;		${MAKE} install
466	cd ${.CURDIR}/gnu/lib/libmp;		${MAKE} beforeinstall
467	cd ${.CURDIR}/gnu/lib/libobjc;		${MAKE} beforeinstall
468	cd ${.CURDIR}/gnu/lib/libreadline;	${MAKE} beforeinstall
469	cd ${.CURDIR}/gnu/lib/libregex;		${MAKE} beforeinstall
470	cd ${.CURDIR}/gnu/lib/libstdc++;	${MAKE} beforeinstall
471	cd ${.CURDIR}/gnu/lib/libdialog;	${MAKE} beforeinstall
472	cd ${.CURDIR}/gnu/lib/libgmp;		${MAKE} beforeinstall
473	cd ${.CURDIR}/gnu/usr.bin/cc/cc1plus;	${MAKE} beforeinstall
474.if exists(${.CURDIR}/secure) && !defined(NOCRYPT)
475	cd ${.CURDIR}/secure/lib/libdes;	${MAKE} beforeinstall
476.endif
477.if exists(${.CURDIR}/kerberosIV) && !defined(NOCRYPT) && \
478    defined(MAKE_KERBEROS4)
479	cd ${.CURDIR}/kerberosIV/lib/libacl;	${MAKE} beforeinstall
480	cd ${.CURDIR}/kerberosIV/lib/libkadm;	${MAKE} beforeinstall
481	cd ${.CURDIR}/kerberosIV/lib/libkafs;	${MAKE} beforeinstall
482	cd ${.CURDIR}/kerberosIV/lib/libkdb;	${MAKE} beforeinstall
483	cd ${.CURDIR}/kerberosIV/lib/libkrb;	${MAKE} beforeinstall
484	cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall
485.else
486	cd ${.CURDIR}/lib/libtelnet;		${MAKE} beforeinstall
487.endif
488.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
489	cd ${.CURDIR}/lib/csu/${MACHINE_ARCH};	${MAKE} beforeinstall
490.endif
491	cd ${.CURDIR}/lib/libalias;		${MAKE} beforeinstall
492	cd ${.CURDIR}/lib/libatm;		${MAKE} beforeinstall
493	cd ${.CURDIR}/lib/libdevstat;		${MAKE} beforeinstall
494	cd ${.CURDIR}/lib/libc;			${MAKE} beforeinstall
495	cd ${.CURDIR}/lib/libcalendar;		${MAKE} beforeinstall
496	cd ${.CURDIR}/lib/libcam;		${MAKE} beforeinstall
497	cd ${.CURDIR}/lib/libdisk;		${MAKE} beforeinstall
498	cd ${.CURDIR}/lib/libedit;		${MAKE} beforeinstall
499	cd ${.CURDIR}/lib/libftpio;		${MAKE} beforeinstall
500	cd ${.CURDIR}/lib/libkvm;		${MAKE} beforeinstall
501	cd ${.CURDIR}/lib/libmd;		${MAKE} beforeinstall
502.if !defined(WANT_CSRG_LIBM)
503	cd ${.CURDIR}/lib/msun;			${MAKE} beforeinstall
504.endif
505	cd ${.CURDIR}/lib/libncp;		${MAKE} beforeinstall
506	cd ${.CURDIR}/lib/libncurses;		${MAKE} beforeinstall
507	cd ${.CURDIR}/lib/libnetgraph;		${MAKE} beforeinstall
508	cd ${.CURDIR}/lib/libopie;		${MAKE} beforeinstall
509	cd ${.CURDIR}/lib/libpam/libpam;	${MAKE} beforeinstall
510	cd ${.CURDIR}/lib/libpcap;		${MAKE} beforeinstall
511	cd ${.CURDIR}/lib/libradius;		${MAKE} beforeinstall
512	cd ${.CURDIR}/lib/librpcsvc;		${MAKE} beforeinstall
513	cd ${.CURDIR}/lib/libskey;		${MAKE} beforeinstall
514	cd ${.CURDIR}/lib/libstand;		${MAKE} beforeinstall
515	cd ${.CURDIR}/lib/libtacplus;		${MAKE} beforeinstall
516	cd ${.CURDIR}/lib/libcom_err;		${MAKE} beforeinstall
517	cd ${.CURDIR}/lib/libss;		${MAKE} -B hdrs beforeinstall
518	cd ${.CURDIR}/lib/libutil;		${MAKE} beforeinstall
519	cd ${.CURDIR}/lib/libvgl;		${MAKE} beforeinstall
520	cd ${.CURDIR}/lib/libwrap;		${MAKE} beforeinstall
521	cd ${.CURDIR}/lib/libz;			${MAKE} beforeinstall
522	cd ${.CURDIR}/usr.bin/lex;		${MAKE} beforeinstall
523
524#
525# libraries - build all libraries, and install them under ${DESTDIR}.
526#
527# The following dependencies exist between the libraries:
528#
529# lib*: csu
530# libatm: libmd
531# libcrypt: libmd
532# libdialog: libncurses
533# libedit: libncurses
534# libg++: libm
535# libkrb: libcrypt
536# libopie: libmd
537# libpam: libcom_err libcrypt libdes libgcc_pic libkrb libradius libskey \
538#	  libtacplus libutil
539# libradius: libmd
540# libreadline: libncurses
541# libskey: libcrypt libmd
542# libss: libcom_err
543# libstc++: libm
544# libtacplus: libmd
545#
546# Across directories this comes down to (rougly):
547#
548# gnu/lib: lib/libm lib/libncurses
549# kerberosIV/lib: lib/libcrypt
550# lib/libpam: secure/lib/libdes kerberosIV/lib/libkrb gnu/lib/libgcc
551# secure/lib: lib/libmd
552#
553.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}.pcc)
554_csu=	lib/csu/${MACHINE_ARCH}.pcc
555.elif ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf"
556_csu=	lib/csu/i386-elf
557.else
558_csu=	lib/csu/${MACHINE_ARCH}
559.endif
560
561.if !defined(NOSECURE) && !defined(NOCRYPT)
562_secure_lib=	secure/lib
563.endif
564
565.if !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
566_kerberosIV_lib=	kerberosIV/lib
567.endif
568
569.if defined(WANT_CSRG_LIBM)
570_libm=	lib/libm
571.else
572_libm=	lib/msun
573.endif
574
575.if !defined(NOPERL)
576_libperl=	gnu/usr.bin/perl/libperl
577.endif
578
579.if ${MACHINE_ARCH} == "i386"
580_libkeycap=	usr.sbin/pcvt/keycap
581.endif
582
583libraries:
584.for _lib in ${_csu} lib/libmd lib/libcrypt ${_secure_lib} ${_kerberosIV_lib} \
585    gnu/lib/libgcc lib/libcom_err ${_libm} lib/libncurses lib/libradius \
586    lib/libskey lib/libtacplus lib/libutil lib gnu/lib ${_libperl} \
587    usr.bin/lex/lib ${_libkeycap}
588.if exists(${.CURDIR}/${_lib})
589	cd ${.CURDIR}/${_lib}; \
590		${MAKE} depend; \
591		${MAKE} all; \
592		${MAKE} install
593.endif
594.endfor
595
596.for __target in clean cleandepend cleandir depend obj
597.for entry in ${SUBDIR}
598${entry}.${__target}__D: .PHONY
599	@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
600		${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
601		edir=${entry}.${MACHINE_ARCH}; \
602		cd ${.CURDIR}/$${edir}; \
603	else \
604		${ECHODIR} "===> ${DIRPRFX}${entry}"; \
605		edir=${entry}; \
606		cd ${.CURDIR}/$${edir}; \
607	fi; \
608	${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
609.endfor
610par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
611.endfor
612
613.include <bsd.subdir.mk>
614