Makefile revision 3518
1#
2#	$Id: Makefile,v 1.25 1994/10/08 15:08:14 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.if exists(bin)
27SUBDIR+= bin
28.endif
29.if exists(contrib)
30SUBDIR+= contrib
31.endif
32.if exists(etc)
33# XXX until etc vs release conversion is done
34# SUBDIR+= etc
35.endif
36.if exists(games)
37SUBDIR+= games
38.endif
39.if exists(gnu)
40SUBDIR+= gnu
41.endif
42.if exists(include)
43SUBDIR+= include
44.endif
45.if exists(lib)
46SUBDIR+= lib
47.endif
48.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS)
49SUBDIR+= kerberosIV
50.endif
51.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
52SUBDIR+= eBones
53.endif
54.if exists(libexec)
55SUBDIR+= libexec
56.endif
57.if exists(sbin)
58SUBDIR+= sbin
59.endif
60.if exists(share)
61SUBDIR+= share
62.endif
63.if exists(sys)
64SUBDIR+= sys
65.endif
66.if exists(usr.bin)
67SUBDIR+= usr.bin
68.endif
69.if exists(usr.sbin)
70SUBDIR+= usr.sbin
71.endif
72.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
73SUBDIR+= secure
74.endif
75.if exists(lkm) && !defined(NOLKM)
76SUBDIR+= lkm
77.endif
78
79# These are last, since it is nice to at least get the base system
80# rebuilt before you do them.
81.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
82SUBDIR+= local
83.endif
84.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
85SUBDIR+= ports
86.endif
87
88# Handle the -DNOOBJDIR and -DNOCLEANDIR
89.if defined(NOOBJDIR)
90OBJDIR=
91.else
92OBJDIR=		obj
93.endif
94.if defined(NOCLEANDIR)
95CLEANDIR=	clean
96.else 
97CLEANDIR=	cleandir
98.endif
99
100world:	hierarchy cleandist mk includes libraries tools
101	@echo "--------------------------------------------------------------"
102	@echo " Rebuilding ${DESTDIR} The whole thing"
103	@echo "--------------------------------------------------------------"
104	@echo
105	${MAKE} depend all install
106	cd ${.CURDIR}/share/man &&		${MAKE} makedb
107
108
109hierarchy:
110	@echo "--------------------------------------------------------------"
111	@echo " Making hierarchy"
112	@echo "--------------------------------------------------------------"
113	cd ${.CURDIR}/release &&		${MAKE} hierarchy
114
115update:
116.if defined(SUP_UPDATE)
117	@echo "--------------------------------------------------------------"
118	@echo "Running sup"
119	@echo "--------------------------------------------------------------"
120	@sup -v ${SUPFILE}
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
155mk:
156	@echo "--------------------------------------------------------------"
157	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
158	@echo "--------------------------------------------------------------"
159	cd ${.CURDIR}/share/mk &&		${MAKE} install
160
161includes:
162	@echo "--------------------------------------------------------------"
163	@echo " Rebuilding ${DESTDIR}/usr/include"
164	@echo "--------------------------------------------------------------"
165	@echo
166.if defined(CLOBBER)
167	rm -rf ${DESTDIR}/usr/include
168	mkdir ${DESTDIR}/usr/include
169	chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include
170	chmod 755 ${DESTDIR}/usr/include
171.endif
172	cd ${.CURDIR}/include &&		${MAKE} install
173	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
174	cd ${.CURDIR}/gnu/lib/libg++ &&         ${MAKE} beforeinstall
175	cd ${.CURDIR}/gnu/lib/libdialog &&      ${MAKE} beforeinstall
176.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS)
177	cd ${.CURDIR}/kerberosIV/include &&	${MAKE} install
178.endif
179.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
180	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
181.endif
182	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
183	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
184	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
185	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
186	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE}	beforeinstall
187	cd ${.CURDIR}/lib/libncurses &&		${MAKE}	beforeinstall
188.if defined(WANT_MSUN)
189	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
190.endif
191	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
192	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
193
194libraries:
195	@echo "--------------------------------------------------------------"
196	@echo " Rebuilding ${DESTDIR}/usr/lib"
197	@echo "--------------------------------------------------------------"
198	@echo
199.if defined(CLOBBER)
200	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
201		xargs rm -rf
202.endif
203	cd ${.CURDIR}/gnu/lib && \
204		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
205	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
206		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
207.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
208	cd ${.CURDIR}/secure/lib && \
209		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
210.endif
211.if exists(lib)
212	cd ${.CURDIR}/lib && \
213		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
214.endif
215	cd ${.CURDIR}/usr.bin/lex/lib && \
216		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
217.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS)
218	cd ${.CURDIR}/kerberosIV/acl && \
219		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
220	cd ${.CURDIR}/kerberosIV/des && \
221		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
222	cd ${.CURDIR}/kerberosIV/kdb && \
223		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
224	cd ${.CURDIR}/kerberosIV/krb && \
225		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
226.endif
227.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
228	cd ${.CURDIR}/eBones/des && \
229		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
230	cd ${.CURDIR}/eBones/acl && \
231		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
232	cd ${.CURDIR}/eBones/kdb && \
233		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
234	cd ${.CURDIR}/eBones/krb && \
235		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
236.endif
237
238tools:
239	@echo "--------------------------------------------------------------"
240	@echo " Rebuilding ${DESTDIR} Compiler and Make"
241	@echo "--------------------------------------------------------------"
242	@echo
243	cd ${.CURDIR}/gnu/usr.bin/cc && \
244		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
245	cd ${.CURDIR}/usr.bin/make && \
246		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
247
248.include <bsd.subdir.mk>
249