Makefile revision 17234
1139776Simp#
2230132Suqs#	$Id: Makefile,v 1.89 1996/07/01 06:13:31 jkh Exp $
387321Sdes#
487321Sdes# Make command line options:
587321Sdes#	-DCLOBBER will remove /usr/include
687321Sdes#	-DMAKE_LOCAL to add ./local to the SUBDIR list
787321Sdes#	-DMAKE_PORTS to add ./ports to the SUBDIR list
887321Sdes#	-DMAKE_EBONES to build eBones (KerberosIV)
987321Sdes#
1087321Sdes#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
1187321Sdes#	-DNOCLEAN do not clean at all
1287321Sdes#	-DNOCRYPT will prevent building of crypt versions
1387321Sdes#	-DNOLKM do not build loadable kernel modules
1487321Sdes#	-DNOOBJDIR do not run ``${MAKE} obj''
1587321Sdes#	-DNOPROFILE do not build profiled libraries
1687321Sdes#	-DNOSECURE do not go into secure subdir
1787321Sdes
1887321Sdes# Put initial settings here.
1987321SdesSUBDIR=
2087321Sdes
2187321Sdes# We must do include and lib first so that the perl *.ph generation
2287321Sdes# works correctly as it uses the header files installed by this.
2387321Sdes.if exists(include)
2487321SdesSUBDIR+= include
2587321Sdes.endif
2687321Sdes.if exists(lib)
2787321SdesSUBDIR+= lib
2887321Sdes.endif
2987321Sdes
3087321Sdes.if exists(bin)
3187321SdesSUBDIR+= bin
3287321Sdes.endif
3387321Sdes#.if exists(contrib)
3487321Sdes#SUBDIR+= contrib
3587321Sdes#.endif
3687321Sdes.if exists(games)
3787321SdesSUBDIR+= games
3887321Sdes.endif
3987321Sdes.if exists(gnu)
4087321SdesSUBDIR+= gnu
4187321Sdes.endif
4287321Sdes.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
4387321SdesSUBDIR+= eBones
4487321Sdes.endif
4587321Sdes.if exists(libexec)
4687321SdesSUBDIR+= libexec
4787321Sdes.endif
4887321Sdes.if exists(sbin)
4987321SdesSUBDIR+= sbin
5087321Sdes.endif
5187321Sdes.if exists(share)
5287321SdesSUBDIR+= share
5387321Sdes.endif
5487321Sdes.if exists(sys)
5587321SdesSUBDIR+= sys
5687321Sdes.endif
5787321Sdes.if exists(usr.bin)
5887321SdesSUBDIR+= usr.bin
5987321Sdes.endif
6087321Sdes.if exists(usr.sbin)
6187321SdesSUBDIR+= usr.sbin
6287321Sdes.endif
6387321Sdes.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
6487321SdesSUBDIR+= secure
6587321Sdes.endif
6687321Sdes.if exists(lkm) && !defined(NOLKM)
6787538SdesSUBDIR+= lkm
6887321Sdes.endif
6987321Sdes
70224915Skib# etc must be last for "distribute" to work
71224915Skib.if exists(etc) && make(distribute)
72166548SkibSUBDIR+= etc
73224915Skib.endif
7487321Sdes
75224915Skib# These are last, since it is nice to at least get the base system
76184652Sjhb# rebuilt before you do them.
77166548Skib.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
78184652SjhbSUBDIR+= local
79184652Sjhb.endif
80224915Skib.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
81166548SkibSUBDIR+= ports
82224915Skib.endif
83224915Skib
84224915Skib# Handle the -DNOOBJDIR and -DNOCLEANDIR
8587321Sdes.if defined(NOOBJDIR)
86224915SkibOBJDIR=
8787321Sdes.else
8887321SdesOBJDIR=		obj
8987321Sdes.endif
9087321Sdes
9187321Sdes.if defined(NOCLEAN)
9287538SdesCLEANDIR=
9387321SdesWORLD_CLEANDIST=obj
9487321Sdes.else
9587321SdesWORLD_CLEANDIST=cleandist
9687321Sdes.if defined(NOCLEANDIR)
9787321SdesCLEANDIR=	clean
9887321Sdes.else
9987321SdesCLEANDIR=	cleandir
10087321Sdes.endif
10187321Sdes.endif
10287321Sdes
10387321SdesMK_FLAGS=	-DNOMAN -DNOPROFILE
10487321Sdes
105113617Sjhb.if !target(pre-world)
10687321Sdespre-world:
107159283Sghelmer	@/usr/bin/true
10887321Sdes.endif
10987321Sdes
11087321Sdesworld:	pre-world hierarchy mk $(WORLD_CLEANDIST) bootstrap include-tools includes lib-tools libraries build-tools
11187321Sdes	@echo "--------------------------------------------------------------"
11287321Sdes	@echo " Rebuilding ${DESTDIR} The whole thing"
11387321Sdes	@echo "--------------------------------------------------------------"
114197428Skib	@echo
115197428Skib	cd ${.CURDIR} && ${MAKE} depend all install
11687321Sdes	cd ${.CURDIR}/share/man &&		${MAKE} makedb
11787321Sdes.if target(post-world)
118188677Sdes	cd ${.CURDIR} && ${MAKE} post-world
119188677Sdes.endif
120159283Sghelmer	@echo "make world completed on `date`"
121188677Sdes
122188677Sdesbootstrap:
123188677Sdes	cd ${.CURDIR}/usr.bin/make && ${MAKE} ${MK_FLAGS} all install
124123247Sdes	cd ${.CURDIR}/usr.bin/xlint && ${MAKE} ${MK_FLAGS} lint1 lint2 xlint
12587321Sdes	cd ${.CURDIR}/usr.bin/xlint/lint1 && ${MAKE} ${MK_FLAGS} install
12687321Sdes	cd ${.CURDIR}/usr.bin/xlint/lint2 && ${MAKE} ${MK_FLAGS} install
12787321Sdes	cd ${.CURDIR}/usr.bin/xlint/xlint && ${MAKE} ${MK_FLAGS} install
12887321Sdes	cd ${.CURDIR}/usr.bin/lex && ${MAKE} ${MK_FLAGS} bootstrap && \
12987321Sdes		${MAKE} ${MK_FLAGS} all install
13087321Sdes
13187321Sdesreinstall:	hierarchy mk includes
13287321Sdes	@echo "--------------------------------------------------------------"
13387321Sdes	@echo " Reinstall ${DESTDIR} The whole thing"
13487321Sdes	@echo "--------------------------------------------------------------"
135113617Sjhb	@echo
13687321Sdes	cd ${.CURDIR} && ${MAKE} install
13787321Sdes	cd ${.CURDIR}/share/man &&		${MAKE} makedb
13887321Sdes
13987321Sdeshierarchy:
14087321Sdes	@echo "--------------------------------------------------------------"
14187321Sdes	@echo " Making hierarchy"
14287321Sdes	@echo "--------------------------------------------------------------"
14387321Sdes	cd ${.CURDIR}/etc &&		${MAKE} distrib-dirs
14487321Sdes
14587321Sdesupdate:
14696886Sjhb.if defined(SUP_UPDATE)
147123247Sdes	@echo "--------------------------------------------------------------"
14887321Sdes	@echo "Running sup"
14987321Sdes	@echo "--------------------------------------------------------------"
15087321Sdes	@sup -v ${SUPFILE}
15187321Sdes.if defined(SUPFILE1)
15287321Sdes	@sup -v ${SUPFILE1}
15387321Sdes.endif
15487321Sdes.if defined(SUPFILE2)
15587321Sdes	@sup -v ${SUPFILE2}
15687321Sdes.endif
15787321Sdes.endif
15887321Sdes.if defined(CVS_UPDATE)
15987321Sdes	@echo "--------------------------------------------------------------"
16087321Sdes	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
16187321Sdes	@echo "--------------------------------------------------------------"
162105560Sphk	cd ${.CURDIR} &&  cvs -q update -P -d
163167482Sdes.endif
164123247Sdes
16587321Sdescleandist:
166167482Sdes.if !defined(NOCLEANDIR)
167105560Sphk	@echo "--------------------------------------------------------------"
168167482Sdes	@echo " Cleaning up the source tree, and rebuilding the obj tree"
169105560Sphk	@echo "--------------------------------------------------------------"
170167482Sdes	cd ${.CURDIR} && ${MAKE} cleandir
171105560Sphk	cd ${.CURDIR} && ${MAKE} obj
172167482Sdes.endif
173105560Sphk
174167482Sdesinstallmost:
175105560Sphk	@echo "--------------------------------------------------------------"
176167482Sdes	@echo " Installing programs only"
177105560Sphk	@echo "--------------------------------------------------------------"
178167482Sdes	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} install
179105560Sphk	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} install
180167482Sdes	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} install
181105560Sphk	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} install
182105560Sphk	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} install
183105560Sphk	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} install
184167482Sdes	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} install
185105560Sphk	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} install
186167482Sdes#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
187105560Sphk#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} installmost
188167482Sdes#.endif
189105560Sphk#.if !defined(NOSECURE) && !defined(NOCRYPT)
190167482Sdes#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} installmost
191105560Sphk#.endif
192167482Sdes
193197428Skibmost:
194197428Skib	@echo "--------------------------------------------------------------"
195123247Sdes	@echo " Building programs only"
196105560Sphk	@echo "--------------------------------------------------------------"
197167482Sdes	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} all
198123247Sdes	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} all
19987321Sdes	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} all
20087321Sdes	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} all
20187321Sdes	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} all
20287321Sdes	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} all
20387321Sdes	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} all
20487321Sdes	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} all
20587321Sdes#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
20687321Sdes#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} most
20787321Sdes#.endif
20887321Sdes#.if !defined(NOSECURE) && !defined(NOCRYPT)
20987321Sdes#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} most
21087321Sdes#.endif
21187321Sdes
212232278Smmmk:
213	@echo "--------------------------------------------------------------"
214	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
215	@echo "--------------------------------------------------------------"
216	cd ${.CURDIR}/share/mk &&	${MAKE} install
217
218includes:
219	@echo "--------------------------------------------------------------"
220	@echo " Rebuilding ${DESTDIR}/usr/include"
221	@echo "--------------------------------------------------------------"
222	@echo
223.if defined(CLOBBER)
224	rm -rf ${DESTDIR}/usr/include/*
225	mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
226		-p ${DESTDIR}/usr/include
227.endif
228	cd ${.CURDIR}/include &&		${MAKE} install
229	cd ${.CURDIR}/gnu/include &&		${MAKE}	install
230	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
231	cd ${.CURDIR}/gnu/lib/libregex &&	${MAKE} beforeinstall
232	cd ${.CURDIR}/gnu/lib/libg++ &&         ${MAKE} beforeinstall
233	cd ${.CURDIR}/gnu/lib/libdialog &&      ${MAKE} beforeinstall
234.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
235	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
236	cd ${.CURDIR}/eBones/lib/libkrb &&	${MAKE} beforeinstall
237	cd ${.CURDIR}/eBones/lib/libkadm &&	${MAKE} beforeinstall
238.endif
239	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
240	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
241	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
242	cd ${.CURDIR}/lib/libftpio &&		${MAKE} beforeinstall
243	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
244	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE}	beforeinstall
245	cd ${.CURDIR}/lib/libncurses &&		${MAKE}	beforeinstall
246.if !defined(WANT_CSRG_LIBM)
247	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
248.endif
249	cd ${.CURDIR}/lib/libpcap &&		${MAKE} beforeinstall
250	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
251	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
252	cd ${.CURDIR}/lib/libtcl &&		${MAKE}	beforeinstall
253	cd ${.CURDIR}/lib/libtermcap &&		${MAKE}	beforeinstall
254	cd ${.CURDIR}/lib/libcom_err &&		${MAKE} beforeinstall
255	cd ${.CURDIR}/lib/libss &&		${MAKE} beforeinstall
256	cd ${.CURDIR}/lib/libscsi &&		${MAKE}	beforeinstall
257	cd ${.CURDIR}/lib/libutil &&		${MAKE}	beforeinstall
258
259lib-tools:
260	@echo "--------------------------------------------------------------"
261	@echo " Rebuilding tools needed to build the libraries"
262	@echo "--------------------------------------------------------------"
263	@echo
264	cd ${.CURDIR}/usr.bin/xinstall && \
265		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
266	cd ${.CURDIR}/gnu/usr.bin/ld && \
267		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
268	cd ${.CURDIR}/usr.bin/ar && \
269		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
270	cd ${.CURDIR}/usr.bin/ranlib && \
271		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
272	cd ${.CURDIR}/usr.bin/nm && \
273		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
274	cd ${.CURDIR}/usr.bin/lex/lib && \
275		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
276	cd ${.CURDIR}/usr.bin/compile_et && \
277		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR} && \
278		rm -f /usr/sbin/compile_et
279	cd ${.CURDIR}/usr.bin/mk_cmds && \
280		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
281
282libraries:
283	@echo "--------------------------------------------------------------"
284	@echo " Rebuilding ${DESTDIR}/usr/lib"
285	@echo "--------------------------------------------------------------"
286	@echo
287.if exists(lib/libcompat)
288	cd ${.CURDIR}/lib/libcompat && \
289		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
290.endif
291.if exists(lib/libncurses)
292	cd ${.CURDIR}/lib/libncurses && \
293		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
294.endif
295.if exists(lib/libtermcap)
296	cd ${.CURDIR}/lib/libtermcap && \
297		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
298.endif
299.if exists(gnu)
300	cd ${.CURDIR}/gnu/lib && \
301		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
302	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
303		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
304.endif
305.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
306	cd ${.CURDIR}/secure/lib && \
307		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
308.endif
309.if exists(lib)
310	cd ${.CURDIR}/lib/csu/i386 && \
311		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
312	cd ${.CURDIR}/lib && \
313		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
314.endif
315.if exists(usr.bin/lex/lib)
316	cd ${.CURDIR}/usr.bin/lex/lib && \
317		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
318.endif
319.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
320	cd ${.CURDIR}/eBones/lib && \
321		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
322.endif
323.if exists(usr.sbin/pcvt/keycap)
324	cd ${.CURDIR}/usr.sbin/pcvt/keycap && \
325		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
326.endif
327
328include-tools:
329	@echo "--------------------------------------------------------------"
330	@echo " Rebuild tools necessary to build the include files"
331	@echo "--------------------------------------------------------------"
332	@echo
333	cd ${.CURDIR}/usr.bin/xinstall && \
334		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
335	cd ${.CURDIR}/usr.bin/rpcgen && \
336		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
337
338build-tools:
339	@echo "--------------------------------------------------------------"
340	@echo " Rebuilding ${DESTDIR} C compiler, make, symorder, sgmlfmt and zic(8)"
341	@echo "--------------------------------------------------------------"
342	@echo
343	cd ${.CURDIR}/gnu/usr.bin/cc && \
344		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
345	cd ${.CURDIR}/usr.bin/make && \
346		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
347	cd ${.CURDIR}/usr.bin/symorder && \
348		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
349	cd ${.CURDIR}/usr.bin/sgmlfmt && \
350		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR} 
351	cd ${.CURDIR}/share/sgml && \
352		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR} 
353	cd ${.CURDIR}/usr.sbin/zic && \
354		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
355
356.include <bsd.subdir.mk>
357