Makefile revision 10760
1226046Sdes#
2224638Sbrooks#	$Id: Makefile,v 1.59 1995/08/30 17:27:57 davidg Exp $
376259Sgreen#
465668Skris# Make command line options:
565668Skris#	-DCLOBBER will remove /usr/include and MOST of /usr/lib
665668Skris#	-DMAKE_LOCAL to add ./local to the SUBDIR list
765668Skris#	-DMAKE_PORTS to add ./ports to the SUBDIR list
865668Skris#	-DMAKE_EBONES to build eBones (KerberosIV)
965668Skris#
1065668Skris#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
1165668Skris#	-DNOCRYPT will prevent building of crypt versions
1265668Skris#	-DNOLKM do not build loadable kernel modules
1365668Skris#	-DNOOBJDIR do not run ``${MAKE} obj''
1465668Skris#	-DNOPROFILE do not build profiled libraries
1565668Skris#	-DNOSECURE do not go into secure subdir
1665668Skris
1765668Skris# Put initial settings here.
1865668SkrisSUBDIR=
1965668Skris
2065668Skris# We must do include and lib first so that the perl *.ph generation
2165668Skris# works correctly as it uses the header files installed by this.
2265668Skris.if exists(include)
2365668SkrisSUBDIR+= include
2465668Skris.endif
2565668Skris.if exists(lib)
2665668SkrisSUBDIR+= lib
27162856Sdes.endif
28162856Sdes
29162856Sdes.if exists(bin)
30221420SdesSUBDIR+= bin
31221420Sdes.endif
32221420Sdes.if exists(contrib)
33221420SdesSUBDIR+= contrib
34221420Sdes.endif
35221420Sdes.if exists(games)
36221420SdesSUBDIR+= games
37221420Sdes.endif
38221420Sdes.if exists(gnu)
39221420SdesSUBDIR+= gnu
40221420Sdes.endif
41221420Sdes.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
42221420SdesSUBDIR+= eBones
43221420Sdes.endif
44221420Sdes.if exists(libexec)
45221420SdesSUBDIR+= libexec
46221420Sdes.endif
47221420Sdes.if exists(sbin)
48221420SdesSUBDIR+= sbin
49162856Sdes.endif
50221420Sdes.if exists(share)
51221420SdesSUBDIR+= share
52221420Sdes.endif
53162856Sdes.if exists(sys)
54221420SdesSUBDIR+= sys
55221420Sdes.endif
56221420Sdes.if exists(usr.bin)
57221420SdesSUBDIR+= usr.bin
58221420Sdes.endif
59221420Sdes.if exists(usr.sbin)
60162856SdesSUBDIR+= usr.sbin
61162856Sdes.endif
62162856Sdes.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
63162856SdesSUBDIR+= secure
64215116Sdes.endif
65221420Sdes.if exists(lkm) && !defined(NOLKM)
66221420SdesSUBDIR+= lkm
67221420Sdes.endif
68221420Sdes
69221420Sdes# etc must be last for "distribute" to work
70221420Sdes.if exists(etc) && make(distribute)
71221420SdesSUBDIR+= etc
72221420Sdes.endif
73192595Sdes
7469587Sgreen# These are last, since it is nice to at least get the base system
75192595Sdes# rebuilt before you do them.
76192595Sdes.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
77149753SdesSUBDIR+= local
78192595Sdes.endif
79224638Sbrooks.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
80224638SbrooksSUBDIR+= ports
81224638Sbrooks.endif
82224638Sbrooks
83226046Sdes# Handle the -DNOOBJDIR and -DNOCLEANDIR
84226046Sdes.if defined(NOOBJDIR)
85226046SdesOBJDIR=
86226046Sdes.else
87226046SdesOBJDIR=		obj
88226046Sdes.endif
89226046Sdes.if defined(NOCLEANDIR)
90226046SdesCLEANDIR=	clean
91226046Sdes.else
9276259SgreenCLEANDIR=	cleandir
93226046Sdes.endif
94226046Sdes
95226046Sdesworld:	hierarchy mk cleandist includes lib-tools libraries tools
96226046Sdes	@echo "--------------------------------------------------------------"
97226046Sdes	@echo " Rebuilding ${DESTDIR} The whole thing"
9876259Sgreen	@echo "--------------------------------------------------------------"
99226046Sdes	@echo
100226046Sdes	${MAKE} depend all install
101226046Sdes	cd ${.CURDIR}/share/man &&		${MAKE} makedb
102149753Sdes
10360573Skrishierarchy:
10460573Skris	@echo "--------------------------------------------------------------"
10560573Skris	@echo " Making hierarchy"
10661209Skris	@echo "--------------------------------------------------------------"
10760573Skris	cd ${.CURDIR}/etc &&		${MAKE} distrib-dirs
10860573Skris
10960573Skrisupdate:
11060573Skris.if defined(SUP_UPDATE)
11160573Skris	@echo "--------------------------------------------------------------"
11260573Skris	@echo "Running sup"
11360573Skris	@echo "--------------------------------------------------------------"
11460573Skris	@sup -v ${SUPFILE}
11560573Skris.if defined(SUPFILE1)
11660573Skris	@sup -v ${SUPFILE1}
11760573Skris.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.endif
218	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
219	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
220	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
221	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
222	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE}	beforeinstall
223	cd ${.CURDIR}/lib/libncurses &&		${MAKE}	beforeinstall
224.if !defined(WANT_CSRG_LIBM)
225	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
226.endif
227	cd ${.CURDIR}/lib/libpcap &&		${MAKE} beforeinstall
228	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
229	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
230	cd ${.CURDIR}/lib/libtermcap &&		${MAKE}	beforeinstall
231	cd ${.CURDIR}/lib/libcom_err &&		${MAKE} beforeinstall
232	cd ${.CURDIR}/lib/libss &&		${MAKE} beforeinstall
233	cd ${.CURDIR}/lib/libforms &&		${MAKE}	beforeinstall
234	cd ${.CURDIR}/lib/libscsi &&		${MAKE}	beforeinstall
235
236lib-tools:
237	@echo "--------------------------------------------------------------"
238	@echo " Rebuilding tools needed to build the libraries"
239	@echo "--------------------------------------------------------------"
240	@echo
241	cd ${.CURDIR}/gnu/usr.bin/ld && \
242		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
243	cd ${.CURDIR}/usr.bin/ar && \
244		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
245	cd ${.CURDIR}/usr.bin/ranlib && \
246		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
247	cd ${.CURDIR}/usr.bin/nm && \
248		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
249	cd ${.CURDIR}/usr.bin/lex/lib && \
250		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
251	cd ${.CURDIR}/usr.bin/compile_et && \
252		${MAKE} depend all install ${CLEANDIR} ${OBJDIR} && \
253		rm -f /usr/sbin/compile_et
254	cd ${.CURDIR}/usr.bin/mk_cmds && \
255		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
256
257libraries:
258	@echo "--------------------------------------------------------------"
259	@echo " Rebuilding ${DESTDIR}/usr/lib"
260	@echo "--------------------------------------------------------------"
261	@echo
262.if defined(CLOBBER)
263	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
264		xargs rm -rf
265.endif
266.if exists(lib/libcompat)
267	cd ${.CURDIR}/lib/libcompat && \
268		${MAKE} depend all install
269.endif
270.if exists(lib/libncurses)
271	cd ${.CURDIR}/lib/libncurses && \
272		${MAKE} depend all install
273.endif
274.if exists(lib/libtermcap)
275	cd ${.CURDIR}/lib/libtermcap && \
276		${MAKE} depend all install
277.endif
278.if exists(gnu)
279	cd ${.CURDIR}/gnu/lib && \
280		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
281	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
282		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
283.endif
284.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
285	cd ${.CURDIR}/secure/lib && \
286		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
287.endif
288.if exists(lib)
289	cd ${.CURDIR}/lib/csu/i386 && \
290		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
291	cd ${.CURDIR}/lib && \
292		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
293.endif
294	cd ${.CURDIR}/usr.bin/lex/lib && \
295		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
296.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
297	cd ${.CURDIR}/eBones/des && \
298		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
299	cd ${.CURDIR}/eBones/acl && \
300		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
301	cd ${.CURDIR}/eBones/kdb && \
302		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
303	cd ${.CURDIR}/eBones/krb && \
304		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
305.endif
306.if exists(usr.sbin/pcvt/keycap)
307	cd ${.CURDIR}/usr.sbin/pcvt/keycap && \
308		 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
309.endif
310
311tools:
312	@echo "--------------------------------------------------------------"
313	@echo " Rebuilding ${DESTDIR} C compiler, make, and zic(8)"
314	@echo "--------------------------------------------------------------"
315	@echo
316	cd ${.CURDIR}/gnu/usr.bin/cc && \
317		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
318	cd ${.CURDIR}/usr.bin/make && \
319		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
320	cd ${.CURDIR}/usr.sbin/zic && \
321		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
322
323.include <bsd.subdir.mk>
324