Makefile.inc1 revision 54368
1#
2# $FreeBSD: head/Makefile.inc1 54368 1999-12-09 16:40:27Z marcel $
3#
4# Make command line options:
5#	-DMAKE_KERBEROS4 to build KerberosIV
6#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
7#	-DNOCLEAN do not clean at all
8#	-DNOCRYPT will prevent building of crypt versions
9#	-DNOPROFILE do not build profiled libraries
10#	-DNOSECURE do not go into secure subdir
11#	-DNOGAMES do not go into games subdir
12#	-DNOSHARE do not go into share subdir
13#	-DNOINFO do not make or install info files
14#	-DNOLIBC_R do not build libc_r.
15#	-DNO_FORTRAN do not build g77 and related libraries.
16#	LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
17
18#
19# The intended user-driven targets are:
20# buildworld  - rebuild *everything*, including glue to help do upgrades
21# installworld- install everything built by "buildworld"
22# update      - convenient way to update your source tree (eg: sup/cvs)
23# most        - build user commands, no libraries or include files
24# installmost - install user commands, no libraries or include files
25#
26# Standard targets (not defined here) are documented in the makefiles in
27# /usr/share/mk.  These include:
28#		obj depend all install clean cleandepend cleanobj
29
30# Put initial settings here.
31SUBDIR=
32
33# We must do share/info early so that installation of info `dir'
34# entries works correctly.  Do it first since it is less likely to
35# grow dependencies on include and lib than vice versa.
36.if exists(${.CURDIR}/share/info)
37SUBDIR+= share/info
38.endif
39
40# We must do include and lib early so that the perl *.ph generation
41# works correctly as it uses the header files installed by this.
42.if exists(${.CURDIR}/include)
43SUBDIR+= include
44.endif
45.if exists(${.CURDIR}/lib)
46SUBDIR+= lib
47.endif
48
49.if exists(${.CURDIR}/bin)
50SUBDIR+= bin
51.endif
52.if exists(${.CURDIR}/games) && !defined(NOGAMES)
53SUBDIR+= games
54.endif
55.if exists(${.CURDIR}/gnu)
56SUBDIR+= gnu
57.endif
58.if exists(${.CURDIR}/kerberosIV) && exists(${.CURDIR}/crypto) && \
59    !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
60SUBDIR+= kerberosIV
61.endif
62.if exists(${.CURDIR}/libexec)
63SUBDIR+= libexec
64.endif
65.if exists(${.CURDIR}/sbin)
66SUBDIR+= sbin
67.endif
68.if exists(${.CURDIR}/share) && !defined(NOSHARE)
69SUBDIR+= share
70.endif
71.if exists(${.CURDIR}/sys)
72SUBDIR+= sys
73.endif
74.if exists(${.CURDIR}/usr.bin)
75SUBDIR+= usr.bin
76.endif
77.if exists(${.CURDIR}/usr.sbin)
78SUBDIR+= usr.sbin
79.endif
80.if exists(${.CURDIR}/secure) && !defined(NOCRYPT) && !defined(NOSECURE)
81SUBDIR+= secure
82.endif
83
84# etc must be last for "distribute" to work
85.if exists(${.CURDIR}/etc)
86SUBDIR+= etc
87.endif
88
89# These are last, since it is nice to at least get the base system
90# rebuilt before you do them.
91.if defined(LOCAL_DIRS)
92.for _DIR in ${LOCAL_DIRS}
93.if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile)
94SUBDIR+= ${_DIR}
95.endif
96.endfor
97.endif
98
99.if defined(NOCLEANDIR)
100CLEANDIR=	clean cleandepend
101.else
102CLEANDIR=	cleandir
103.endif
104
105SUP?=		cvsup
106SUPFLAGS?=	-g -L 2 -P -
107
108#
109# Define the location of the temporary installation directory. Note that
110# MAKEOBJDIRPREFIX normally isn't defined so if the current directory is
111# /usr/src, then the world temporary directory is /usr/obj/usr/src/tmp.
112#
113# During the transition from aout to elf format on i386, MAKEOBJDIRPREFIX
114# is set by the parent makefile (Makefile.inc0) to be /usr/obj/${OBJFORMAT}
115# in order to keep aout and elf format files apart.
116#
117.if defined(MAKEOBJDIRPREFIX)
118WORLDTMP=	${MAKEOBJDIRPREFIX}${.CURDIR}/tmp
119.else
120WORLDTMP=	/usr/obj${.CURDIR}/tmp
121.endif
122
123STRICTTMPPATH=	${WORLDTMP}/bin:${WORLDTMP}/usr/bin
124TMPPATH=	${STRICTTMPPATH}:${PATH}
125
126BUILD_ARCH!=	sysctl -n hw.machine_arch
127
128BMAKEENV=	INSTALL="sh ${.CURDIR}/tools/install.sh" \
129		TARGET_ARCH=${MACHINE_ARCH} \
130		MACHINE_ARCH=${BUILD_ARCH} \
131		PATH=${TMPPATH}
132
133XMAKEENV=	COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \
134		LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib \
135		OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \
136		CFLAGS="-nostdinc ${CFLAGS}" \
137		PERL5LIB=${DESTDIR}/usr/libdata/perl/5.00503 \
138		PATH=${TMPPATH}
139
140# bootstrap make
141BMAKE=	${BMAKEENV} ${MAKE} DESTDIR=${WORLDTMP} -DNOMAN -DNOINFO \
142	-DNO_FORTRAN -DNO_GDB -DNO_OBJC
143
144# cross make used for compilation
145XMAKE=	${XMAKEENV} ${MAKE} DESTDIR=${WORLDTMP} \
146		INSTALL="sh ${.CURDIR}/tools/install.sh"
147
148# cross make used for final installation
149IXMAKE=	${XMAKEENV} ${MAKE}
150
151#
152# buildworld
153#
154# Attempt to rebuild the entire system, with reasonable chance of
155# success, regardless of how old your existing system is.
156#
157USRDIRS=	usr/bin usr/lib/compat/aout usr/games usr/libdata/ldscripts \
158		usr/libexec/${OBJFORMAT} usr/share/misc
159
160INCDIRS=	arpa cam/scsi g++/std isofs/cd9660 machine msdosfs net \
161		netatalk netatm netgraph netinet netinet6 netipx netkey \
162		netncp netns nfs ntfs nwfs objc pccard posix4 protocols \
163		readline rpc rpcsvc security ss sys ufs/ffs ufs/mfs ufs/ufs vm
164
165buildworld:
166	@echo
167	@echo "--------------------------------------------------------------"
168	@echo ">>> Cleaning up the temporary build tree"
169	@echo "--------------------------------------------------------------"
170	rm -rf ${WORLDTMP}
171.for _dir in ${USRDIRS}
172	mkdir -p ${WORLDTMP}/${_dir}
173.endfor
174.for _dir in ${INCDIRS}
175	mkdir -p ${WORLDTMP}/usr/include/${_dir}
176.endfor
177	ln -sf ${.CURDIR}/sys ${WORLDTMP}/sys
178.if !defined(NOCLEAN)
179	@echo
180	@echo "--------------------------------------------------------------"
181	@echo ">>> Cleaning up the object tree"
182	@echo "--------------------------------------------------------------"
183	cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
184.endif
185	@echo
186	@echo "--------------------------------------------------------------"
187	@echo ">>> Rebuilding the object tree"
188	@echo "--------------------------------------------------------------"
189	cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 par-obj
190	@echo
191	@echo "--------------------------------------------------------------"
192	@echo ">>> Rebuilding tools"
193	@echo "--------------------------------------------------------------"
194	cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 -DNOINFO -DNOMAN tools
195	@echo
196	@echo "--------------------------------------------------------------"
197	@echo ">>> Rebuilding ${DESTDIR}/usr/include"
198	@echo "--------------------------------------------------------------"
199	cd ${.CURDIR}; ${XMAKE} -f Makefile.inc1 includes
200	@echo
201	@echo "--------------------------------------------------------------"
202	@echo ">>> Rebuilding dependencies"
203	@echo "--------------------------------------------------------------"
204	cd ${.CURDIR}; ${XMAKE} -f Makefile.inc1 par-depend
205	@echo
206	@echo "--------------------------------------------------------------"
207	@echo ">>> Building libraries"
208	@echo "--------------------------------------------------------------"
209	cd ${.CURDIR}; ${XMAKE} -DNOINFO -DNOMAN -f Makefile.inc1 libraries
210	@echo
211	@echo "--------------------------------------------------------------"
212	@echo ">>> Building everything.."
213	@echo "--------------------------------------------------------------"
214	cd ${.CURDIR}; ${XMAKE} -f Makefile.inc1 all
215
216everything:
217	@echo "--------------------------------------------------------------"
218	@echo ">>> Building everything.."
219	@echo "--------------------------------------------------------------"
220	cd ${.CURDIR}; ${XMAKE} -f Makefile.inc1 all
221
222#
223# installworld
224#
225# Installs everything compiled by a 'buildworld'.
226#
227installworld:
228	cd ${.CURDIR}; ${IXMAKE} -f Makefile.inc1 reinstall
229
230#
231# reinstall
232#
233# If you have a build server, you can NFS mount the source and obj directories
234# and do a 'make reinstall' on the *client* to install new binaries from the
235# most recent server build.
236#
237reinstall:
238	@echo "--------------------------------------------------------------"
239	@echo ">>> Making hierarchy"
240	@echo "--------------------------------------------------------------"
241	cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
242	@echo
243	@echo "--------------------------------------------------------------"
244	@echo ">>> Installing everything.."
245	@echo "--------------------------------------------------------------"
246	cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
247.if !defined(NOMAN)
248	@echo
249	@echo "--------------------------------------------------------------"
250	@echo ">>> Rebuilding man page indices"
251	@echo "--------------------------------------------------------------"
252	cd ${.CURDIR}/share/man; ${MAKE} makedb
253.endif
254
255#
256# update
257#
258# Update the source tree, by running sup and/or running cvs to update to the
259# latest copy.
260#
261update:
262.if defined(SUP_UPDATE)
263	@echo "--------------------------------------------------------------"
264	@echo ">>> Running ${SUP}"
265	@echo "--------------------------------------------------------------"
266	@${SUP} ${SUPFLAGS} ${SUPFILE}
267.if defined(SUPFILE1)
268	@${SUP} ${SUPFLAGS} ${SUPFILE1}
269.endif
270.if defined(SUPFILE2)
271	@${SUP} ${SUPFLAGS} ${SUPFILE2}
272.endif
273.if defined(PORTSSUPFILE)
274	@${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
275.endif
276.endif
277.if defined(CVS_UPDATE)
278	@echo "--------------------------------------------------------------"
279	@echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
280	@echo "--------------------------------------------------------------"
281	cd ${.CURDIR}; cvs -q update -P -d
282.endif
283
284#
285# most
286#
287# Build most of the user binaries on the existing system libs and includes.
288#
289most:
290	@echo "--------------------------------------------------------------"
291	@echo ">>> Building programs only"
292	@echo "--------------------------------------------------------------"
293	cd ${.CURDIR}/bin;		${MAKE} all
294	cd ${.CURDIR}/sbin;		${MAKE} all
295	cd ${.CURDIR}/libexec;		${MAKE} all
296	cd ${.CURDIR}/usr.bin;		${MAKE} all
297	cd ${.CURDIR}/usr.sbin;		${MAKE} all
298	cd ${.CURDIR}/gnu/libexec;	${MAKE} all
299	cd ${.CURDIR}/gnu/usr.bin;	${MAKE} all
300	cd ${.CURDIR}/gnu/usr.sbin;	${MAKE} all
301#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
302#	cd ${.CURDIR}/kerberosIV;	${MAKE} most
303#.endif
304#.if !defined(NOSECURE) && !defined(NOCRYPT)
305#	cd ${.CURDIR}/secure;		${MAKE} most
306#.endif
307
308#
309# installmost
310#
311# Install the binaries built by the 'most' target.  This does not include
312# libraries or include files.
313#
314installmost:
315	@echo "--------------------------------------------------------------"
316	@echo ">>> Installing programs only"
317	@echo "--------------------------------------------------------------"
318	cd ${.CURDIR}/bin;		${MAKE} install
319	cd ${.CURDIR}/sbin;		${MAKE} install
320	cd ${.CURDIR}/libexec;		${MAKE} install
321	cd ${.CURDIR}/usr.bin;		${MAKE} install
322	cd ${.CURDIR}/usr.sbin;		${MAKE} install
323	cd ${.CURDIR}/gnu/libexec;	${MAKE} install
324	cd ${.CURDIR}/gnu/usr.bin;	${MAKE} install
325	cd ${.CURDIR}/gnu/usr.sbin;	${MAKE} install
326#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
327#	cd ${.CURDIR}/kerberosIV;	${MAKE} installmost
328#.endif
329#.if !defined(NOSECURE) && !defined(NOCRYPT)
330#	cd ${.CURDIR}/secure;		${MAKE} installmost
331#.endif
332
333#
334# ------------------------------------------------------------------------
335#
336# From here onwards are utility targets used by the 'make world' and
337# related targets.  If your 'world' breaks, you may like to try to fix
338# the problem and manually run the following targets to attempt to
339# complete the build.  Beware, this is *not* guaranteed to work, you
340# need to have a pretty good grip on the current state of the system
341# to attempt to manually finish it.  If in doubt, 'make world' again.
342#
343
344#
345# tools - Build tools needed to run the actual build.
346#
347tools:
348.for _tool in games/fortune/strfile gnu/usr.bin/binutils usr.bin/objformat \
349    usr.bin/yacc gnu/usr.bin/bison gnu/usr.bin/cc
350	cd ${.CURDIR}/${_tool}; \
351		${MAKE} depend; \
352		${MAKE} all; \
353		${MAKE} install; \
354		${MAKE} cleandir; \
355		${MAKE} obj
356.endfor
357
358#
359# hierarchy - ensure that all the needed directories are present
360#
361hierarchy:
362	cd ${.CURDIR}/etc;		${MAKE} distrib-dirs
363
364#
365# includes - possibly generate and install the include files.
366#
367includes:
368	cd ${.CURDIR}/include;		${MAKE} SHARED=symlinks -B all install
369	cd ${.CURDIR}/gnu/include;		${MAKE} install
370	cd ${.CURDIR}/gnu/lib/libmp;		${MAKE} beforeinstall
371	cd ${.CURDIR}/gnu/lib/libobjc;		${MAKE} beforeinstall
372	cd ${.CURDIR}/gnu/lib/libreadline;	${MAKE} beforeinstall
373	cd ${.CURDIR}/gnu/lib/libregex;		${MAKE} beforeinstall
374	cd ${.CURDIR}/gnu/lib/libstdc++;	${MAKE} beforeinstall
375	cd ${.CURDIR}/gnu/lib/libdialog;	${MAKE} beforeinstall
376	cd ${.CURDIR}/gnu/lib/libgmp;		${MAKE} beforeinstall
377	cd ${.CURDIR}/gnu/usr.bin/cc/cc1plus;	${MAKE} beforeinstall
378.if exists(${.CURDIR}/secure) && !defined(NOCRYPT)
379	cd ${.CURDIR}/secure/lib/libdes;	${MAKE} beforeinstall
380.endif
381.if exists(${.CURDIR}/kerberosIV) && !defined(NOCRYPT) && \
382    defined(MAKE_KERBEROS4)
383	cd ${.CURDIR}/kerberosIV/lib/libacl;	${MAKE} beforeinstall
384	cd ${.CURDIR}/kerberosIV/lib/libkadm;	${MAKE} beforeinstall
385	cd ${.CURDIR}/kerberosIV/lib/libkafs;	${MAKE} beforeinstall
386	cd ${.CURDIR}/kerberosIV/lib/libkdb;	${MAKE} beforeinstall
387	cd ${.CURDIR}/kerberosIV/lib/libkrb;	${MAKE} beforeinstall
388	cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall
389.else
390	cd ${.CURDIR}/lib/libtelnet;		${MAKE} beforeinstall
391.endif
392.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
393	cd ${.CURDIR}/lib/csu/${MACHINE_ARCH};	${MAKE} beforeinstall
394.endif
395	cd ${.CURDIR}/lib/libalias;		${MAKE} beforeinstall
396	cd ${.CURDIR}/lib/libatm;		${MAKE} beforeinstall
397	cd ${.CURDIR}/lib/libdevstat;		${MAKE} beforeinstall
398	cd ${.CURDIR}/lib/libc;			${MAKE} beforeinstall
399	cd ${.CURDIR}/lib/libcalendar;		${MAKE} beforeinstall
400	cd ${.CURDIR}/lib/libcam;		${MAKE} beforeinstall
401	cd ${.CURDIR}/lib/libdisk;		${MAKE} beforeinstall
402	cd ${.CURDIR}/lib/libedit;		${MAKE} beforeinstall
403	cd ${.CURDIR}/lib/libftpio;		${MAKE} beforeinstall
404	cd ${.CURDIR}/lib/libkvm;		${MAKE} beforeinstall
405	cd ${.CURDIR}/lib/libmd;		${MAKE} beforeinstall
406.if !defined(WANT_CSRG_LIBM)
407	cd ${.CURDIR}/lib/msun;			${MAKE} beforeinstall
408.endif
409	cd ${.CURDIR}/lib/libncp;		${MAKE} beforeinstall
410	cd ${.CURDIR}/lib/libncurses;		${MAKE} beforeinstall
411	cd ${.CURDIR}/lib/libnetgraph;		${MAKE} beforeinstall
412	cd ${.CURDIR}/lib/libopie;		${MAKE} beforeinstall
413	cd ${.CURDIR}/lib/libpam/libpam;	${MAKE} beforeinstall
414	cd ${.CURDIR}/lib/libpcap;		${MAKE} beforeinstall
415	cd ${.CURDIR}/lib/libradius;		${MAKE} beforeinstall
416	cd ${.CURDIR}/lib/librpcsvc;		${MAKE} beforeinstall
417	cd ${.CURDIR}/lib/libskey;		${MAKE} beforeinstall
418	cd ${.CURDIR}/lib/libstand;		${MAKE} beforeinstall
419	cd ${.CURDIR}/lib/libtacplus;		${MAKE} beforeinstall
420	cd ${.CURDIR}/lib/libcom_err;		${MAKE} beforeinstall
421	cd ${.CURDIR}/lib/libss;		${MAKE} -B hdrs beforeinstall
422	cd ${.CURDIR}/lib/libutil;		${MAKE} beforeinstall
423	cd ${.CURDIR}/lib/libvgl;		${MAKE} beforeinstall
424	cd ${.CURDIR}/lib/libwrap;		${MAKE} beforeinstall
425	cd ${.CURDIR}/lib/libz;			${MAKE} beforeinstall
426	cd ${.CURDIR}/usr.bin/lex;		${MAKE} beforeinstall
427
428#
429# libraries - build all libraries, and install them under ${DESTDIR}.
430#
431# The following dependencies exist between the libraries:
432#
433# lib*: csu
434# libatm: libmd
435# libcrypt: libmd
436# libdialog: libncurses
437# libedit: libncurses
438# libg++: libm
439# libkrb: libcrypt
440# libopie: libmd
441# libpam: libcom_err libcrypt libdes libgcc_pic libkrb libradius libskey \
442#	  libtacplus libutil
443# libradius: libmd
444# libreadline: libncurses
445# libskey: libcrypt libmd
446# libss: libcom_err
447# libstc++: libm
448# libtacplus: libmd
449#
450# Across directories this comes down to (rougly):
451#
452# gnu/lib: lib/libm lib/libncurses
453# kerberosIV/lib: lib/libcrypt
454# lib/libpam: secure/lib/libdes kerberosIV/lib/libkrb gnu/lib/libgcc
455# secure/lib: lib/libmd
456#
457.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}.pcc)
458_csu=	lib/csu/${MACHINE_ARCH}.pcc
459.elif ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf"
460_csu=	lib/csu/i386-elf
461.else
462_csu=	lib/csu/${MACHINE_ARCH}
463.endif
464
465.if !defined(NOSECURE) && !defined(NOCRYPT)
466_secure_lib=	secure/lib
467.endif
468
469.if !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
470_kerberosIV_lib=	kerberosIV/lib
471.endif
472
473.if defined(WANT_CSRG_LIBM)
474_libm=	lib/libm
475.else
476_libm=	lib/msun
477.endif
478
479.if !defined(NOPERL)
480_libperl=	gnu/usr.bin/perl/libperl
481.endif
482
483libraries:
484.for _lib in ${_csu} lib/libmd lib/libcrypt ${_secure_lib} ${_kerberosIV_lib} \
485    gnu/lib/libgcc lib/libcom_err ${_libm} lib/libncurses lib/libradius \
486    lib/libskey lib/libtacplus lib/libutil lib gnu/lib ${_libperl} \
487    usr.bin/lex/lib usr.sbin/pcvt/keycap
488.if exists(${.CURDIR}/${_lib})
489	cd ${.CURDIR}/${_lib}; \
490		${MAKE} depend; \
491		${MAKE} all; \
492		${MAKE} install
493.endif
494.endfor
495
496.for __target in clean cleandepend cleandir depend obj
497.for entry in ${SUBDIR}
498${entry}.${__target}__D: .PHONY
499	@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
500		${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
501		edir=${entry}.${MACHINE_ARCH}; \
502		cd ${.CURDIR}/$${edir}; \
503	else \
504		${ECHODIR} "===> ${DIRPRFX}${entry}"; \
505		edir=${entry}; \
506		cd ${.CURDIR}/$${edir}; \
507	fi; \
508	${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
509.endfor
510par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
511.endfor
512
513.include <bsd.subdir.mk>
514