Makefile revision 5865
1#
2#	$Id: Makefile,v 1.37 1995/01/21 23:01:19 wollman 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# Must be first for "distribute" to work
21.if exists(release)
22SUBDIR+= release
23.endif
24
25.if exists(bin)
26SUBDIR+= bin
27.endif
28.if exists(contrib)
29SUBDIR+= contrib
30.endif
31.if exists(games)
32SUBDIR+= games
33.endif
34.if exists(gnu)
35SUBDIR+= gnu
36.endif
37.if exists(include)
38SUBDIR+= include
39.endif
40.if exists(lib)
41SUBDIR+= lib
42.endif
43.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
44SUBDIR+= eBones
45.endif
46.if exists(libexec)
47SUBDIR+= libexec
48.endif
49.if exists(sbin)
50SUBDIR+= sbin
51.endif
52.if exists(share)
53SUBDIR+= share
54.endif
55.if exists(sys)
56SUBDIR+= sys
57.endif
58.if exists(usr.bin)
59SUBDIR+= usr.bin
60.endif
61.if exists(usr.sbin)
62SUBDIR+= usr.sbin
63.endif
64.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
65SUBDIR+= secure
66.endif
67.if exists(lkm) && !defined(NOLKM)
68SUBDIR+= lkm
69.endif
70
71# etc must be last for "distribute" to work
72.if exists(etc) && make(distribute)
73SUBDIR+= etc
74.endif
75
76# These are last, since it is nice to at least get the base system
77# rebuilt before you do them.
78.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
79SUBDIR+= local
80.endif
81.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
82SUBDIR+= ports
83.endif
84
85# Handle the -DNOOBJDIR and -DNOCLEANDIR
86.if defined(NOOBJDIR)
87OBJDIR=
88.else
89OBJDIR=		obj
90.endif
91.if defined(NOCLEANDIR)
92CLEANDIR=	clean
93.else 
94CLEANDIR=	cleandir
95.endif
96
97world:	hierarchy mk cleandist includes lib-tools libraries tools
98	@echo "--------------------------------------------------------------"
99	@echo " Rebuilding ${DESTDIR} The whole thing"
100	@echo "--------------------------------------------------------------"
101	@echo
102	${MAKE} depend all install
103	cd ${.CURDIR}/share/man &&		${MAKE} makedb
104
105
106hierarchy:
107	@echo "--------------------------------------------------------------"
108	@echo " Making hierarchy"
109	@echo "--------------------------------------------------------------"
110	cd ${.CURDIR}/release &&		${MAKE} hierarchy
111
112update:
113.if defined(SUP_UPDATE)
114	@echo "--------------------------------------------------------------"
115	@echo "Running sup"
116	@echo "--------------------------------------------------------------"
117	@sup -v ${SUPFILE}
118.endif
119.if defined(CVS_UPDATE)
120	@echo "--------------------------------------------------------------"
121	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
122	@echo "--------------------------------------------------------------"
123	cd ${.CURDIR} &&  cvs update -P -d
124.endif
125
126cleandist:
127.if !defined(NOCLEANDIR)
128	@echo "--------------------------------------------------------------"
129	@echo " Cleaning up the source tree, and rebuilding the obj tree"
130	@echo "--------------------------------------------------------------"
131	@echo
132	here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
133	if test -d /usr/obj -a ! -d $$dest; then \
134		mkdir -p $$dest; \
135	else \
136		true; \
137	fi; \
138	cd $$dest && rm -rf ${SUBDIR}
139	find . -name obj | xargs rm -rf
140.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
141	# The cd is done as local may well be a symbolic link
142	-cd local && find . -name obj | xargs rm -rf
143.endif
144.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
145	# The cd is done as local may well be a symbolic link
146	-cd ports && find . -name obj | xargs rm -rf
147.endif
148	${MAKE} cleandir
149	${MAKE} obj
150.endif
151
152installmost:
153	@echo "--------------------------------------------------------------"
154	@echo " Installing programs only"
155	@echo "--------------------------------------------------------------"
156	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} install
157	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} install
158	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} install
159	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} install
160	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} install
161	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} install
162	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} install
163#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
164#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} installmost
165#.endif
166#.if !defined(NOSECURE) && !defined(NOCRYPT)
167#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} installmost
168#.endif
169
170most:
171	@echo "--------------------------------------------------------------"
172	@echo " Building programs only"
173	@echo "--------------------------------------------------------------"
174	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} all
175	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} all
176	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} all
177	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} all
178	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} all
179	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} all
180	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} all
181#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
182#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} most
183#.endif
184#.if !defined(NOSECURE) && !defined(NOCRYPT)
185#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} most
186#.endif
187
188mk:
189	@echo "--------------------------------------------------------------"
190	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
191	@echo "--------------------------------------------------------------"
192	cd ${.CURDIR}/share/mk &&		${MAKE} install
193
194includes:
195	@echo "--------------------------------------------------------------"
196	@echo " Rebuilding ${DESTDIR}/usr/include"
197	@echo "--------------------------------------------------------------"
198	@echo
199.if defined(CLOBBER)
200	rm -rf ${DESTDIR}/usr/include
201	mkdir ${DESTDIR}/usr/include
202	chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include
203	chmod 755 ${DESTDIR}/usr/include
204.endif
205	cd ${.CURDIR}/include &&		${MAKE} install
206	cd ${.CURDIR}/gnu/include &&		${MAKE}	install
207	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
208	cd ${.CURDIR}/gnu/lib/libg++ &&         ${MAKE} beforeinstall
209	cd ${.CURDIR}/gnu/lib/libdialog &&      ${MAKE} beforeinstall
210.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
211	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
212.endif
213	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
214	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
215	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
216	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
217	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE}	beforeinstall
218	cd ${.CURDIR}/lib/libncurses &&		${MAKE}	beforeinstall
219.if defined(WANT_MSUN)
220	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
221.endif
222	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
223	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
224	cd ${.CURDIR}/lib/libtermcap &&		${MAKE}	beforeinstall
225	cd ${.CURDIR}/lib/libcom_err &&		${MAKE} beforeinstall
226	cd ${.CURDIR}/lib/libss &&		${MAKE} beforeinstall
227	cd ${.CURDIR}/lib/libforms &&		${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