Makefile revision 16534
1#
2#	$Id: Makefile,v 1.81 1996/06/19 21:19:56 nate Exp $
3#
4# Make command line options:
5#	-DCLOBBER will remove /usr/include
6#	-DMAKE_LOCAL to add ./local to the SUBDIR list
7#	-DMAKE_PORTS to add ./ports to the SUBDIR list
8#	-DMAKE_EBONES to build eBones (KerberosIV)
9#
10#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
11#	-DNOCLEAN do not clean at all
12#	-DNOCRYPT will prevent building of crypt versions
13#	-DNOLKM do not build loadable kernel modules
14#	-DNOOBJDIR do not run ``${MAKE} obj''
15#	-DNOPROFILE do not build profiled libraries
16#	-DNOSECURE do not go into secure subdir
17
18# Put initial settings here.
19SUBDIR=
20
21# We must do include and lib first so that the perl *.ph generation
22# works correctly as it uses the header files installed by this.
23.if exists(include)
24SUBDIR+= include
25.endif
26.if exists(lib)
27SUBDIR+= lib
28.endif
29
30.if exists(bin)
31SUBDIR+= bin
32.endif
33.if exists(contrib)
34SUBDIR+= contrib
35.endif
36.if exists(games)
37SUBDIR+= games
38.endif
39.if exists(gnu)
40SUBDIR+= gnu
41.endif
42.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
43SUBDIR+= eBones
44.endif
45.if exists(libexec)
46SUBDIR+= libexec
47.endif
48.if exists(sbin)
49SUBDIR+= sbin
50.endif
51.if exists(share)
52SUBDIR+= share
53.endif
54.if exists(sys)
55SUBDIR+= sys
56.endif
57.if exists(usr.bin)
58SUBDIR+= usr.bin
59.endif
60.if exists(usr.sbin)
61SUBDIR+= usr.sbin
62.endif
63.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
64SUBDIR+= secure
65.endif
66.if exists(lkm) && !defined(NOLKM)
67SUBDIR+= lkm
68.endif
69
70# etc must be last for "distribute" to work
71.if exists(etc) && make(distribute)
72SUBDIR+= etc
73.endif
74
75# These are last, since it is nice to at least get the base system
76# rebuilt before you do them.
77.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
78SUBDIR+= local
79.endif
80.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
81SUBDIR+= ports
82.endif
83
84# Handle the -DNOOBJDIR and -DNOCLEANDIR
85.if defined(NOOBJDIR)
86OBJDIR=
87.else
88OBJDIR=		obj
89.endif
90
91.if defined(NOCLEAN)
92CLEANDIR=
93WORLD_CLEANDIST=obj
94.else
95WORLD_CLEANDIST=cleandist
96.if defined(NOCLEANDIR)
97CLEANDIR=	clean
98.else
99CLEANDIR=	cleandir
100.endif
101.endif
102
103MK_FLAGS=	-DNOMAN -DNOPROFILE
104
105world:	hierarchy mk $(WORLD_CLEANDIST) bootstrap include-tools includes lib-tools libraries build-tools
106	@echo "--------------------------------------------------------------"
107	@echo " Rebuilding ${DESTDIR} The whole thing"
108	@echo "--------------------------------------------------------------"
109	@echo
110	${MAKE} depend all install
111	cd ${.CURDIR}/share/man &&		${MAKE} makedb
112	@echo "make world completed on `date`"
113
114bootstrap:
115	cd ${.CURDIR}/usr.bin/xlint && ${MAKE} ${MK_FLAGS} lint1 lint2 xlint
116	cd ${.CURDIR}/usr.bin/xlint/lint1 && ${MAKE} ${MK_FLAGS} install
117	cd ${.CURDIR}/usr.bin/xlint/lint2 && ${MAKE} ${MK_FLAGS} install
118	cd ${.CURDIR}/usr.bin/xlint/xlint && ${MAKE} ${MK_FLAGS} install
119	cd ${.CURDIR}/usr.bin/lex && ${MAKE} ${MK_FLAGS} bootstrap && \
120		${MAKE} ${MK_FLAGS} all install
121
122reinstall:	hierarchy mk includes
123	@echo "--------------------------------------------------------------"
124	@echo " Reinstall ${DESTDIR} The whole thing"
125	@echo "--------------------------------------------------------------"
126	@echo
127	${MAKE} install
128	cd ${.CURDIR}/share/man &&		${MAKE} makedb
129
130hierarchy:
131	@echo "--------------------------------------------------------------"
132	@echo " Making hierarchy"
133	@echo "--------------------------------------------------------------"
134	cd ${.CURDIR}/etc &&		${MAKE} distrib-dirs
135
136update:
137.if defined(SUP_UPDATE)
138	@echo "--------------------------------------------------------------"
139	@echo "Running sup"
140	@echo "--------------------------------------------------------------"
141	@sup -v ${SUPFILE}
142.if defined(SUPFILE1)
143	@sup -v ${SUPFILE1}
144.endif
145.if defined(SUPFILE2)
146	@sup -v ${SUPFILE2}
147.endif
148.endif
149.if defined(CVS_UPDATE)
150	@echo "--------------------------------------------------------------"
151	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
152	@echo "--------------------------------------------------------------"
153	cd ${.CURDIR} &&  cvs update -P -d
154.endif
155
156cleandist:
157.if !defined(NOCLEANDIR)
158	@echo "--------------------------------------------------------------"
159	@echo " Cleaning up the source tree, and rebuilding the obj tree"
160	@echo "--------------------------------------------------------------"
161	@echo
162	here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
163	if test -d /usr/obj -a ! -d $$dest; then \
164		mkdir -p $$dest; \
165	else \
166		true; \
167	fi; \
168	cd $$dest && rm -rf ${SUBDIR}
169	find . -name obj | xargs rm -rf
170.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
171	# The cd is done as local may well be a symbolic link
172	-cd local && find . -name obj | xargs rm -rf
173.endif
174.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
175	# The cd is done as local may well be a symbolic link
176	-cd ports && find . -name obj | xargs rm -rf
177.endif
178	${MAKE} cleandir
179	${MAKE} obj
180.endif
181
182installmost:
183	@echo "--------------------------------------------------------------"
184	@echo " Installing programs only"
185	@echo "--------------------------------------------------------------"
186	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} install
187	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} install
188	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} install
189	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} install
190	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} install
191	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} install
192	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} install
193	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} install
194#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
195#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} installmost
196#.endif
197#.if !defined(NOSECURE) && !defined(NOCRYPT)
198#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} installmost
199#.endif
200
201most:
202	@echo "--------------------------------------------------------------"
203	@echo " Building programs only"
204	@echo "--------------------------------------------------------------"
205	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} all
206	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} all
207	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} all
208	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} all
209	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} all
210	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} all
211	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} all
212	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} all
213#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
214#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} most
215#.endif
216#.if !defined(NOSECURE) && !defined(NOCRYPT)
217#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} most
218#.endif
219
220mk:
221	@echo "--------------------------------------------------------------"
222	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
223	@echo "--------------------------------------------------------------"
224	cd ${.CURDIR}/share/mk &&		${MAKE} install
225
226includes:
227	@echo "--------------------------------------------------------------"
228	@echo " Rebuilding ${DESTDIR}/usr/include"
229	@echo "--------------------------------------------------------------"
230	@echo
231.if defined(CLOBBER)
232	rm -rf ${DESTDIR}/usr/include/*
233	mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
234		-p ${DESTDIR}/usr/include
235.endif
236	cd ${.CURDIR}/include &&		${MAKE} install
237	cd ${.CURDIR}/gnu/include &&		${MAKE}	install
238	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
239	cd ${.CURDIR}/gnu/lib/libregex &&	${MAKE} beforeinstall
240	cd ${.CURDIR}/gnu/lib/libg++ &&         ${MAKE} beforeinstall
241	cd ${.CURDIR}/gnu/lib/libdialog &&      ${MAKE} beforeinstall
242.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
243	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
244	cd ${.CURDIR}/eBones/lib/libkrb &&	${MAKE} beforeinstall
245	cd ${.CURDIR}/eBones/lib/libkadm &&	${MAKE} beforeinstall
246.endif
247	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
248	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
249	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
250	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
251	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE}	beforeinstall
252	cd ${.CURDIR}/lib/libncurses &&		${MAKE}	beforeinstall
253.if !defined(WANT_CSRG_LIBM)
254	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
255.endif
256	cd ${.CURDIR}/lib/libpcap &&		${MAKE} beforeinstall
257	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
258	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
259	cd ${.CURDIR}/lib/libtermcap &&		${MAKE}	beforeinstall
260	cd ${.CURDIR}/lib/libcom_err &&		${MAKE} beforeinstall
261	cd ${.CURDIR}/lib/libss &&		${MAKE} beforeinstall
262	cd ${.CURDIR}/lib/libscsi &&		${MAKE}	beforeinstall
263	cd ${.CURDIR}/lib/libutil &&		${MAKE}	beforeinstall
264
265lib-tools:
266	@echo "--------------------------------------------------------------"
267	@echo " Rebuilding tools needed to build the libraries"
268	@echo "--------------------------------------------------------------"
269	@echo
270	cd ${.CURDIR}/usr.bin/xinstall && \
271		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
272	cd ${.CURDIR}/gnu/usr.bin/ld && \
273		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
274	cd ${.CURDIR}/usr.bin/ar && \
275		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
276	cd ${.CURDIR}/usr.bin/ranlib && \
277		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
278	cd ${.CURDIR}/usr.bin/nm && \
279		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
280	cd ${.CURDIR}/usr.bin/lex/lib && \
281		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
282	cd ${.CURDIR}/usr.bin/compile_et && \
283		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR} && \
284		rm -f /usr/sbin/compile_et
285	cd ${.CURDIR}/usr.bin/mk_cmds && \
286		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
287
288libraries:
289	@echo "--------------------------------------------------------------"
290	@echo " Rebuilding ${DESTDIR}/usr/lib"
291	@echo "--------------------------------------------------------------"
292	@echo
293.if exists(lib/libcompat)
294	cd ${.CURDIR}/lib/libcompat && \
295		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
296.endif
297.if exists(lib/libncurses)
298	cd ${.CURDIR}/lib/libncurses && \
299		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
300.endif
301.if exists(lib/libtermcap)
302	cd ${.CURDIR}/lib/libtermcap && \
303		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
304.endif
305.if exists(gnu)
306	cd ${.CURDIR}/gnu/lib && \
307		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
308	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
309		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
310.endif
311.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
312	cd ${.CURDIR}/secure/lib && \
313		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
314.endif
315.if exists(lib)
316	cd ${.CURDIR}/lib/csu/i386 && \
317		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
318	cd ${.CURDIR}/lib && \
319		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
320.endif
321.if exists(usr.sbin/lex/lib)
322	cd ${.CURDIR}/usr.bin/lex/lib && \
323		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
324.endif
325.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
326	cd ${.CURDIR}/eBones/lib && \
327		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
328.endif
329.if exists(usr.sbin/pcvt/keycap)
330	cd ${.CURDIR}/usr.sbin/pcvt/keycap && \
331		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
332.endif
333
334include-tools:
335	@echo "--------------------------------------------------------------"
336	@echo " Rebuild tools necessary to build the include files"
337	@echo "--------------------------------------------------------------"
338	@echo
339	cd ${.CURDIR}/usr.bin/xinstall && \
340		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
341	cd ${.CURDIR}/usr.bin/rpcgen && \
342		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
343
344build-tools:
345	@echo "--------------------------------------------------------------"
346	@echo " Rebuilding ${DESTDIR} C compiler, make, symorder, sgmlfmt and zic(8)"
347	@echo "--------------------------------------------------------------"
348	@echo
349	cd ${.CURDIR}/gnu/usr.bin/cc && \
350		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
351	cd ${.CURDIR}/usr.bin/make && \
352		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
353	cd ${.CURDIR}/usr.bin/symorder && \
354		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
355	cd ${.CURDIR}/usr.bin/sgmlfmt && \
356		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR} 
357	cd ${.CURDIR}/share/sgml && \
358		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR} 
359	cd ${.CURDIR}/usr.sbin/zic && \
360		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
361
362.include <bsd.subdir.mk>
363