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