Makefile revision 5573
1#
2#	$Id: Makefile,v 1.33 1995/01/11 11:52:50 jkh 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# Must be first for "distribute" to work
21.if exists(release)
22SUBDIR+= release
23.endif
24
25.if exists(bin)
26SUBDIR+= bin
27.endif
28.if exists(contrib)
29SUBDIR+= contrib
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(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
44SUBDIR+= eBones
45.endif
46.if exists(libexec)
47SUBDIR+= libexec
48.endif
49.if exists(sbin)
50SUBDIR+= sbin
51.endif
52.if exists(share)
53SUBDIR+= share
54.endif
55.if exists(sys)
56SUBDIR+= sys
57.endif
58.if exists(usr.bin)
59SUBDIR+= usr.bin
60.endif
61.if exists(usr.sbin)
62SUBDIR+= usr.sbin
63.endif
64.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
65SUBDIR+= secure
66.endif
67.if exists(lkm) && !defined(NOLKM)
68SUBDIR+= lkm
69.endif
70
71# etc must be last for "distribute" to work
72.if exists(etc) && make(distribute)
73SUBDIR+= etc
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:	hierarchy mk cleandist includes lib-tools 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
106hierarchy:
107	@echo "--------------------------------------------------------------"
108	@echo " Making hierarchy"
109	@echo "--------------------------------------------------------------"
110	cd ${.CURDIR}/release &&		${MAKE} hierarchy
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
152installmost:
153	@echo "--------------------------------------------------------------"
154	@echo " Installing programs only"
155	@echo "--------------------------------------------------------------"
156	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} install
157	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} install
158	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} install
159	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} install
160	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} install
161	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} install
162	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} install
163#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
164#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} installmost
165#.endif
166#.if !defined(NOSECURE) && !defined(NOCRYPT)
167#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} installmost
168#.endif
169
170most:
171	@echo "--------------------------------------------------------------"
172	@echo " Building programs only"
173	@echo "--------------------------------------------------------------"
174	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} all
175	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} all
176	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} all
177	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} all
178	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} all
179	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} all
180	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} all
181#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
182#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} most
183#.endif
184#.if !defined(NOSECURE) && !defined(NOCRYPT)
185#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} most
186#.endif
187
188mk:
189	@echo "--------------------------------------------------------------"
190	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
191	@echo "--------------------------------------------------------------"
192	cd ${.CURDIR}/share/mk &&		${MAKE} install
193
194includes:
195	@echo "--------------------------------------------------------------"
196	@echo " Rebuilding ${DESTDIR}/usr/include"
197	@echo "--------------------------------------------------------------"
198	@echo
199.if defined(CLOBBER)
200	rm -rf ${DESTDIR}/usr/include
201	mkdir ${DESTDIR}/usr/include
202	chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include
203	chmod 755 ${DESTDIR}/usr/include
204.endif
205	cd ${.CURDIR}/include &&		${MAKE} install
206	cd ${.CURDIR}/gnu/include &&		${MAKE}	install
207	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
208	cd ${.CURDIR}/gnu/lib/libg++ &&         ${MAKE} beforeinstall
209	cd ${.CURDIR}/gnu/lib/libdialog &&      ${MAKE} beforeinstall
210.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
211	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
212.endif
213	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
214	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
215	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
216	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
217	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE}	beforeinstall
218	cd ${.CURDIR}/lib/libncurses &&		${MAKE}	beforeinstall
219.if defined(WANT_MSUN)
220	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
221.endif
222	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
223	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
224	cd ${.CURDIR}/lib/libtermcap &&		${MAKE}	beforeinstall
225
226lib-tools:
227	@echo "--------------------------------------------------------------"
228	@echo " Rebuilding tools needed to build the libraries
229	@echo "--------------------------------------------------------------"
230	@echo
231	cd ${.CURDIR}/usr.bin/ar && \
232		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
233	cd ${.CURDIR}/usr.bin/ranlib && \
234		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
235	cd ${.CURDIR}/usr.bin/nm && \
236		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
237
238libraries:
239	@echo "--------------------------------------------------------------"
240	@echo " Rebuilding ${DESTDIR}/usr/lib"
241	@echo "--------------------------------------------------------------"
242	@echo
243.if defined(CLOBBER)
244	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
245		xargs rm -rf
246.endif
247	cd ${.CURDIR}/gnu/lib && \
248		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
249	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
250		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
251.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
252	cd ${.CURDIR}/secure/lib && \
253		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
254.endif
255.if exists(lib)
256	cd ${.CURDIR}/lib/csu/i386 && \
257		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
258	cd ${.CURDIR}/lib && \
259		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
260.endif
261	cd ${.CURDIR}/usr.bin/lex/lib && \
262		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
263.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
264	cd ${.CURDIR}/eBones/des && \
265		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
266	cd ${.CURDIR}/eBones/acl && \
267		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
268	cd ${.CURDIR}/eBones/kdb && \
269		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
270	cd ${.CURDIR}/eBones/krb && \
271		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
272.endif
273
274tools:
275	@echo "--------------------------------------------------------------"
276	@echo " Rebuilding ${DESTDIR} Compiler and Make"
277	@echo "--------------------------------------------------------------"
278	@echo
279	cd ${.CURDIR}/gnu/usr.bin/cc && \
280		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
281	cd ${.CURDIR}/usr.bin/make && \
282		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
283
284.include <bsd.subdir.mk>
285