Makefile.inc1 revision 54392
1#
2# $FreeBSD: head/Makefile.inc1 54392 1999-12-10 10:48:20Z 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
108MAKEOBJDIRPREFIX?=	/usr/obj
109BUILD_ARCH!=	sysctl -n hw.machine_arch
110OBJTREE=	${MAKEOBJDIRPREFIX}/${MACHINE_ARCH}
111WORLDTMP=	${OBJTREE}${.CURDIR}/${BUILD_ARCH}
112STRICTTMPPATH=	${WORLDTMP}/bin:${WORLDTMP}/usr/bin
113TMPPATH=	${STRICTTMPPATH}:${PATH}
114
115# bootstrap/tools make
116BMAKEENV=	MAKEOBJDIRPREFIX=${WORLDTMP} \
117		DESTDIR=${WORLDTMP} \
118		INSTALL="sh ${.CURDIR}/tools/install.sh" \
119		TARGET_ARCH=${MACHINE_ARCH} \
120		MACHINE_ARCH=${BUILD_ARCH} \
121		PATH=${TMPPATH}
122BMAKE=		${BMAKEENV} ${MAKE} -f Makefile.inc1 -DNOMAN -DNOINFO \
123		-DNO_FORTRAN -DNO_GDB -DNO_OBJC
124
125CROSSENV=	COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \
126		LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib \
127		OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \
128		CFLAGS="-nostdinc ${CFLAGS}" \
129		PERL5LIB=${WORLDTMP}/usr/libdata/perl/5.00503 \
130		MAKEOBJDIRPREFIX=${OBJTREE}
131
132# cross make used for compilation
133XMAKEENV=	${CROSSENV} \
134		DESTDIR=${WORLDTMP} \
135		INSTALL="sh ${.CURDIR}/tools/install.sh" \
136		PATH=${TMPPATH}
137XMAKE=		${XMAKEENV} ${MAKE} -f Makefile.inc1
138
139# cross make used for final installation
140IMAKEENV=	${CROSSENV} \
141		DESTDIR=/usr1/release \
142		PATH=${STRICTTMPPATH}
143IMAKE=		${IMAKEENV} ${MAKE} -f Makefile.inc1
144
145USRDIRS=	usr/bin usr/lib/compat/aout usr/games usr/libdata/ldscripts \
146		usr/libexec/${OBJFORMAT} usr/share/misc
147
148INCDIRS=	arpa g++/std objc protocols readline rpc rpcsvc security ss
149
150#
151# buildworld
152#
153# Attempt to rebuild the entire system, with reasonable chance of
154# success, regardless of how old your existing system is.
155#
156buildworld:
157	@echo
158	@echo "--------------------------------------------------------------"
159	@echo ">>> Rebuilding the temporary build tree"
160	@echo "--------------------------------------------------------------"
161.if !defined(NOCLEAN)
162	rm -rf ${WORLDTMP}
163.endif
164.for _dir in ${USRDIRS}
165	mkdir -p ${WORLDTMP}/${_dir}
166.endfor
167.for _dir in ${INCDIRS}
168	mkdir -p ${WORLDTMP}/usr/include/${_dir}
169.endfor
170.if defined(NOCLEAN)
171	rm -f ${WORLDTMP}/sys
172.endif
173	ln -sf ${.CURDIR}/sys ${WORLDTMP}/sys
174	@echo
175	@echo "--------------------------------------------------------------"
176	@echo ">>> Rebuilding tools"
177	@echo "--------------------------------------------------------------"
178	cd ${.CURDIR}; ${BMAKE} tools
179.if !defined(NOCLEAN)
180	@echo
181	@echo "--------------------------------------------------------------"
182	@echo ">>> Cleaning up the object tree"
183	@echo "--------------------------------------------------------------"
184	cd ${.CURDIR}; ${XMAKE} ${CLEANDIR:S/^/par-/}
185.endif
186	@echo
187	@echo "--------------------------------------------------------------"
188	@echo ">>> Rebuilding the object tree"
189	@echo "--------------------------------------------------------------"
190	cd ${.CURDIR}; ${XMAKE} par-obj
191	@echo
192	@echo "--------------------------------------------------------------"
193	@echo ">>> Rebuilding ${WORLDTMP}/usr/include"
194	@echo "--------------------------------------------------------------"
195	cd ${.CURDIR}; ${XMAKE} includes
196	@echo
197	@echo "--------------------------------------------------------------"
198	@echo ">>> Rebuilding dependencies"
199	@echo "--------------------------------------------------------------"
200	cd ${.CURDIR}; ${XMAKE} par-depend
201	@echo
202	@echo "--------------------------------------------------------------"
203	@echo ">>> Building libraries"
204	@echo "--------------------------------------------------------------"
205	cd ${.CURDIR}; ${XMAKE} -DNOINFO -DNOMAN libraries
206	@echo
207	@echo "--------------------------------------------------------------"
208	@echo ">>> Building everything.."
209	@echo "--------------------------------------------------------------"
210	cd ${.CURDIR}; ${XMAKE} all
211
212everything:
213	@echo "--------------------------------------------------------------"
214	@echo ">>> Building everything.."
215	@echo "--------------------------------------------------------------"
216	cd ${.CURDIR}; ${XMAKE} all
217
218#
219# installworld
220#
221# Installs everything compiled by a 'buildworld'.
222#
223installworld:
224	cd ${.CURDIR}; ${IMAKE} reinstall
225
226#
227# reinstall
228#
229# If you have a build server, you can NFS mount the source and obj directories
230# and do a 'make reinstall' on the *client* to install new binaries from the
231# most recent server build.
232#
233reinstall:
234	@echo "--------------------------------------------------------------"
235	@echo ">>> Making hierarchy"
236	@echo "--------------------------------------------------------------"
237	cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
238	@echo
239	@echo "--------------------------------------------------------------"
240	@echo ">>> Installing everything.."
241	@echo "--------------------------------------------------------------"
242	cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
243.if !defined(NOMAN)
244	@echo
245	@echo "--------------------------------------------------------------"
246	@echo ">>> Rebuilding man page indices"
247	@echo "--------------------------------------------------------------"
248	cd ${.CURDIR}/share/man; ${MAKE} makedb
249.endif
250
251#
252# update
253#
254# Update the source tree, by running sup and/or running cvs to update to the
255# latest copy.
256#
257update:
258.if defined(SUP_UPDATE)
259	@echo "--------------------------------------------------------------"
260	@echo ">>> Running ${SUP}"
261	@echo "--------------------------------------------------------------"
262	@${SUP} ${SUPFLAGS} ${SUPFILE}
263.if defined(SUPFILE1)
264	@${SUP} ${SUPFLAGS} ${SUPFILE1}
265.endif
266.if defined(SUPFILE2)
267	@${SUP} ${SUPFLAGS} ${SUPFILE2}
268.endif
269.if defined(PORTSSUPFILE)
270	@${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
271.endif
272.endif
273.if defined(CVS_UPDATE)
274	@echo "--------------------------------------------------------------"
275	@echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
276	@echo "--------------------------------------------------------------"
277	cd ${.CURDIR}; cvs -q update -P -d
278.endif
279
280#
281# most
282#
283# Build most of the user binaries on the existing system libs and includes.
284#
285most:
286	@echo "--------------------------------------------------------------"
287	@echo ">>> Building programs only"
288	@echo "--------------------------------------------------------------"
289	cd ${.CURDIR}/bin;		${MAKE} all
290	cd ${.CURDIR}/sbin;		${MAKE} all
291	cd ${.CURDIR}/libexec;		${MAKE} all
292	cd ${.CURDIR}/usr.bin;		${MAKE} all
293	cd ${.CURDIR}/usr.sbin;		${MAKE} all
294	cd ${.CURDIR}/gnu/libexec;	${MAKE} all
295	cd ${.CURDIR}/gnu/usr.bin;	${MAKE} all
296	cd ${.CURDIR}/gnu/usr.sbin;	${MAKE} all
297
298#
299# installmost
300#
301# Install the binaries built by the 'most' target.  This does not include
302# libraries or include files.
303#
304installmost:
305	@echo "--------------------------------------------------------------"
306	@echo ">>> Installing programs only"
307	@echo "--------------------------------------------------------------"
308	cd ${.CURDIR}/bin;		${MAKE} install
309	cd ${.CURDIR}/sbin;		${MAKE} install
310	cd ${.CURDIR}/libexec;		${MAKE} install
311	cd ${.CURDIR}/usr.bin;		${MAKE} install
312	cd ${.CURDIR}/usr.sbin;		${MAKE} install
313	cd ${.CURDIR}/gnu/libexec;	${MAKE} install
314	cd ${.CURDIR}/gnu/usr.bin;	${MAKE} install
315	cd ${.CURDIR}/gnu/usr.sbin;	${MAKE} install
316
317#
318# ------------------------------------------------------------------------
319#
320# From here onwards are utility targets used by the 'make world' and
321# related targets.  If your 'world' breaks, you may like to try to fix
322# the problem and manually run the following targets to attempt to
323# complete the build.  Beware, this is *not* guaranteed to work, you
324# need to have a pretty good grip on the current state of the system
325# to attempt to manually finish it.  If in doubt, 'make world' again.
326#
327
328#
329# tools - Build tools needed to run the actual build.
330#
331tools::
332.for _tool in games/fortune/strfile gnu/usr.bin/binutils usr.bin/objformat \
333    usr.bin/yacc gnu/usr.bin/bison gnu/usr.bin/cc
334	cd ${.CURDIR}/${_tool}; \
335		${MAKE} obj; \
336		${MAKE} depend; \
337		${MAKE} all; \
338		${MAKE} install
339.endfor
340
341#
342# hierarchy - ensure that all the needed directories are present
343#
344hierarchy:
345	cd ${.CURDIR}/etc;		${MAKE} distrib-dirs
346
347#
348# includes - possibly generate and install the include files.
349#
350includes:
351	cd ${.CURDIR}/include;		${MAKE} SHARED=symlinks -B all install
352	cd ${.CURDIR}/gnu/include;		${MAKE} install
353	cd ${.CURDIR}/gnu/lib/libmp;		${MAKE} beforeinstall
354	cd ${.CURDIR}/gnu/lib/libobjc;		${MAKE} beforeinstall
355	cd ${.CURDIR}/gnu/lib/libreadline;	${MAKE} beforeinstall
356	cd ${.CURDIR}/gnu/lib/libregex;		${MAKE} beforeinstall
357	cd ${.CURDIR}/gnu/lib/libstdc++;	${MAKE} beforeinstall
358	cd ${.CURDIR}/gnu/lib/libdialog;	${MAKE} beforeinstall
359	cd ${.CURDIR}/gnu/lib/libgmp;		${MAKE} beforeinstall
360	cd ${.CURDIR}/gnu/usr.bin/cc/cc1plus;	${MAKE} beforeinstall
361.if exists(${.CURDIR}/secure) && !defined(NOCRYPT)
362	cd ${.CURDIR}/secure/lib/libdes;	${MAKE} beforeinstall
363.endif
364.if exists(${.CURDIR}/kerberosIV) && !defined(NOCRYPT) && \
365    defined(MAKE_KERBEROS4)
366	cd ${.CURDIR}/kerberosIV/lib/libacl;	${MAKE} beforeinstall
367	cd ${.CURDIR}/kerberosIV/lib/libkadm;	${MAKE} beforeinstall
368	cd ${.CURDIR}/kerberosIV/lib/libkafs;	${MAKE} beforeinstall
369	cd ${.CURDIR}/kerberosIV/lib/libkdb;	${MAKE} beforeinstall
370	cd ${.CURDIR}/kerberosIV/lib/libkrb;	${MAKE} beforeinstall
371	cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall
372.else
373	cd ${.CURDIR}/lib/libtelnet;		${MAKE} beforeinstall
374.endif
375.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
376	cd ${.CURDIR}/lib/csu/${MACHINE_ARCH};	${MAKE} beforeinstall
377.endif
378	cd ${.CURDIR}/lib/libalias;		${MAKE} beforeinstall
379	cd ${.CURDIR}/lib/libatm;		${MAKE} beforeinstall
380	cd ${.CURDIR}/lib/libdevstat;		${MAKE} beforeinstall
381	cd ${.CURDIR}/lib/libc;			${MAKE} beforeinstall
382	cd ${.CURDIR}/lib/libcalendar;		${MAKE} beforeinstall
383	cd ${.CURDIR}/lib/libcam;		${MAKE} beforeinstall
384	cd ${.CURDIR}/lib/libdisk;		${MAKE} beforeinstall
385	cd ${.CURDIR}/lib/libedit;		${MAKE} beforeinstall
386	cd ${.CURDIR}/lib/libftpio;		${MAKE} beforeinstall
387	cd ${.CURDIR}/lib/libkvm;		${MAKE} beforeinstall
388	cd ${.CURDIR}/lib/libmd;		${MAKE} beforeinstall
389.if !defined(WANT_CSRG_LIBM)
390	cd ${.CURDIR}/lib/msun;			${MAKE} beforeinstall
391.endif
392	cd ${.CURDIR}/lib/libncp;		${MAKE} beforeinstall
393	cd ${.CURDIR}/lib/libncurses;		${MAKE} beforeinstall
394	cd ${.CURDIR}/lib/libnetgraph;		${MAKE} beforeinstall
395	cd ${.CURDIR}/lib/libopie;		${MAKE} beforeinstall
396	cd ${.CURDIR}/lib/libpam/libpam;	${MAKE} beforeinstall
397	cd ${.CURDIR}/lib/libpcap;		${MAKE} beforeinstall
398	cd ${.CURDIR}/lib/libradius;		${MAKE} beforeinstall
399	cd ${.CURDIR}/lib/librpcsvc;		${MAKE} beforeinstall
400	cd ${.CURDIR}/lib/libskey;		${MAKE} beforeinstall
401	cd ${.CURDIR}/lib/libstand;		${MAKE} beforeinstall
402	cd ${.CURDIR}/lib/libtacplus;		${MAKE} beforeinstall
403	cd ${.CURDIR}/lib/libcom_err;		${MAKE} beforeinstall
404	cd ${.CURDIR}/lib/libss;		${MAKE} -B hdrs beforeinstall
405	cd ${.CURDIR}/lib/libutil;		${MAKE} beforeinstall
406	cd ${.CURDIR}/lib/libvgl;		${MAKE} beforeinstall
407	cd ${.CURDIR}/lib/libwrap;		${MAKE} beforeinstall
408	cd ${.CURDIR}/lib/libz;			${MAKE} beforeinstall
409	cd ${.CURDIR}/usr.bin/lex;		${MAKE} beforeinstall
410
411#
412# libraries - build all libraries, and install them under ${DESTDIR}.
413#
414# The following dependencies exist between the libraries:
415#
416# lib*: csu
417# libatm: libmd
418# libcrypt: libmd
419# libdialog: libncurses
420# libedit: libncurses
421# libg++: libm
422# libkrb: libcrypt
423# libopie: libmd
424# libpam: libcom_err libcrypt libdes libgcc_pic libkrb libradius libskey \
425#	  libtacplus libutil
426# libradius: libmd
427# libreadline: libncurses
428# libskey: libcrypt libmd
429# libss: libcom_err
430# libstc++: libm
431# libtacplus: libmd
432#
433# Across directories this comes down to (rougly):
434#
435# gnu/lib: lib/libm lib/libncurses
436# kerberosIV/lib: lib/libcrypt
437# lib/libpam: secure/lib/libdes kerberosIV/lib/libkrb gnu/lib/libgcc
438# secure/lib: lib/libmd
439#
440.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}.pcc)
441_csu=	lib/csu/${MACHINE_ARCH}.pcc
442.elif ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf"
443_csu=	lib/csu/i386-elf
444.else
445_csu=	lib/csu/${MACHINE_ARCH}
446.endif
447
448.if !defined(NOSECURE) && !defined(NOCRYPT)
449_secure_lib=	secure/lib
450.endif
451
452.if !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
453_kerberosIV_lib=	kerberosIV/lib
454.endif
455
456.if defined(WANT_CSRG_LIBM)
457_libm=	lib/libm
458.else
459_libm=	lib/msun
460.endif
461
462.if !defined(NOPERL)
463_libperl=	gnu/usr.bin/perl/libperl
464.endif
465
466libraries:
467.for _lib in ${_csu} lib/libmd lib/libcrypt ${_secure_lib} ${_kerberosIV_lib} \
468    gnu/lib/libgcc lib/libcom_err ${_libm} lib/libncurses lib/libradius \
469    lib/libskey lib/libtacplus lib/libutil lib gnu/lib ${_libperl} \
470    usr.bin/lex/lib usr.sbin/pcvt/keycap
471.if exists(${.CURDIR}/${_lib})
472	cd ${.CURDIR}/${_lib}; \
473		${MAKE} depend; \
474		${MAKE} all; \
475		${MAKE} install
476.endif
477.endfor
478
479.for __target in clean cleandepend cleandir depend obj
480.for entry in ${SUBDIR}
481${entry}.${__target}__D: .PHONY
482	@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
483		${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
484		edir=${entry}.${MACHINE_ARCH}; \
485		cd ${.CURDIR}/$${edir}; \
486	else \
487		${ECHODIR} "===> ${DIRPRFX}${entry}"; \
488		edir=${entry}; \
489		cd ${.CURDIR}/$${edir}; \
490	fi; \
491	${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
492.endfor
493par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
494.endfor
495
496.include <bsd.subdir.mk>
497