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