Makefile.inc1 revision 63360
1214501Srpaulo#
2214501Srpaulo# $FreeBSD: head/Makefile.inc1 63360 2000-07-18 00:21:05Z ache $
3281806Srpaulo#
4214501Srpaulo# Make command line options:
5252726Srpaulo#	-DMAKE_KERBEROS4 to build KerberosIV
6252726Srpaulo#	-DMAKE_KERBEROS5 to build Kerberos5
7214501Srpaulo#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
8214501Srpaulo#	-DNOCLEAN do not clean at all
9214501Srpaulo#	-DNOCRYPT will prevent building of crypt versions
10214501Srpaulo#	-DNOPROFILE do not build profiled libraries
11214501Srpaulo#	-DNOSECURE do not go into secure subdir
12281806Srpaulo#	-DNOGAMES do not go into games subdir
13281806Srpaulo#	-DNOSHARE do not go into share subdir
14214501Srpaulo#	-DNOINFO do not make or install info files
15214501Srpaulo#	-DNOLIBC_R do not build libc_r.
16214501Srpaulo#	-DNO_FORTRAN do not build g77 and related libraries.
17214501Srpaulo#	-DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
18214501Srpaulo#	-DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
19214501Srpaulo#	LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
20281806Srpaulo
21214501Srpaulo#
22214501Srpaulo# The intended user-driven targets are:
23214501Srpaulo# buildworld  - rebuild *everything*, including glue to help do upgrades
24281806Srpaulo# installworld- install everything built by "buildworld"
25281806Srpaulo# update      - convenient way to update your source tree (eg: sup/cvs)
26281806Srpaulo# most        - build user commands, no libraries or include files
27252726Srpaulo# installmost - install user commands, no libraries or include files
28252726Srpaulo#
29252726Srpaulo# Standard targets (not defined here) are documented in the makefiles in
30252726Srpaulo# /usr/share/mk.  These include:
31252726Srpaulo#		obj depend all install clean cleandepend cleanobj
32252726Srpaulo
33252726Srpaulo# Put initial settings here.
34252726SrpauloSUBDIR=
35252726Srpaulo
36252726Srpaulo# We must do share/info early so that installation of info `dir'
37252726Srpaulo# entries works correctly.  Do it first since it is less likely to
38252726Srpaulo# grow dependencies on include and lib than vice versa.
39214501Srpaulo.if exists(${.CURDIR}/share/info)
40214501SrpauloSUBDIR+= share/info
41281806Srpaulo.endif
42214501Srpaulo
43214501Srpaulo# We must do include and lib early so that the perl *.ph generation
44214501Srpaulo# works correctly as it uses the header files installed by this.
45214501Srpaulo.if exists(${.CURDIR}/include)
46214501SrpauloSUBDIR+= include
47214501Srpaulo.endif
48214501Srpaulo.if exists(${.CURDIR}/lib)
49214501SrpauloSUBDIR+= lib
50214501Srpaulo.endif
51214501Srpaulo
52214501Srpaulo.if exists(${.CURDIR}/bin)
53214501SrpauloSUBDIR+= bin
54214501Srpaulo.endif
55252726Srpaulo.if exists(${.CURDIR}/games) && !defined(NOGAMES)
56252726SrpauloSUBDIR+= games
57252726Srpaulo.endif
58252726Srpaulo.if exists(${.CURDIR}/gnu)
59252726SrpauloSUBDIR+= gnu
60252726Srpaulo.endif
61252726Srpaulo.if exists(${.CURDIR}/kerberosIV) && exists(${.CURDIR}/crypto) && \
62214501Srpaulo    !defined(NOCRYPT) && !defined(NO_OPENSSL) && defined(MAKE_KERBEROS4)
63214501SrpauloSUBDIR+= kerberosIV
64214501Srpaulo.endif
65214501Srpaulo.if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
66214501Srpaulo    !defined(NOCRYPT) && !defined(NO_OPENSSL) && defined(MAKE_KERBEROS5)
67214501SrpauloSUBDIR+= kerberos5
68214501Srpaulo.endif
69214501Srpaulo.if exists(${.CURDIR}/libexec)
70214501SrpauloSUBDIR+= libexec
71214501Srpaulo.endif
72214501Srpaulo.if exists(${.CURDIR}/sbin)
73214501SrpauloSUBDIR+= sbin
74214501Srpaulo.endif
75281806Srpaulo.if exists(${.CURDIR}/share) && !defined(NOSHARE)
76214501SrpauloSUBDIR+= share
77214501Srpaulo.endif
78214501Srpaulo.if exists(${.CURDIR}/sys)
79214501SrpauloSUBDIR+= sys
80214501Srpaulo.endif
81214501Srpaulo.if exists(${.CURDIR}/usr.bin)
82214501SrpauloSUBDIR+= usr.bin
83214501Srpaulo.endif
84214501Srpaulo.if exists(${.CURDIR}/usr.sbin)
85214501SrpauloSUBDIR+= usr.sbin
86214501Srpaulo.endif
87214501Srpaulo.if exists(${.CURDIR}/secure) && !defined(NOCRYPT) && !defined(NOSECURE)
88214501SrpauloSUBDIR+= secure
89214501Srpaulo.endif
90214501Srpaulo
91214501Srpaulo# etc must be last for "distribute" to work
92214501Srpaulo.if exists(${.CURDIR}/etc)
93214501SrpauloSUBDIR+= etc
94214501Srpaulo.endif
95214501Srpaulo
96214501Srpaulo# These are last, since it is nice to at least get the base system
97214501Srpaulo# rebuilt before you do them.
98214501Srpaulo.if defined(LOCAL_DIRS)
99214501Srpaulo.for _DIR in ${LOCAL_DIRS}
100214501Srpaulo.if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile)
101214501SrpauloSUBDIR+= ${_DIR}
102214501Srpaulo.endif
103214501Srpaulo.endfor
104214501Srpaulo.endif
105214501Srpaulo
106214501Srpaulo.if defined(NOCLEANDIR)
107214501SrpauloCLEANDIR=	clean cleandepend
108214501Srpaulo.else
109214501SrpauloCLEANDIR=	cleandir
110214501Srpaulo.endif
111214501Srpaulo
112214501SrpauloSUP?=		cvsup
113214501SrpauloSUPFLAGS?=	-g -L 2 -P -
114214501Srpaulo
115214501SrpauloMAKEOBJDIRPREFIX?=	/usr/obj
116214501SrpauloTARGET_ARCH?=	${MACHINE_ARCH}
117214501SrpauloBUILD_ARCH!=	sysctl -n hw.machine_arch
118214501Srpaulo.if ${BUILD_ARCH} == ${MACHINE_ARCH}
119214501SrpauloOBJTREE=	${MAKEOBJDIRPREFIX}
120214501Srpaulo.else
121214501SrpauloOBJTREE=	${MAKEOBJDIRPREFIX}/${MACHINE_ARCH}
122214501Srpaulo.endif
123281806SrpauloWORLDTMP=	${OBJTREE}${.CURDIR}/${BUILD_ARCH}
124281806Srpaulo# /usr/games added for fortune which depend on strfile
125281806SrpauloSTRICTTMPPATH=	${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
126281806SrpauloTMPPATH=	${STRICTTMPPATH}:${PATH}
127281806Srpaulo
128281806Srpaulo#
129281806Srpaulo# Building a world goes through the following stages
130281806Srpaulo#
131281806Srpaulo# bootstrap-tool stage [BMAKE]
132281806Srpaulo#	This stage is responsible for creating programs that
133281806Srpaulo#	are needed for backward compatibility reasons. They
134281806Srpaulo#	are not built as cross-tools.
135281806Srpaulo# build-tool stage [TMAKE]
136281806Srpaulo#	This stage is responsible for creating the object
137281806Srpaulo#	tree and building any tools that are needed during
138281806Srpaulo#	the build process.
139214501Srpaulo# cross-tool stage [XMAKE]
140214501Srpaulo#	This stage is responsible for creating any tools that
141214501Srpaulo#	are needed for cross-builds. A cross-compiler is one
142214501Srpaulo#	of them.
143214501Srpaulo# world stage [WMAKE]
144214501Srpaulo#	This stage actually builds the world.
145214501Srpaulo# install stage (optional) [IMAKE]
146214501Srpaulo#	This stage installs a previously built world.
147214501Srpaulo#
148214501Srpaulo
149214501Srpaulo# Common environment for bootstrap related stages
150214501SrpauloBOOTSTRAPENV=	MAKEOBJDIRPREFIX=${WORLDTMP} \
151214501Srpaulo		DESTDIR=${WORLDTMP} \
152214501Srpaulo		INSTALL="sh ${.CURDIR}/tools/install.sh" \
153281806Srpaulo		MACHINE_ARCH=${BUILD_ARCH} \
154281806Srpaulo		TOOLS_PREFIX=${WORLDTMP} \
155214501Srpaulo		PATH=${TMPPATH}
156214501Srpaulo
157214501Srpaulo# Common environment for world related stages
158214501SrpauloCROSSENV=	MAKEOBJDIRPREFIX=${OBJTREE} \
159214501Srpaulo		COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \
160214501Srpaulo		LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib \
161214501Srpaulo		OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \
162214501Srpaulo		PERL5LIB=${WORLDTMP}/usr/libdata/perl/5.6.0
163214501Srpaulo
164214501Srpaulo# bootstrap-tool stage
165214501SrpauloBMAKEENV=	${BOOTSTRAPENV}
166252726SrpauloBMAKE=		${BMAKEENV} ${MAKE} -f Makefile.inc1 -DNOMAN -DNOINFO -DNOHTML
167252726Srpaulo
168214501Srpaulo# build-tool stage
169214501SrpauloTMAKEENV=	MAKEOBJDIRPREFIX=${OBJTREE} \
170214501Srpaulo		INSTALL="sh ${.CURDIR}/tools/install.sh" \
171214501Srpaulo		PATH=${TMPPATH}
172214501SrpauloTMAKE=		${TMAKEENV} ${MAKE} -f Makefile.inc1
173214501Srpaulo
174214501Srpaulo# cross-tool stage
175214501SrpauloXMAKEENV=	${BOOTSTRAPENV} \
176214501Srpaulo		TARGET_ARCH=${MACHINE_ARCH}
177214501SrpauloXMAKE=		${XMAKEENV} ${MAKE} -f Makefile.inc1 -DNOMAN -DNOINFO -DNOHTML \
178214501Srpaulo		-DNO_FORTRAN -DNO_GDB
179214501Srpaulo
180214501Srpaulo# world stage
181214501SrpauloWMAKEENV=	${CROSSENV} \
182214501Srpaulo		DESTDIR=${WORLDTMP} \
183214501Srpaulo		INSTALL="sh ${.CURDIR}/tools/install.sh" \
184214501Srpaulo		PATH=${TMPPATH}
185214501SrpauloWMAKE=		${WMAKEENV} ${MAKE} -f Makefile.inc1
186214501Srpaulo
187214501Srpaulo# install stage
188214501SrpauloIMAKEENV=	${CROSSENV}
189214501SrpauloIMAKE=		${IMAKEENV} ${MAKE} -f Makefile.inc1
190214501Srpaulo
191214501SrpauloUSRDIRS=	usr/bin usr/lib/compat/aout usr/games usr/libdata/ldscripts \
192214501Srpaulo		usr/libexec/${OBJFORMAT} usr/sbin usr/share/misc
193214501Srpaulo
194214501Srpaulo.if ${MACHINE_ARCH} == "i386" && ${MACHINE} == "pc98"
195214501SrpauloUSRDIRS+=	usr/libexec/aout
196351611Scy.endif
197214501Srpaulo
198252726SrpauloINCDIRS=	arpa g++/std objc protocols readline rpc rpcsvc openssl \
199252726Srpaulo		security ss
200252726Srpaulo
201252726Srpaulo#
202252726Srpaulo# buildworld
203252726Srpaulo#
204252726Srpaulo# Attempt to rebuild the entire system, with reasonable chance of
205214501Srpaulo# success, regardless of how old your existing system is.
206214501Srpaulo#
207214501Srpaulobuildworld:
208214501Srpaulo.if !defined(NOSECURE) && !defined(NO_OPENSSL) && exists(${.CURDIR}/secure) && \
209214501Srpaulo	(!defined(USA_RESIDENT) || (${USA_RESIDENT} != NO && \
210214501Srpaulo	${USA_RESIDENT} != YES))
211214501Srpaulo	@echo
212252726Srpaulo	@echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
213214501Srpaulo	@echo ">>> You must define the value of USA_RESIDENT as 'YES' or"
214214501Srpaulo	@echo ">>> 'NO' as appropriate, in the environment or /etc/make.conf"
215214501Srpaulo	@echo ">>> before building can proceed."
216214501Srpaulo	@echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
217214501Srpaulo	@/usr/bin/false
218214501Srpaulo.endif
219214501Srpaulo
220252726Srpaulo	@echo
221214501Srpaulo	@echo "--------------------------------------------------------------"
222214501Srpaulo	@echo ">>> Rebuilding the temporary build tree"
223214501Srpaulo	@echo "--------------------------------------------------------------"
224337817Scy.if !defined(NOCLEAN)
225214501Srpaulo	rm -rf ${WORLDTMP}
226214501Srpaulo.else
227214501Srpaulo	for dir in bin games include lib sbin; do \
228214501Srpaulo		rm -rf ${WORLDTMP}/usr/$$dir; \
229214501Srpaulo	done
230214501Srpaulo	rm -f ${WORLDTMP}/sys
231214501Srpaulo	# XXX - Work-around for broken cc/cc_tools/Makefile.
232214501Srpaulo	# This is beyond dirty...
233214501Srpaulo	rm -f ${OBJTREE}${.CURDIR}/gnu/usr.bin/cc/cc_tools/.depend
234337817Scy.endif
235214501Srpaulo.for _dir in ${USRDIRS}
236214501Srpaulo	mkdir -p ${WORLDTMP}/${_dir}
237214501Srpaulo.endfor
238214501Srpaulo.for _dir in ${INCDIRS}
239214501Srpaulo	mkdir -p ${WORLDTMP}/usr/include/${_dir}
240214501Srpaulo.endfor
241214501Srpaulo	ln -sf ${.CURDIR}/sys ${WORLDTMP}/sys
242214501Srpaulo	@echo
243214501Srpaulo	@echo "--------------------------------------------------------------"
244214501Srpaulo	@echo ">>> stage 1: bootstrap tools"
245214501Srpaulo	@echo "--------------------------------------------------------------"
246214501Srpaulo	cd ${.CURDIR}; ${BMAKE} bootstrap-tools
247214501Srpaulo.if !defined(NOCLEAN)
248214501Srpaulo	@echo
249214501Srpaulo	@echo "--------------------------------------------------------------"
250214501Srpaulo	@echo ">>> stage 2: cleaning up the object tree"
251214501Srpaulo	@echo "--------------------------------------------------------------"
252214501Srpaulo	cd ${.CURDIR}; ${TMAKE} ${CLEANDIR:S/^/par-/}
253214501Srpaulo.endif
254214501Srpaulo	@echo
255214501Srpaulo	@echo "--------------------------------------------------------------"
256214501Srpaulo	@echo ">>> stage 2: rebuilding the object tree"
257214501Srpaulo	@echo "--------------------------------------------------------------"
258214501Srpaulo	cd ${.CURDIR}; ${TMAKE} par-obj
259214501Srpaulo	@echo
260214501Srpaulo	@echo "--------------------------------------------------------------"
261281806Srpaulo	@echo ">>> stage 2: build tools"
262346981Scy	@echo "--------------------------------------------------------------"
263346981Scy	cd ${.CURDIR}; ${TMAKE} build-tools
264214501Srpaulo	@echo
265214501Srpaulo	@echo "--------------------------------------------------------------"
266346981Scy	@echo ">>> stage 3: cross tools"
267346981Scy	@echo "--------------------------------------------------------------"
268346981Scy	cd ${.CURDIR}; ${XMAKE} cross-tools
269346981Scy	@echo
270346981Scy	@echo "--------------------------------------------------------------"
271214501Srpaulo	@echo ">>> stage 4: populating ${WORLDTMP}/usr/include"
272214501Srpaulo	@echo "--------------------------------------------------------------"
273214501Srpaulo	cd ${.CURDIR}; ${WMAKE} SHARED=symlinks includes
274214501Srpaulo	@echo
275214501Srpaulo	@echo "--------------------------------------------------------------"
276214501Srpaulo	@echo ">>> stage 4: building libraries"
277214501Srpaulo	@echo "--------------------------------------------------------------"
278214501Srpaulo	cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries
279214501Srpaulo	@echo
280214501Srpaulo	@echo "--------------------------------------------------------------"
281214501Srpaulo	@echo ">>> stage 4: make dependencies"
282214501Srpaulo	@echo "--------------------------------------------------------------"
283214501Srpaulo	cd ${.CURDIR}; ${WMAKE} par-depend
284214501Srpaulo	@echo
285214501Srpaulo	@echo "--------------------------------------------------------------"
286214501Srpaulo	@echo ">>> stage 4: building everything.."
287214501Srpaulo	@echo "--------------------------------------------------------------"
288214501Srpaulo	cd ${.CURDIR}; ${WMAKE} all
289214501Srpaulo
290214501Srpauloeverything:
291214501Srpaulo	@echo "--------------------------------------------------------------"
292214501Srpaulo	@echo ">>> Building everything.."
293281806Srpaulo	@echo "--------------------------------------------------------------"
294214501Srpaulo	cd ${.CURDIR}; ${WMAKE} all
295214501Srpaulo
296214501Srpaulo#
297214501Srpaulo# installworld
298214501Srpaulo#
299214501Srpaulo# Installs everything compiled by a 'buildworld'.
300214501Srpaulo#
301214501Srpauloinstallworld:
302214501Srpaulo	cd ${.CURDIR}; ${IMAKE} reinstall
303214501Srpaulo
304214501Srpaulo#
305214501Srpaulo# reinstall
306214501Srpaulo#
307214501Srpaulo# If you have a build server, you can NFS mount the source and obj directories
308214501Srpaulo# and do a 'make reinstall' on the *client* to install new binaries from the
309214501Srpaulo# most recent server build.
310214501Srpaulo#
311214501Srpauloreinstall:
312214501Srpaulo	@echo "--------------------------------------------------------------"
313214501Srpaulo	@echo ">>> Making hierarchy"
314214501Srpaulo	@echo "--------------------------------------------------------------"
315214501Srpaulo	cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
316281806Srpaulo	@echo
317281806Srpaulo	@echo "--------------------------------------------------------------"
318281806Srpaulo	@echo ">>> Installing everything.."
319281806Srpaulo	@echo "--------------------------------------------------------------"
320281806Srpaulo	cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
321281806Srpaulo.if !defined(NOMAN)
322281806Srpaulo	@echo
323281806Srpaulo	@echo "--------------------------------------------------------------"
324281806Srpaulo	@echo ">>> Rebuilding man page indices"
325214501Srpaulo	@echo "--------------------------------------------------------------"
326214501Srpaulo	cd ${.CURDIR}/share/man; ${MAKE} makedb
327214501Srpaulo.endif
328214501Srpaulo
329214501Srpaulo#
330214501Srpaulo# buildkernel and installkernel
331214501Srpaulo#
332214501Srpaulo# Which kernels to build and/or install is specified by setting
333214501Srpaulo# KERNEL. If not defined a GENERIC kernel is built/installed.
334214501Srpaulo# Only the existing (depending MACHINE) config files are used
335214501Srpaulo# for building kernels and only the first of these is designated
336214501Srpaulo# as the one being installed.
337214501Srpaulo#
338214501Srpaulo# Note that we have to use MACHINE instead of MACHINE_ARCH when
339214501Srpaulo# we're in kernel-land. Since only MACHINE_ARCH is (expected) to
340214501Srpaulo# be set to cross-build, we have to make sure MACHINE is set
341281806Srpaulo# properly.
342281806Srpaulo
343281806SrpauloKERNEL?=	GENERIC
344281806Srpaulo
345281806Srpaulo# The only exotic MACHINE_ARCH/MACHINE combination valid at this
346281806Srpaulo# time is i386/pc98. In all other cases set MACHINE equal to
347281806Srpaulo# MACHINE_ARCH.
348252726Srpaulo.if ${MACHINE_ARCH} != "i386" || ${MACHINE} != "pc98"
349252726SrpauloMACHINE=	${MACHINE_ARCH}
350252726Srpaulo.endif
351252726Srpaulo
352252726SrpauloKRNLSRCDIR=	${.CURDIR}/sys
353252726SrpauloKRNLCONFDIR=	${KRNLSRCDIR}/${MACHINE}/conf
354252726SrpauloKRNLOBJDIR=	${OBJTREE}${KRNLSRCDIR}
355252726Srpaulo
356252726Srpaulo.if !defined(NOCLEAN)
357252726SrpauloCONFIGARGS+=	-r
358252726Srpaulo.endif
359252726Srpaulo
360252726SrpauloBUILDKERNELS=
361252726SrpauloINSTALLKERNEL=
362252726Srpaulo.for _kernel in ${KERNEL}
363252726Srpaulo.if exists(${KRNLCONFDIR}/${_kernel})
364252726SrpauloBUILDKERNELS+=	${_kernel}
365252726Srpaulo.if empty(INSTALLKERNEL)
366252726SrpauloINSTALLKERNEL= ${_kernel}
367252726Srpaulo.endif
368252726Srpaulo.endif
369252726Srpaulo.endfor
370252726Srpaulo
371252726Srpaulo#
372252726Srpaulo# buildkernel
373252726Srpaulo#
374252726Srpaulo# Builds all kernels defined by BUILDKERNELS.
375252726Srpaulo#
376252726Srpaulobuildkernel:
377252726Srpaulo	@echo
378252726Srpaulo	@echo "--------------------------------------------------------------"
379252726Srpaulo	@echo ">>> Rebuilding kernel(s)"
380252726Srpaulo	@echo "--------------------------------------------------------------"
381252726Srpaulo.for _kernel in ${BUILDKERNELS}
382252726Srpaulo	@echo "===> ${_kernel}"
383252726Srpaulo	mkdir -p ${KRNLOBJDIR}
384252726Srpaulo.if !defined(NO_KERNELCONFIG)
385252726Srpaulo	cd ${KRNLCONFDIR}; \
386252726Srpaulo		PATH=${TMPPATH} \
387252726Srpaulo		    config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} ${_kernel}
388252726Srpaulo.endif
389252726Srpaulo	cd ${KRNLOBJDIR}/${_kernel}; \
390252726Srpaulo		MAKESRCPATH=${KRNLSRCDIR}/dev/aic7xxx \
391252726Srpaulo		    ${MAKE} -f ${KRNLSRCDIR}/dev/aic7xxx/Makefile
392252726Srpaulo.if !defined(NO_KERNELDEPEND)
393252726Srpaulo	cd ${KRNLOBJDIR}/${_kernel}; \
394252726Srpaulo		${WMAKEENV} MACHINE=${MACHINE} KERNEL=${_kernel} \
395252726Srpaulo		    ${MAKE} depend
396252726Srpaulo.endif
397252726Srpaulo	cd ${KRNLOBJDIR}/${_kernel}; \
398252726Srpaulo		${WMAKEENV} MACHINE=${MACHINE} KERNEL=${_kernel} ${MAKE} all
399252726Srpaulo.endfor
400252726Srpaulo
401252726Srpaulo#
402252726Srpaulo# installkernel
403252726Srpaulo#
404252726Srpaulo# Install the kernel defined by INSTALLKERNEL
405252726Srpaulo#
406252726Srpauloinstallkernel:
407252726Srpaulo	cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
408252726Srpaulo		${IMAKEENV} MACHINE=${MACHINE} KERNEL=${INSTALLKERNEL} \
409252726Srpaulo		    ${MAKE} KERNEL=${INSTALLKERNEL} install
410252726Srpaulo
411252726Srpaulo#
412252726Srpaulo# update
413214501Srpaulo#
414337817Scy# Update the source tree, by running sup and/or running cvs to update to the
415214501Srpaulo# latest copy.
416214501Srpaulo#
417346981Scyupdate:
418346981Scy.if defined(SUP_UPDATE)
419346981Scy	@echo "--------------------------------------------------------------"
420346981Scy	@echo ">>> Running ${SUP}"
421346981Scy	@echo "--------------------------------------------------------------"
422346981Scy.if defined(SUPFILE)
423346981Scy	@${SUP} ${SUPFLAGS} ${SUPFILE}
424346981Scy.endif
425346981Scy.if defined(SUPFILE1)
426214501Srpaulo	@${SUP} ${SUPFLAGS} ${SUPFILE1}
427214501Srpaulo.endif
428214501Srpaulo.if defined(SUPFILE2)
429214501Srpaulo	@${SUP} ${SUPFLAGS} ${SUPFILE2}
430214501Srpaulo.endif
431214501Srpaulo.if defined(PORTSSUPFILE)
432214501Srpaulo	@${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
433214501Srpaulo.endif
434214501Srpaulo.endif
435214501Srpaulo.if defined(CVS_UPDATE)
436337817Scy	@echo "--------------------------------------------------------------"
437346981Scy	@echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
438346981Scy	@echo "--------------------------------------------------------------"
439214501Srpaulo	cd ${.CURDIR}; cvs -q update -A -P -d
440346981Scy.endif
441214501Srpaulo
442214501Srpaulo#
443214501Srpaulo# most
444214501Srpaulo#
445214501Srpaulo# Build most of the user binaries on the existing system libs and includes.
446252726Srpaulo#
447252726Srpaulomost:
448214501Srpaulo	@echo "--------------------------------------------------------------"
449214501Srpaulo	@echo ">>> Building programs only"
450214501Srpaulo	@echo "--------------------------------------------------------------"
451214501Srpaulo	cd ${.CURDIR}/bin;		${MAKE} all
452214501Srpaulo	cd ${.CURDIR}/sbin;		${MAKE} all
453214501Srpaulo	cd ${.CURDIR}/libexec;		${MAKE} all
454214501Srpaulo	cd ${.CURDIR}/usr.bin;		${MAKE} all
455281806Srpaulo	cd ${.CURDIR}/usr.sbin;		${MAKE} all
456214501Srpaulo	cd ${.CURDIR}/gnu/libexec;	${MAKE} all
457214501Srpaulo	cd ${.CURDIR}/gnu/usr.bin;	${MAKE} all
458214501Srpaulo	cd ${.CURDIR}/gnu/usr.sbin;	${MAKE} all
459214501Srpaulo
460214501Srpaulo#
461214501Srpaulo# installmost
462346981Scy#
463214501Srpaulo# Install the binaries built by the 'most' target.  This does not include
464214501Srpaulo# libraries or include files.
465214501Srpaulo#
466214501Srpauloinstallmost:
467346981Scy	@echo "--------------------------------------------------------------"
468214501Srpaulo	@echo ">>> Installing programs only"
469214501Srpaulo	@echo "--------------------------------------------------------------"
470214501Srpaulo	cd ${.CURDIR}/bin;		${MAKE} install
471214501Srpaulo	cd ${.CURDIR}/sbin;		${MAKE} install
472214501Srpaulo	cd ${.CURDIR}/libexec;		${MAKE} install
473214501Srpaulo	cd ${.CURDIR}/usr.bin;		${MAKE} install
474214501Srpaulo	cd ${.CURDIR}/usr.sbin;		${MAKE} install
475214501Srpaulo	cd ${.CURDIR}/gnu/libexec;	${MAKE} install
476214501Srpaulo	cd ${.CURDIR}/gnu/usr.bin;	${MAKE} install
477214501Srpaulo	cd ${.CURDIR}/gnu/usr.sbin;	${MAKE} install
478214501Srpaulo
479214501Srpaulo#
480214501Srpaulo# ------------------------------------------------------------------------
481214501Srpaulo#
482214501Srpaulo# From here onwards are utility targets used by the 'make world' and
483281806Srpaulo# related targets.  If your 'world' breaks, you may like to try to fix
484214501Srpaulo# the problem and manually run the following targets to attempt to
485281806Srpaulo# complete the build.  Beware, this is *not* guaranteed to work, you
486281806Srpaulo# need to have a pretty good grip on the current state of the system
487281806Srpaulo# to attempt to manually finish it.  If in doubt, 'make world' again.
488214501Srpaulo#
489281806Srpaulo
490252726Srpaulo#
491252726Srpaulo# bootstrap-tools: Build tools needed for compatibility
492281806Srpaulo#
493281806Srpaulo.if exists(${.CURDIR}/games) && !defined(NOGAMES)
494281806Srpaulo_strfile=	games/fortune/strfile
495281806Srpaulo.endif
496281806Srpaulo
497281806Srpaulobootstrap-tools:
498281806Srpaulo.for _tool in ${_strfile} usr.bin/yacc usr.bin/colldef usr.sbin/config \
499281806Srpaulo    gnu/usr.bin/gperf gnu/usr.bin/texinfo
500281806Srpaulo	cd ${.CURDIR}/${_tool}; \
501281806Srpaulo		${MAKE} obj; \
502281806Srpaulo		${MAKE} depend; \
503281806Srpaulo		${MAKE} all; \
504281806Srpaulo		${MAKE} install
505281806Srpaulo.endfor
506281806Srpaulo
507281806Srpaulo#
508281806Srpaulo# build-tools: Build special purpose build tools
509281806Srpaulo#
510281806Srpaulo.if exists(${.CURDIR}/games) && !defined(NOGAMES)
511281806Srpaulo_games=	games/adventure games/hack games/phantasia
512281806Srpaulo.endif
513281806Srpaulo
514281806Srpaulo.if exists(${.CURDIR}/share) && !defined(NOSHARE)
515281806Srpaulo_share=	share/syscons/scrnmaps
516281806Srpaulo.endif
517281806Srpaulo
518281806Srpaulo.if !defined(NO_FORTRAN)
519281806Srpaulo_fortran= gnu/usr.bin/cc/f771
520281806Srpaulo.endif
521281806Srpaulo
522281806Srpaulo.if exists(${.CURDIR}/kerberosIV) && exists(${.CURDIR}/crypto) && \
523281806Srpaulo    !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
524281806Srpaulo_libroken4= kerberosIV/lib/libroken
525281806Srpaulo.endif
526281806Srpaulo
527281806Srpaulo.if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
528281806Srpaulo    !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
529281806Srpaulo_libkrb5= kerberos5/lib/libroken kerberos5/lib/libasn1 kerberos5/lib/libhdb \
530281806Srpaulo	kerberos5/lib/libsl
531252726Srpaulo.endif
532252726Srpaulo
533281806Srpaulo.if !defined(NOPERL)
534281806Srpaulo_perl=	gnu/usr.bin/perl
535214501Srpaulo.endif
536214501Srpaulo
537281806Srpaulobuild-tools:
538281806Srpaulo.for _tool in bin/sh ${_games} gnu/usr.bin/cc/cc_tools ${_fortran} \
539281806Srpaulo    ${_libroken4} ${_libkrb5} lib/libncurses ${_share} ${_perl}
540281806Srpaulo	cd ${.CURDIR}/${_tool}; ${MAKE} build-tools
541214501Srpaulo.endfor
542214501Srpaulo
543214501Srpaulo#
544281806Srpaulo# cross-tools: Build cross-building tools
545214501Srpaulo#
546281806Srpaulo# WARNING: Because the bootstrap tools are expected to run on the
547281806Srpaulo# build-machine, MACHINE_ARCH is *always* set to BUILD_ARCH when this
548214501Srpaulo# target is being made. TARGET_ARCH is *always* set to reflect the
549281806Srpaulo# target-machine (which you can set by specifying MACHINE_ARCH on
550281806Srpaulo# make's command-line, get it?).
551281806Srpaulo# The reason is simple: we build these tools not to be run on the
552281806Srpaulo# architecture we're cross-building, but on the architecture we're
553281806Srpaulo# currently building on (ie the host-machine) and we expect these
554281806Srpaulo# tools to produce output for the architecture we're trying to
555281806Srpaulo# cross-build.
556281806Srpaulo#
557281806Srpaulo.if ${TARGET_ARCH} == "alpha" && ${MACHINE_ARCH} != "alpha"
558281806Srpaulo_elf2exe=	usr.sbin/elf2exe
559281806Srpaulo.endif
560281806Srpaulo
561281806Srpaulo.if ${TARGET_ARCH} == "i386" && ${MACHINE_ARCH} != "i386"
562281806Srpaulo_btxld=	usr.sbin/btxld
563281806Srpaulo.endif
564281806Srpaulo
565281806Srpaulo# XXX - MACHINE should actually be TARGET. But we don't set that...
566281806Srpaulo.if ${TARGET_ARCH} == "i386" && ${MACHINE} == "pc98"
567281806Srpaulo_aout_tools=	usr.bin/size usr.bin/strip gnu/usr.bin/as gnu/usr.bin/ld
568281806Srpaulo.endif
569281806Srpaulo
570281806Srpaulocross-tools:
571281806Srpaulo.for _tool in ${_aout_tools} ${_btxld} ${_elf2exe} usr.bin/genassym \
572281806Srpaulo    usr.bin/gensetdefs gnu/usr.bin/binutils usr.bin/objformat gnu/usr.bin/cc \
573281806Srpaulo    usr.sbin/mtree
574281806Srpaulo	cd ${.CURDIR}/${_tool}; \
575281806Srpaulo		${MAKE} obj; \
576281806Srpaulo		${MAKE} depend; \
577281806Srpaulo		${MAKE} all; \
578281806Srpaulo		${MAKE} install
579281806Srpaulo.endfor
580281806Srpaulo
581289549Srpaulo#
582289549Srpaulo# hierarchy - ensure that all the needed directories are present
583289549Srpaulo#
584281806Srpaulohierarchy:
585281806Srpaulo	cd ${.CURDIR}/etc;		${MAKE} distrib-dirs
586281806Srpaulo
587281806Srpaulo#
588281806Srpaulo# includes - possibly generate and install the include files.
589281806Srpaulo#
590281806Srpauloincludes:
591214501Srpaulo	cd ${.CURDIR}/include;			${MAKE} -B all install
592281806Srpaulo	cd ${.CURDIR}/gnu/include;		${MAKE} install
593281806Srpaulo	cd ${.CURDIR}/gnu/lib/libmp;		${MAKE} beforeinstall
594281806Srpaulo	cd ${.CURDIR}/gnu/lib/libobjc;		${MAKE} beforeinstall
595281806Srpaulo	cd ${.CURDIR}/gnu/lib/libreadline/readline;	${MAKE} beforeinstall
596281806Srpaulo	cd ${.CURDIR}/gnu/lib/libregex;		${MAKE} beforeinstall
597281806Srpaulo	cd ${.CURDIR}/gnu/lib/libstdc++;	${MAKE} beforeinstall
598281806Srpaulo	cd ${.CURDIR}/gnu/lib/libdialog;	${MAKE} beforeinstall
599281806Srpaulo	cd ${.CURDIR}/gnu/lib/libgmp;		${MAKE} beforeinstall
600281806Srpaulo	cd ${.CURDIR}/gnu/usr.bin/cc/cc1plus;	${MAKE} beforeinstall
601281806Srpaulo.if exists(${.CURDIR}/secure) && !defined(NOCRYPT)
602281806Srpaulo.if exists(${.CURDIR}/secure/lib/libcrypto)
603281806Srpaulo	cd ${.CURDIR}/secure/lib/libcrypto;	${MAKE} beforeinstall
604281806Srpaulo.endif
605214501Srpaulo.if exists(${.CURDIR}/secure/lib/libssl)
606214501Srpaulo	cd ${.CURDIR}/secure/lib/libssl;	${MAKE} beforeinstall
607281806Srpaulo.endif
608281806Srpaulo.endif
609281806Srpaulo.if exists(${.CURDIR}/kerberosIV) && !defined(NOCRYPT) && \
610281806Srpaulo    defined(MAKE_KERBEROS4)
611281806Srpaulo	cd ${.CURDIR}/kerberosIV/lib/libacl;	${MAKE} beforeinstall
612281806Srpaulo	cd ${.CURDIR}/kerberosIV/lib/libkadm;	${MAKE} beforeinstall
613281806Srpaulo	cd ${.CURDIR}/kerberosIV/lib/libkafs;	${MAKE} beforeinstall
614281806Srpaulo	cd ${.CURDIR}/kerberosIV/lib/libkdb;	${MAKE} beforeinstall
615281806Srpaulo	cd ${.CURDIR}/kerberosIV/lib/libkrb;	${MAKE} beforeinstall
616281806Srpaulo	cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall
617214501Srpaulo.else
618281806Srpaulo	cd ${.CURDIR}/lib/libtelnet;		${MAKE} beforeinstall
619281806Srpaulo.endif
620281806Srpaulo.if exists(${.CURDIR}/kerberos5) && !defined(NOCRYPT) && \
621281806Srpaulo    defined(MAKE_KERBEROS5)
622281806Srpaulo	cd ${.CURDIR}/kerberos5/lib/libasn1;		${MAKE} beforeinstall
623281806Srpaulo	cd ${.CURDIR}/kerberos5/lib/libhdb;		${MAKE} beforeinstall
624281806Srpaulo	cd ${.CURDIR}/kerberos5/lib/libkadm5clnt;	${MAKE} beforeinstall
625281806Srpaulo	cd ${.CURDIR}/kerberos5/lib/libkadm5srv;	${MAKE} beforeinstall
626214501Srpaulo	cd ${.CURDIR}/kerberos5/lib/libkafs5;		${MAKE} beforeinstall
627214501Srpaulo	cd ${.CURDIR}/kerberos5/lib/libkrb5;		${MAKE} beforeinstall
628281806Srpaulo	cd ${.CURDIR}/kerberos5/lib/libsl;		${MAKE} beforeinstall
629281806Srpaulo.endif
630214501Srpaulo.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
631281806Srpaulo	cd ${.CURDIR}/lib/csu/${MACHINE_ARCH};	${MAKE} beforeinstall
632214501Srpaulo.endif
633214501Srpaulo	cd ${.CURDIR}/lib/libalias;		${MAKE} beforeinstall
634214501Srpaulo	cd ${.CURDIR}/lib/libatm;		${MAKE} beforeinstall
635252726Srpaulo	cd ${.CURDIR}/lib/libdevstat;		${MAKE} beforeinstall
636252726Srpaulo	cd ${.CURDIR}/lib/libc;			${MAKE} beforeinstall
637252726Srpaulo	cd ${.CURDIR}/lib/libcalendar;		${MAKE} beforeinstall
638252726Srpaulo	cd ${.CURDIR}/lib/libcam;		${MAKE} beforeinstall
639252726Srpaulo	cd ${.CURDIR}/lib/libdisk;		${MAKE} beforeinstall
640252726Srpaulo	cd ${.CURDIR}/lib/libedit;		${MAKE} beforeinstall
641252726Srpaulo	cd ${.CURDIR}/lib/libftpio;		${MAKE} beforeinstall
642252726Srpaulo	cd ${.CURDIR}/lib/libkvm;		${MAKE} beforeinstall
643252726Srpaulo	cd ${.CURDIR}/lib/libmd;		${MAKE} beforeinstall
644252726Srpaulo.if !defined(WANT_CSRG_LIBM)
645252726Srpaulo	cd ${.CURDIR}/lib/msun;			${MAKE} beforeinstall
646252726Srpaulo.endif
647252726Srpaulo	cd ${.CURDIR}/lib/libncp;		${MAKE} beforeinstall
648252726Srpaulo	cd ${.CURDIR}/lib/libncurses;		${MAKE} beforeinstall
649252726Srpaulo	cd ${.CURDIR}/lib/libnetgraph;		${MAKE} beforeinstall
650252726Srpaulo	cd ${.CURDIR}/lib/libopie;		${MAKE} beforeinstall
651252726Srpaulo	cd ${.CURDIR}/lib/libpam/libpam;	${MAKE} beforeinstall
652252726Srpaulo	cd ${.CURDIR}/lib/libpcap;		${MAKE} beforeinstall
653252726Srpaulo	cd ${.CURDIR}/lib/libradius;		${MAKE} beforeinstall
654252726Srpaulo	cd ${.CURDIR}/lib/librpcsvc;		${MAKE} beforeinstall
655252726Srpaulo	cd ${.CURDIR}/lib/libskey;		${MAKE} beforeinstall
656252726Srpaulo	cd ${.CURDIR}/lib/libstand;		${MAKE} beforeinstall
657252726Srpaulo	cd ${.CURDIR}/lib/libtacplus;		${MAKE} beforeinstall
658252726Srpaulo	cd ${.CURDIR}/lib/libcom_err;		${MAKE} beforeinstall
659252726Srpaulo	cd ${.CURDIR}/lib/libss;		${MAKE} -B hdrs beforeinstall
660252726Srpaulo	cd ${.CURDIR}/lib/libutil;		${MAKE} beforeinstall
661252726Srpaulo	cd ${.CURDIR}/lib/libvgl;		${MAKE} beforeinstall
662252726Srpaulo	cd ${.CURDIR}/lib/libwrap;		${MAKE} beforeinstall
663252726Srpaulo	cd ${.CURDIR}/lib/libz;			${MAKE} beforeinstall
664252726Srpaulo	cd ${.CURDIR}/usr.bin/lex;		${MAKE} beforeinstall
665252726Srpaulo
666252726Srpaulo#
667252726Srpaulo# libraries - build all libraries, and install them under ${DESTDIR}.
668252726Srpaulo#
669252726Srpaulo# The following dependencies exist between the libraries:
670252726Srpaulo#
671252726Srpaulo# lib*: csu
672252726Srpaulo# libatm: libmd
673252726Srpaulo# libcrypt: libmd
674252726Srpaulo# libdialog: libncurses
675337817Scy# libedit: libncurses
676337817Scy# libg++: libm
677214501Srpaulo# libkrb: libcrypt
678214501Srpaulo# libopie: libmd
679214501Srpaulo# libpam: libcom_err libcrypt libcrypto libgcc_pic libkrb libopie libradius \
680214501Srpaulo#	  libskey libtacplus libutil libz libssh
681214501Srpaulo# libradius: libmd
682214501Srpaulo# libreadline: libncurses
683214501Srpaulo# libskey: libcrypt libmd
684214501Srpaulo# libss: libcom_err
685337817Scy# libstc++: libm
686214501Srpaulo# libtacplus: libmd
687214501Srpaulo#
688214501Srpaulo# Across directories this comes down to (rougly):
689214501Srpaulo#
690214501Srpaulo# gnu/lib: lib/libm lib/libncurses
691214501Srpaulo# kerberosIV/lib kerberos5/lib: lib/libcrypt
692214501Srpaulo# lib/libpam: secure/lib/libcrypto kerberosIV/lib/libkrb gnu/lib/libgcc \
693214501Srpaulo#             secure/lib/libssh lib/libz
694214501Srpaulo# secure/lib: lib/libmd
695214501Srpaulo#
696214501Srpaulo.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}.pcc)
697214501Srpaulo_csu=	lib/csu/${MACHINE_ARCH}.pcc
698214501Srpaulo.elif ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf"
699214501Srpaulo_csu=	lib/csu/i386-elf
700214501Srpaulo.else
701214501Srpaulo_csu=	lib/csu/${MACHINE_ARCH}
702214501Srpaulo.endif
703214501Srpaulo
704214501Srpaulo.if !defined(NOSECURE) && !defined(NOCRYPT)
705214501Srpaulo_secure_lib=	secure/lib
706214501Srpaulo.endif
707214501Srpaulo
708289549Srpaulo.if !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
709289549Srpaulo_kerberosIV_lib=	kerberosIV/lib
710214501Srpaulo.endif
711214501Srpaulo
712214501Srpaulo.if !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
713214501Srpaulo_kerberos5_lib=	kerberos5/lib
714214501Srpaulo.endif
715214501Srpaulo
716214501Srpaulo.if defined(WANT_CSRG_LIBM)
717214501Srpaulo_libm=	lib/libm
718214501Srpaulo.else
719214501Srpaulo_libm=	lib/msun
720214501Srpaulo.endif
721214501Srpaulo
722214501Srpaulo.if ${MACHINE_ARCH} == "i386"
723214501Srpaulo_libkeycap=	usr.sbin/pcvt/keycap
724214501Srpaulo.endif
725214501Srpaulo
726214501Srpaulolibraries:
727214501Srpaulo.for _lib in ${_csu} lib/libmd lib/libcrypt ${_secure_lib} ${_kerberosIV_lib} \
728214501Srpaulo    ${_kerberos5_lib} gnu/lib/libgcc lib/libcom_err ${_libm} lib/libncurses \
729214501Srpaulo    lib/libopie lib/libradius lib/libskey lib/libtacplus lib/libutil \
730214501Srpaulo    lib/libz lib gnu/lib \
731214501Srpaulo    ${_libperl} usr.bin/lex/lib ${_libkeycap}
732214501Srpaulo.if exists(${.CURDIR}/${_lib})
733214501Srpaulo	cd ${.CURDIR}/${_lib}; \
734214501Srpaulo		${MAKE} depend; \
735214501Srpaulo		${MAKE} all; \
736214501Srpaulo		${MAKE} install
737214501Srpaulo.endif
738214501Srpaulo.endfor
739214501Srpaulo
740214501Srpaulo.for __target in clean cleandepend cleandir depend obj
741214501Srpaulo.for entry in ${SUBDIR}
742214501Srpaulo${entry}.${__target}__D: .PHONY
743214501Srpaulo	@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
744214501Srpaulo		${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
745214501Srpaulo		edir=${entry}.${MACHINE_ARCH}; \
746214501Srpaulo		cd ${.CURDIR}/$${edir}; \
747214501Srpaulo	else \
748214501Srpaulo		${ECHODIR} "===> ${DIRPRFX}${entry}"; \
749214501Srpaulo		edir=${entry}; \
750214501Srpaulo		cd ${.CURDIR}/$${edir}; \
751214501Srpaulo	fi; \
752214501Srpaulo	${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
753214501Srpaulo.endfor
754214501Srpaulopar-${__target}: ${SUBDIR:S/$/.${__target}__D/}
755214501Srpaulo.endfor
756214501Srpaulo
757214501Srpaulo.include <bsd.subdir.mk>
758214501Srpaulo