Makefile revision 2883
1#
2#	$Id: Makefile,v 1.18 1994/09/16 20:24:15 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#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
9#	-DNOCRYPT will prevent building of crypt versions
10# XXX2	-DNOKERBEROS do not build Kerberos
11#	-DNOLKM do not build loadable kernel modules
12#	-DNOOBJDIR do not run ``${MAKE} obj''
13#	-DNOPROFILE do not build profiled libraries
14#	-DNOSECURE do not go into secure subdir
15#	-DNOEBONES do not make eBones (kerberosIV)
16#
17# XXX2	Mandatory, and Kerberos will not build sucessfully yet
18
19# Put initial settings here.
20NOKERBEROS=	yes
21SUBDIR=
22
23.if exists(bin)
24SUBDIR+= bin
25.endif
26.if exists(contrib)
27SUBDIR+= contrib
28.endif
29.if exists(etc)
30SUBDIR+= etc
31.endif
32.if exists(games)
33SUBDIR+= games
34.endif
35.if exists(gnu)
36SUBDIR+= gnu
37.endif
38.if exists(include)
39SUBDIR+= include
40.endif
41.if exists(lib)
42SUBDIR+= lib
43.endif
44.if exists(kerberosIV) && !defined(NOCRYPT) && !defined(NOKERBEROS)
45SUBDIR+= kerberosIV
46.endif
47.if exists(eBones) && !defined(NOCRYPT) && defined(NOKERBEROS) \
48			&& !defined(NOEBONES)
49SUBDIR+= eBones
50.endif
51.if exists(libexec)
52SUBDIR+= libexec
53.endif
54.if exists(sbin)
55SUBDIR+= sbin
56.endif
57.if exists(share)
58SUBDIR+= share
59.endif
60.if exists(sys)
61SUBDIR+= sys
62.endif
63.if exists(usr.bin)
64SUBDIR+= usr.bin
65.endif
66.if exists(usr.sbin)
67SUBDIR+= usr.sbin
68.endif
69.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
70SUBDIR+= secure
71.endif
72.if exists(lkm) && !defined(NOLKM)
73SUBDIR+= lkm
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:	directories cleandist mk includes 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
106directories:
107	@echo "--------------------------------------------------------------"
108	@echo " Making directories"
109	@echo "--------------------------------------------------------------"
110	cd ${.CURDIR}/etc &&			${MAKE} distrib-dirs
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
152mk:
153	@echo "--------------------------------------------------------------"
154	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
155	@echo "--------------------------------------------------------------"
156	cd ${.CURDIR}/share/mk &&		${MAKE} install
157
158includes:
159	@echo "--------------------------------------------------------------"
160	@echo " Rebuilding ${DESTDIR}/usr/include"
161	@echo "--------------------------------------------------------------"
162	@echo
163.if defined(CLOBBER)
164	rm -rf ${DESTDIR}/usr/include
165	mkdir ${DESTDIR}/usr/include
166	chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include
167	chmod 755 ${DESTDIR}/usr/include
168.endif
169	cd ${.CURDIR}/include &&		${MAKE} install
170	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
171	cd ${.CURDIR}/gnu/lib/libg++ &&         ${MAKE} beforeinstall
172.if exists(kerberosIV) && !defined(NOCRYPT) && !defined(NOKERBEROS)
173	cd ${.CURDIR}/kerberosIV/include &&	${MAKE} install
174.endif
175	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
176	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
177	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
178	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
179	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
180.if exists(eBones) && !defined(NOCRYPT) && defined(NOKERBEROS) && \
181			!defined(NOEBONES)
182	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
183.endif
184
185libraries:
186	@echo "--------------------------------------------------------------"
187	@echo " Rebuilding ${DESTDIR}/usr/lib"
188	@echo "--------------------------------------------------------------"
189	@echo
190.if defined(CLOBBER)
191	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
192		xargs rm -rf
193.endif
194	cd ${.CURDIR}/gnu/lib && \
195		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
196	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
197		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
198.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
199	cd ${.CURDIR}/secure/lib && \
200		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
201.endif
202.if exists(lib)
203	cd ${.CURDIR}/lib && \
204		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
205.endif
206	cd ${.CURDIR}/usr.bin/lex/lib && \
207		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
208.if exists(kerberosIV) && !defined(NOCRYPT) && !defined(NOKERBEROS)
209	cd ${.CURDIR}/kerberosIV/acl && \
210		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
211	cd ${.CURDIR}/kerberosIV/des && \
212		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
213	cd ${.CURDIR}/kerberosIV/kdb && \
214		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
215	cd ${.CURDIR}/kerberosIV/krb && \
216		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
217.endif
218.if exists(eBones) && !defined(NOCRYPT) && defined(NOKERBEROS) && \
219			!defined(NOEBONES)
220	cd ${.CURDIR}/eBones/des && \
221		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
222	cd ${.CURDIR}/eBones/acl && \
223		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
224	cd ${.CURDIR}/eBones/kdb && \
225		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
226	cd ${.CURDIR}/eBones/krb && \
227		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
228.endif
229
230tools:
231	@echo "--------------------------------------------------------------"
232	@echo " Rebuilding ${DESTDIR} Compiler and Make"
233	@echo "--------------------------------------------------------------"
234	@echo
235	cd ${.CURDIR}/gnu/usr.bin/cc && \
236		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
237	cd ${.CURDIR}/usr.bin/make && \
238		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
239
240.include <bsd.subdir.mk>
241