Makefile revision 14787
1#
2#	$Id: Makefile,v 1.77 1996/03/11 14:59:10 jkh Exp $
3#
4# Make command line options:
5#	-DCLOBBER will remove /usr/include and MOST of /usr/lib
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
103world:	hierarchy mk $(WORLD_CLEANDIST) bootstrap include-tools includes lib-tools libraries build-tools
104	@echo "--------------------------------------------------------------"
105	@echo " Rebuilding ${DESTDIR} The whole thing"
106	@echo "--------------------------------------------------------------"
107	@echo
108	${MAKE} depend all install
109	cd ${.CURDIR}/share/man &&		${MAKE} makedb
110	@echo "make world completed on `date`"
111
112bootstrap:
113	cd ${.CURDIR}/usr.bin/xlint && ${MAKE} lint1 lint2 xlint
114	cd ${.CURDIR}/usr.bin/xlint/lint1 && ${MAKE} install
115	cd ${.CURDIR}/usr.bin/xlint/lint2 && ${MAKE} install
116	cd ${.CURDIR}/usr.bin/xlint/xlint && ${MAKE} install
117
118reinstall:	hierarchy mk includes
119	@echo "--------------------------------------------------------------"
120	@echo " Reinstall ${DESTDIR} The whole thing"
121	@echo "--------------------------------------------------------------"
122	@echo
123	${MAKE} install
124	cd ${.CURDIR}/share/man &&		${MAKE} makedb
125
126hierarchy:
127	@echo "--------------------------------------------------------------"
128	@echo " Making hierarchy"
129	@echo "--------------------------------------------------------------"
130	cd ${.CURDIR}/etc &&		${MAKE} distrib-dirs
131
132update:
133.if defined(SUP_UPDATE)
134	@echo "--------------------------------------------------------------"
135	@echo "Running sup"
136	@echo "--------------------------------------------------------------"
137	@sup -v ${SUPFILE}
138.if defined(SUPFILE1)
139	@sup -v ${SUPFILE1}
140.endif
141.if defined(SUPFILE2)
142	@sup -v ${SUPFILE2}
143.endif
144.endif
145.if defined(CVS_UPDATE)
146	@echo "--------------------------------------------------------------"
147	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
148	@echo "--------------------------------------------------------------"
149	cd ${.CURDIR} &&  cvs update -P -d
150.endif
151
152cleandist:
153.if !defined(NOCLEANDIR)
154	@echo "--------------------------------------------------------------"
155	@echo " Cleaning up the source tree, and rebuilding the obj tree"
156	@echo "--------------------------------------------------------------"
157	@echo
158	here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
159	if test -d /usr/obj -a ! -d $$dest; then \
160		mkdir -p $$dest; \
161	else \
162		true; \
163	fi; \
164	cd $$dest && rm -rf ${SUBDIR}
165	find . -name obj | xargs rm -rf
166.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
167	# The cd is done as local may well be a symbolic link
168	-cd local && find . -name obj | xargs rm -rf
169.endif
170.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
171	# The cd is done as local may well be a symbolic link
172	-cd ports && find . -name obj | xargs rm -rf
173.endif
174	${MAKE} cleandir
175	${MAKE} obj
176.endif
177
178installmost:
179	@echo "--------------------------------------------------------------"
180	@echo " Installing programs only"
181	@echo "--------------------------------------------------------------"
182	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} install
183	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} install
184	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} install
185	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} install
186	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} install
187	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} install
188	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} install
189	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} install
190#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
191#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} installmost
192#.endif
193#.if !defined(NOSECURE) && !defined(NOCRYPT)
194#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} installmost
195#.endif
196
197most:
198	@echo "--------------------------------------------------------------"
199	@echo " Building programs only"
200	@echo "--------------------------------------------------------------"
201	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} all
202	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} all
203	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} all
204	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} all
205	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} all
206	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} all
207	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} all
208	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} all
209#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
210#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} most
211#.endif
212#.if !defined(NOSECURE) && !defined(NOCRYPT)
213#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} most
214#.endif
215
216mk:
217	@echo "--------------------------------------------------------------"
218	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
219	@echo "--------------------------------------------------------------"
220	cd ${.CURDIR}/share/mk &&		${MAKE} install
221
222includes:
223	@echo "--------------------------------------------------------------"
224	@echo " Rebuilding ${DESTDIR}/usr/include"
225	@echo "--------------------------------------------------------------"
226	@echo
227.if defined(CLOBBER)
228	rm -rf ${DESTDIR}/usr/include/*
229	mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
230		-p ${DESTDIR}/usr/include
231.endif
232	cd ${.CURDIR}/include &&		${MAKE} install
233	cd ${.CURDIR}/gnu/include &&		${MAKE}	install
234	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
235	cd ${.CURDIR}/gnu/lib/libregex &&	${MAKE} beforeinstall
236	cd ${.CURDIR}/gnu/lib/libg++ &&         ${MAKE} beforeinstall
237	cd ${.CURDIR}/gnu/lib/libdialog &&      ${MAKE} beforeinstall
238.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
239	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
240	cd ${.CURDIR}/eBones/lib/libkrb &&	${MAKE} beforeinstall
241	cd ${.CURDIR}/eBones/lib/libkadm &&	${MAKE} beforeinstall
242.endif
243	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
244	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
245	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
246	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
247	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE}	beforeinstall
248	cd ${.CURDIR}/lib/libncurses &&		${MAKE}	beforeinstall
249.if !defined(WANT_CSRG_LIBM)
250	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
251.endif
252	cd ${.CURDIR}/lib/libpcap &&		${MAKE} beforeinstall
253	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
254	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
255	cd ${.CURDIR}/lib/libtermcap &&		${MAKE}	beforeinstall
256	cd ${.CURDIR}/lib/libcom_err &&		${MAKE} beforeinstall
257	cd ${.CURDIR}/lib/libss &&		${MAKE} beforeinstall
258	cd ${.CURDIR}/lib/libforms &&		${MAKE}	beforeinstall
259	cd ${.CURDIR}/lib/libscsi &&		${MAKE}	beforeinstall
260	cd ${.CURDIR}/lib/libutil &&		${MAKE}	beforeinstall
261
262lib-tools:
263	@echo "--------------------------------------------------------------"
264	@echo " Rebuilding tools needed to build the libraries"
265	@echo "--------------------------------------------------------------"
266	@echo
267	cd ${.CURDIR}/usr.bin/xinstall && \
268		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
269	cd ${.CURDIR}/gnu/usr.bin/ld && \
270		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
271	cd ${.CURDIR}/usr.bin/ar && \
272		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
273	cd ${.CURDIR}/usr.bin/ranlib && \
274		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
275	cd ${.CURDIR}/usr.bin/nm && \
276		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
277	cd ${.CURDIR}/usr.bin/lex/lib && \
278		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
279	cd ${.CURDIR}/usr.bin/compile_et && \
280		${MAKE} depend all install ${CLEANDIR} ${OBJDIR} && \
281		rm -f /usr/sbin/compile_et
282	cd ${.CURDIR}/usr.bin/mk_cmds && \
283		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
284
285libraries:
286	@echo "--------------------------------------------------------------"
287	@echo " Rebuilding ${DESTDIR}/usr/lib"
288	@echo "--------------------------------------------------------------"
289	@echo
290.if defined(CLOBBER)
291	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
292		xargs rm -rf
293.endif
294.if exists(lib/libcompat)
295	cd ${.CURDIR}/lib/libcompat && \
296		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
297.endif
298.if exists(lib/libncurses)
299	cd ${.CURDIR}/lib/libncurses && \
300		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
301.endif
302.if exists(lib/libtermcap)
303	cd ${.CURDIR}/lib/libtermcap && \
304		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
305.endif
306.if exists(gnu)
307	cd ${.CURDIR}/gnu/lib && \
308		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
309	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
310		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
311.endif
312.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
313	cd ${.CURDIR}/secure/lib && \
314		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
315.endif
316.if exists(lib)
317	cd ${.CURDIR}/lib/csu/i386 && \
318		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
319	cd ${.CURDIR}/lib && \
320		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
321.endif
322.if exists(usr.sbin/lex/lib)
323	cd ${.CURDIR}/usr.bin/lex/lib && \
324		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
325.endif
326.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
327	cd ${.CURDIR}/eBones/lib && \
328		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
329.endif
330.if exists(usr.sbin/pcvt/keycap)
331	cd ${.CURDIR}/usr.sbin/pcvt/keycap && \
332		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
333.endif
334
335include-tools:
336	@echo "--------------------------------------------------------------"
337	@echo " Rebuild tools necessary to build the include files"
338	@echo "--------------------------------------------------------------"
339	@echo
340	cd ${.CURDIR}/usr.bin/xinstall && \
341		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
342	cd ${.CURDIR}/usr.bin/rpcgen && \
343		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
344
345build-tools:
346	@echo "--------------------------------------------------------------"
347	@echo " Rebuilding ${DESTDIR} C compiler, make, symorder, sgmlfmt and zic(8)"
348	@echo "--------------------------------------------------------------"
349	@echo
350	cd ${.CURDIR}/gnu/usr.bin/cc && \
351		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
352	cd ${.CURDIR}/usr.bin/make && \
353		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
354	cd ${.CURDIR}/usr.bin/symorder && \
355		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
356	cd ${.CURDIR}/usr.bin/sgmlfmt && \
357		${MAKE} depend all install ${CLEANDIR} ${OBJDIR} 
358	cd ${.CURDIR}/share/sgml && \
359		${MAKE} depend all install ${CLEANDIR} ${OBJDIR} 
360	cd ${.CURDIR}/usr.sbin/zic && \
361		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
362
363.include <bsd.subdir.mk>
364