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