Makefile revision 7292
1#
2#	$Id: Makefile,v 1.49 1995/03/23 19:03:02 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#	-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# do include first.
21.if exists(include)
22SUBDIR+= include
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(lib)
38SUBDIR+= lib
39.endif
40.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
41SUBDIR+= eBones
42.endif
43.if exists(libexec)
44SUBDIR+= libexec
45.endif
46.if exists(sbin)
47SUBDIR+= sbin
48.endif
49.if exists(share)
50SUBDIR+= share
51.endif
52.if exists(sys)
53SUBDIR+= sys
54.endif
55.if exists(usr.bin)
56SUBDIR+= usr.bin
57.endif
58.if exists(usr.sbin)
59SUBDIR+= usr.sbin
60.endif
61.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
62SUBDIR+= secure
63.endif
64.if exists(lkm) && !defined(NOLKM)
65SUBDIR+= lkm
66.endif
67
68# etc must be last for "distribute" to work
69.if exists(etc) && make(distribute)
70SUBDIR+= etc
71.endif
72
73# These are last, since it is nice to at least get the base system
74# rebuilt before you do them.
75.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
76SUBDIR+= local
77.endif
78.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
79SUBDIR+= ports
80.endif
81
82# Handle the -DNOOBJDIR and -DNOCLEANDIR
83.if defined(NOOBJDIR)
84OBJDIR=
85.else
86OBJDIR=		obj
87.endif
88.if defined(NOCLEANDIR)
89CLEANDIR=	clean
90.else 
91CLEANDIR=	cleandir
92.endif
93
94world:	hierarchy mk cleandist includes lib-tools libraries tools
95	@echo "--------------------------------------------------------------"
96	@echo " Rebuilding ${DESTDIR} The whole thing"
97	@echo "--------------------------------------------------------------"
98	@echo
99	${MAKE} depend all install
100	cd ${.CURDIR}/share/man &&		${MAKE} makedb
101
102hierarchy:
103	@echo "--------------------------------------------------------------"
104	@echo " Making hierarchy"
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
148installmost:
149	@echo "--------------------------------------------------------------"
150	@echo " Installing programs only"
151	@echo "--------------------------------------------------------------"
152	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} install
153	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} install
154	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} install
155	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} install
156	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} install
157	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} install
158	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} install
159	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} install
160#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
161#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} installmost
162#.endif
163#.if !defined(NOSECURE) && !defined(NOCRYPT)
164#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} installmost
165#.endif
166
167most:
168	@echo "--------------------------------------------------------------"
169	@echo " Building programs only"
170	@echo "--------------------------------------------------------------"
171	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} all
172	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} all
173	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} all
174	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} all
175	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} all
176	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} all
177	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} all
178	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} install
179#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
180#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} most
181#.endif
182#.if !defined(NOSECURE) && !defined(NOCRYPT)
183#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} most
184#.endif
185
186mk:
187	@echo "--------------------------------------------------------------"
188	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
189	@echo "--------------------------------------------------------------"
190	cd ${.CURDIR}/share/mk &&		${MAKE} install
191
192includes:
193	@echo "--------------------------------------------------------------"
194	@echo " Rebuilding ${DESTDIR}/usr/include"
195	@echo "--------------------------------------------------------------"
196	@echo
197.if defined(CLOBBER)
198	rm -rf ${DESTDIR}/usr/include/*
199	mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
200		-p ${DESTDIR}/usr/include
201.endif
202	cd ${.CURDIR}/include &&		${MAKE} install
203	cd ${.CURDIR}/gnu/include &&		${MAKE}	install
204	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
205	cd ${.CURDIR}/gnu/lib/libregex &&	${MAKE} beforeinstall
206	cd ${.CURDIR}/gnu/lib/libg++ &&         ${MAKE} beforeinstall
207	cd ${.CURDIR}/gnu/lib/libdialog &&      ${MAKE} beforeinstall
208.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
209	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
210.endif
211	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
212	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
213	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
214	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
215	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE}	beforeinstall
216	cd ${.CURDIR}/lib/libncurses &&		${MAKE}	beforeinstall
217.if !defined(WANT_CSRG_LIBM)
218	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
219.endif
220	cd ${.CURDIR}/lib/libpcap &&		${MAKE} beforeinstall
221	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
222	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
223	cd ${.CURDIR}/lib/libtermcap &&		${MAKE}	beforeinstall
224	cd ${.CURDIR}/lib/libcom_err &&		${MAKE} beforeinstall
225	cd ${.CURDIR}/lib/libss &&		${MAKE} beforeinstall
226	cd ${.CURDIR}/lib/libforms &&		${MAKE}	beforeinstall
227	cd ${.CURDIR}/lib/libscsi &&		${MAKE}	beforeinstall
228
229lib-tools:
230	@echo "--------------------------------------------------------------"
231	@echo " Rebuilding tools needed to build the libraries"
232	@echo "--------------------------------------------------------------"
233	@echo
234	cd ${.CURDIR}/gnu/usr.bin/ld && \
235		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
236	cd ${.CURDIR}/usr.bin/ar && \
237		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
238	cd ${.CURDIR}/usr.bin/ranlib && \
239		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
240	cd ${.CURDIR}/usr.bin/nm && \
241		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
242	cd ${.CURDIR}/usr.bin/lex/lib && \
243		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
244	cd ${.CURDIR}/usr.bin/compile_et && \
245		${MAKE} depend all install ${CLEANDIR} ${OBJDIR} && \
246		rm -f /usr/sbin/compile_et
247	cd ${.CURDIR}/usr.bin/mk_cmds && \
248		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
249
250libraries:
251	@echo "--------------------------------------------------------------"
252	@echo " Rebuilding ${DESTDIR}/usr/lib"
253	@echo "--------------------------------------------------------------"
254	@echo
255.if defined(CLOBBER)
256	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
257		xargs rm -rf
258.endif
259	cd ${.CURDIR}/gnu/lib && \
260		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
261	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
262		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
263.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
264	cd ${.CURDIR}/secure/lib && \
265		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
266.endif
267.if exists(lib)
268	cd ${.CURDIR}/lib/csu/i386 && \
269		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
270	cd ${.CURDIR}/lib && \
271		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
272.endif
273	cd ${.CURDIR}/usr.bin/lex/lib && \
274		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
275.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
276	cd ${.CURDIR}/eBones/des && \
277		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
278	cd ${.CURDIR}/eBones/acl && \
279		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
280	cd ${.CURDIR}/eBones/kdb && \
281		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
282	cd ${.CURDIR}/eBones/krb && \
283		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
284.endif
285
286tools:
287	@echo "--------------------------------------------------------------"
288	@echo " Rebuilding ${DESTDIR} Compiler and Make"
289	@echo "--------------------------------------------------------------"
290	@echo
291	cd ${.CURDIR}/gnu/usr.bin/cc && \
292		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
293	cd ${.CURDIR}/usr.bin/make && \
294		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
295
296.include <bsd.subdir.mk>
297