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