Makefile revision 5366
1#
2#	$Id: Makefile,v 1.31 1994/12/04 02:46:28 ache 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# XXX1	-DMAKE_KERBEROS to build KerberosIV
9#	-DMAKE_EBONES to build eBones (KerberosIV)
10#
11#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
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#
19# XXX1	The kerberos IV off the 4.4-Lite tape (src/kerberosIV)
20#	will not build successfully yet.  MAKE_KERBEROS should not be
21#	defined.
22
23# Put initial settings here.
24SUBDIR=
25
26# Must be first for "distribute" to work
27.if exists(release)
28SUBDIR+= release
29.endif
30
31.if exists(bin)
32SUBDIR+= bin
33.endif
34.if exists(contrib)
35SUBDIR+= contrib
36.endif
37.if exists(games)
38SUBDIR+= games
39.endif
40.if exists(gnu)
41SUBDIR+= gnu
42.endif
43.if exists(include)
44SUBDIR+= include
45.endif
46.if exists(lib)
47SUBDIR+= lib
48.endif
49.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS)
50SUBDIR+= kerberosIV
51.endif
52.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
53SUBDIR+= eBones
54.endif
55.if exists(libexec)
56SUBDIR+= libexec
57.endif
58.if exists(sbin)
59SUBDIR+= sbin
60.endif
61.if exists(share)
62SUBDIR+= share
63.endif
64.if exists(sys)
65SUBDIR+= sys
66.endif
67.if exists(usr.bin)
68SUBDIR+= usr.bin
69.endif
70.if exists(usr.sbin)
71SUBDIR+= usr.sbin
72.endif
73.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
74SUBDIR+= secure
75.endif
76.if exists(lkm) && !defined(NOLKM)
77SUBDIR+= lkm
78.endif
79
80# etc must be last for "distribute" to work
81.if exists(etc) && make(distribute)
82SUBDIR+= etc
83.endif
84
85# These are last, since it is nice to at least get the base system
86# rebuilt before you do them.
87.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
88SUBDIR+= local
89.endif
90.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
91SUBDIR+= ports
92.endif
93
94# Handle the -DNOOBJDIR and -DNOCLEANDIR
95.if defined(NOOBJDIR)
96OBJDIR=
97.else
98OBJDIR=		obj
99.endif
100.if defined(NOCLEANDIR)
101CLEANDIR=	clean
102.else 
103CLEANDIR=	cleandir
104.endif
105
106world:	hierarchy cleandist mk includes lib-tools libraries tools
107	@echo "--------------------------------------------------------------"
108	@echo " Rebuilding ${DESTDIR} The whole thing"
109	@echo "--------------------------------------------------------------"
110	@echo
111	${MAKE} depend all install
112	cd ${.CURDIR}/share/man &&		${MAKE} makedb
113
114
115hierarchy:
116	@echo "--------------------------------------------------------------"
117	@echo " Making hierarchy"
118	@echo "--------------------------------------------------------------"
119	cd ${.CURDIR}/release &&		${MAKE} hierarchy
120
121update:
122.if defined(SUP_UPDATE)
123	@echo "--------------------------------------------------------------"
124	@echo "Running sup"
125	@echo "--------------------------------------------------------------"
126	@sup -v ${SUPFILE}
127.endif
128.if defined(CVS_UPDATE)
129	@echo "--------------------------------------------------------------"
130	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
131	@echo "--------------------------------------------------------------"
132	cd ${.CURDIR} &&  cvs update -P -d
133.endif
134
135cleandist:
136.if !defined(NOCLEANDIR)
137	@echo "--------------------------------------------------------------"
138	@echo " Cleaning up the source tree, and rebuilding the obj tree"
139	@echo "--------------------------------------------------------------"
140	@echo
141	here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
142	if test -d /usr/obj -a ! -d $$dest; then \
143		mkdir -p $$dest; \
144	else \
145		true; \
146	fi; \
147	cd $$dest && rm -rf ${SUBDIR}
148	find . -name obj | xargs rm -rf
149.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
150	# The cd is done as local may well be a symbolic link
151	-cd local && find . -name obj | xargs rm -rf
152.endif
153.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
154	# The cd is done as local may well be a symbolic link
155	-cd ports && find . -name obj | xargs rm -rf
156.endif
157	${MAKE} cleandir
158	${MAKE} obj
159.endif
160
161installmost:
162	@echo "--------------------------------------------------------------"
163	@echo " Installing programs only"
164	@echo "--------------------------------------------------------------"
165	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} install
166	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} install
167	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} install
168	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} install
169	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} install
170	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} install
171	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} install
172#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
173#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} installmost
174#.endif
175#.if !defined(NOSECURE) && !defined(NOCRYPT)
176#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} installmost
177#.endif
178
179most:
180	@echo "--------------------------------------------------------------"
181	@echo " Building programs only"
182	@echo "--------------------------------------------------------------"
183	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} all
184	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} all
185	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} all
186	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} all
187	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} all
188	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} all
189	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} all
190#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
191#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} most
192#.endif
193#.if !defined(NOSECURE) && !defined(NOCRYPT)
194#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} most
195#.endif
196
197mk:
198	@echo "--------------------------------------------------------------"
199	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
200	@echo "--------------------------------------------------------------"
201	cd ${.CURDIR}/share/mk &&		${MAKE} install
202
203includes:
204	@echo "--------------------------------------------------------------"
205	@echo " Rebuilding ${DESTDIR}/usr/include"
206	@echo "--------------------------------------------------------------"
207	@echo
208.if defined(CLOBBER)
209	rm -rf ${DESTDIR}/usr/include
210	mkdir ${DESTDIR}/usr/include
211	chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include
212	chmod 755 ${DESTDIR}/usr/include
213.endif
214	cd ${.CURDIR}/include &&		${MAKE} install
215	cd ${.CURDIR}/gnu/include &&		${MAKE}	install
216	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
217	cd ${.CURDIR}/gnu/lib/libg++ &&         ${MAKE} beforeinstall
218	cd ${.CURDIR}/gnu/lib/libdialog &&      ${MAKE} beforeinstall
219.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS)
220	cd ${.CURDIR}/kerberosIV/include &&	${MAKE} install
221.endif
222.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
223	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
224.endif
225	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
226	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
227	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
228	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
229	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE}	beforeinstall
230	cd ${.CURDIR}/lib/libncurses &&		${MAKE}	beforeinstall
231.if defined(WANT_MSUN)
232	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
233.endif
234	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
235	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
236	cd ${.CURDIR}/lib/libtermcap &&		${MAKE}	beforeinstall
237
238lib-tools:
239	@echo "--------------------------------------------------------------"
240	@echo " Rebuilding tools needed to build the libraries
241	@echo "--------------------------------------------------------------"
242	@echo
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
250libraries:
251	@echo "--------------------------------------------------------------"
252	@echo " Rebuilding ${DESTDIR}/usr/lib"
253	@echo "--------------------------------------------------------------"
254	@echo
255.if defined(CLOBBER)
256	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
257		xargs rm -rf
258.endif
259	cd ${.CURDIR}/gnu/lib && \
260		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
261	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
262		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
263.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
264	cd ${.CURDIR}/secure/lib && \
265		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
266.endif
267.if exists(lib)
268	cd ${.CURDIR}/lib/csu/i386 && \
269		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
270	cd ${.CURDIR}/lib && \
271		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
272.endif
273	cd ${.CURDIR}/usr.bin/lex/lib && \
274		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
275.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS)
276	cd ${.CURDIR}/kerberosIV/acl && \
277		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
278	cd ${.CURDIR}/kerberosIV/des && \
279		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
280	cd ${.CURDIR}/kerberosIV/kdb && \
281		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
282	cd ${.CURDIR}/kerberosIV/krb && \
283		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
284.endif
285.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
286	cd ${.CURDIR}/eBones/des && \
287		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
288	cd ${.CURDIR}/eBones/acl && \
289		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
290	cd ${.CURDIR}/eBones/kdb && \
291		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
292	cd ${.CURDIR}/eBones/krb && \
293		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
294.endif
295
296tools:
297	@echo "--------------------------------------------------------------"
298	@echo " Rebuilding ${DESTDIR} Compiler and Make"
299	@echo "--------------------------------------------------------------"
300	@echo
301	cd ${.CURDIR}/gnu/usr.bin/cc && \
302		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
303	cd ${.CURDIR}/usr.bin/make && \
304		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
305
306.include <bsd.subdir.mk>
307