Makefile revision 7281
134689Sbde#
250476Speter#	$Id: Makefile,v 1.48 1995/03/19 17:24:24 ats Exp $
31573Srgrimes#
434689Sbde# Make command line options:
534689Sbde#	-DCLOBBER will remove /usr/include and MOST of /usr/lib 
634689Sbde#	-DMAKE_LOCAL to add ./local to the SUBDIR list
738752Sbde#	-DMAKE_PORTS to add ./ports to the SUBDIR list
8117675Smarkm#	-DMAKE_EBONES to build eBones (KerberosIV)
9117675Smarkm#
1081133Stmm#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
1159897Sjoe#	-DNOCRYPT will prevent building of crypt versions
1279471Smarkm#	-DNOLKM do not build loadable kernel modules
1350731Speter#	-DNOOBJDIR do not run ``${MAKE} obj''
14122568Sharti#	-DNOPROFILE do not build profiled libraries
1559353Skris#	-DNOSECURE do not go into secure subdir
1641257Sjdp
1782355Smarkm# Put initial settings here.
1894690SdesSUBDIR=
1941257Sjdp
2056081Sbde# do include first.
2194690Sdes.if exists(include)
2234689SbdeSUBDIR+= include
2334689Sbde.endif
2434689Sbde
25122568Sharti.if exists(bin)
26126799SphkSUBDIR+= bin
27126799Sphk.endif
28122406Sharti.if exists(contrib)
29129225ScognetSUBDIR+= contrib
30110546Sphk.endif
31120492Sfjoe.if exists(games)
32122568ShartiSUBDIR+= games
33121340Sharti.endif
34121340Sharti.if exists(gnu)
35121340ShartiSUBDIR+= gnu
3634689Sbde.endif
37103436Speter.if exists(lib)
38103436SpeterSUBDIR+= lib
3972309Sobrien.endif
4034689Sbde.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
4172309SobrienSUBDIR+= eBones
4272309Sobrien.endif
431573Srgrimes.if exists(libexec)
441573SrgrimesSUBDIR+= libexec
45116906Smarcel.endif
46129225Scognet.if exists(sbin)
47129225ScognetSUBDIR+= sbin
48108753Smarcel.endif
4934689Sbde.if exists(share)
5017706SjulianSUBDIR+= share
51116906Smarcel.endif
5217706Sjulian.if exists(sys)
53119508SphkSUBDIR+= sys
54119508Sphk.endif
55121340Sharti.if exists(usr.bin)
56119508SphkSUBDIR+= usr.bin
57119508Sphk.endif
5853927Speter.if exists(usr.sbin)
5953922SpeterSUBDIR+= usr.sbin
6053922Speter.endif
6153922Speter.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
6286252SgshapiroSUBDIR+= secure
6390796Sgshapiro.endif
6490796Sgshapiro.if exists(lkm) && !defined(NOLKM)
6586252SgshapiroSUBDIR+= lkm
6686252Sgshapiro.endif
6786252Sgshapiro
6886252Sgshapiro# etc must be last for "distribute" to work
69119553Sphk.if exists(etc) && make(distribute)
70119553SphkSUBDIR+= etc
71119553Sphk.endif
72119553Sphk
7334689Sbde# These are last, since it is nice to at least get the base system
74125123Semax# rebuilt before you do them.
75125123Semax.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
76125123SemaxSUBDIR+= local
77125123Semax.endif
7838477Sgpalmer.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
7952228SbpSUBDIR+= ports
8087960Ssheldonh.endif
8134689Sbde
8236026Sjb# Handle the -DNOOBJDIR and -DNOCLEANDIR
8334689Sbde.if defined(NOOBJDIR)
8441912SdfrOBJDIR=
8541912Sdfr.else
8672309SobrienOBJDIR=		obj
8741912Sdfr.endif
8841912Sdfr.if defined(NOCLEANDIR)
89117950SpeterCLEANDIR=	clean
90117950Speter.else 
91117950SpeterCLEANDIR=	cleandir
92118694Sdeischen.endif
93118694Sdeischen
94126032Smarcelworld:	hierarchy mk cleandist includes lib-tools libraries tools
95118675Sdeischen	@echo "--------------------------------------------------------------"
96118675Sdeischen	@echo " Rebuilding ${DESTDIR} The whole thing"
97117950Speter	@echo "--------------------------------------------------------------"
98118675Sdeischen	@echo
99117950Speter	${MAKE} depend all install
100129225Scognet	cd ${.CURDIR}/share/man &&		${MAKE} makedb
101117797Smtm
102117797Smtmhierarchy:
103117797Smtm	@echo "--------------------------------------------------------------"
104117797Smtm	@echo " Making hierarchy"
105117797Smtm	@echo "--------------------------------------------------------------"
106129225Scognet	cd ${.CURDIR}/etc &&		${MAKE} distrib-dirs
107129225Scognet
108129225Scognetupdate:
109129225Scognet.if defined(SUP_UPDATE)
110117978Smarkm	@echo "--------------------------------------------------------------"
11181054Ssobomax	@echo "Running sup"
11281054Ssobomax	@echo "--------------------------------------------------------------"
11381054Ssobomax	@sup -v ${SUPFILE}
114126799Sphk.endif
115126799Sphk.if defined(CVS_UPDATE)
116126799Sphk	@echo "--------------------------------------------------------------"
117126799Sphk	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
1181573Srgrimes	@echo "--------------------------------------------------------------"
119	cd ${.CURDIR} &&  cvs update -P -d
120.endif
121
122cleandist:
123.if !defined(NOCLEANDIR)
124	@echo "--------------------------------------------------------------"
125	@echo " Cleaning up the source tree, and rebuilding the obj tree"
126	@echo "--------------------------------------------------------------"
127	@echo
128	here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
129	if test -d /usr/obj -a ! -d $$dest; then \
130		mkdir -p $$dest; \
131	else \
132		true; \
133	fi; \
134	cd $$dest && rm -rf ${SUBDIR}
135	find . -name obj | xargs rm -rf
136.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
137	# The cd is done as local may well be a symbolic link
138	-cd local && find . -name obj | xargs rm -rf
139.endif
140.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
141	# The cd is done as local may well be a symbolic link
142	-cd ports && find . -name obj | xargs rm -rf
143.endif
144	${MAKE} cleandir
145	${MAKE} obj
146.endif
147
148installmost:
149	@echo "--------------------------------------------------------------"
150	@echo " Installing programs only"
151	@echo "--------------------------------------------------------------"
152	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} install
153	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} install
154	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} install
155	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} install
156	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} install
157	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} install
158	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} install
159	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} install
160#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
161#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} installmost
162#.endif
163#.if !defined(NOSECURE) && !defined(NOCRYPT)
164#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} installmost
165#.endif
166
167most:
168	@echo "--------------------------------------------------------------"
169	@echo " Building programs only"
170	@echo "--------------------------------------------------------------"
171	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} all
172	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} all
173	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} all
174	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} all
175	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} all
176	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} all
177	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} all
178	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} install
179#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
180#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} most
181#.endif
182#.if !defined(NOSECURE) && !defined(NOCRYPT)
183#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} most
184#.endif
185
186mk:
187	@echo "--------------------------------------------------------------"
188	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
189	@echo "--------------------------------------------------------------"
190	cd ${.CURDIR}/share/mk &&		${MAKE} install
191
192includes:
193	@echo "--------------------------------------------------------------"
194	@echo " Rebuilding ${DESTDIR}/usr/include"
195	@echo "--------------------------------------------------------------"
196	@echo
197.if defined(CLOBBER)
198	rm -rf ${DESTDIR}/usr/include/*
199	mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
200		-p ${DESTDIR}/usr/include
201.endif
202	cd ${.CURDIR}/include &&		${MAKE} install
203	cd ${.CURDIR}/gnu/include &&		${MAKE}	install
204	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
205	cd ${.CURDIR}/gnu/lib/libregex &&	${MAKE} beforeinstall
206	cd ${.CURDIR}/gnu/lib/libg++ &&         ${MAKE} beforeinstall
207	cd ${.CURDIR}/gnu/lib/libdialog &&      ${MAKE} beforeinstall
208.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
209	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
210.endif
211	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
212	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
213	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
214	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
215	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE}	beforeinstall
216	cd ${.CURDIR}/lib/libncurses &&		${MAKE}	beforeinstall
217.if !defined(WANT_CSRG_LIBM)
218	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
219.endif
220	cd ${.CURDIR}/lib/libpcap &&		${MAKE} beforeinstall
221	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
222	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
223	cd ${.CURDIR}/lib/libtermcap &&		${MAKE}	beforeinstall
224	cd ${.CURDIR}/lib/libcom_err &&		${MAKE} beforeinstall
225	cd ${.CURDIR}/lib/libss &&		${MAKE} beforeinstall
226	cd ${.CURDIR}/lib/libforms &&		${MAKE}	beforeinstall
227	cd ${.CURDIR}/lib/libscsi &&		${MAKE}	beforeinstall
228
229lib-tools:
230	@echo "--------------------------------------------------------------"
231	@echo " Rebuilding tools needed to build the libraries"
232	@echo "--------------------------------------------------------------"
233	@echo
234	cd ${.CURDIR}/usr.bin/ar && \
235		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
236	cd ${.CURDIR}/usr.bin/ranlib && \
237		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
238	cd ${.CURDIR}/usr.bin/nm && \
239		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
240	cd ${.CURDIR}/usr.bin/lex/lib && \
241		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
242	cd ${.CURDIR}/usr.bin/compile_et && \
243		${MAKE} depend all install ${CLEANDIR} ${OBJDIR} && \
244		rm -f /usr/sbin/compile_et
245	cd ${.CURDIR}/usr.bin/mk_cmds && \
246		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
247
248libraries:
249	@echo "--------------------------------------------------------------"
250	@echo " Rebuilding ${DESTDIR}/usr/lib"
251	@echo "--------------------------------------------------------------"
252	@echo
253.if defined(CLOBBER)
254	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
255		xargs rm -rf
256.endif
257	cd ${.CURDIR}/gnu/lib && \
258		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
259	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
260		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
261.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
262	cd ${.CURDIR}/secure/lib && \
263		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
264.endif
265.if exists(lib)
266	cd ${.CURDIR}/lib/csu/i386 && \
267		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
268	cd ${.CURDIR}/lib && \
269		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
270.endif
271	cd ${.CURDIR}/usr.bin/lex/lib && \
272		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
273.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
274	cd ${.CURDIR}/eBones/des && \
275		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
276	cd ${.CURDIR}/eBones/acl && \
277		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
278	cd ${.CURDIR}/eBones/kdb && \
279		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
280	cd ${.CURDIR}/eBones/krb && \
281		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
282.endif
283
284tools:
285	@echo "--------------------------------------------------------------"
286	@echo " Rebuilding ${DESTDIR} Compiler and Make"
287	@echo "--------------------------------------------------------------"
288	@echo
289	cd ${.CURDIR}/gnu/usr.bin/cc && \
290		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
291	cd ${.CURDIR}/usr.bin/make && \
292		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
293
294.include <bsd.subdir.mk>
295