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