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