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