Makefile revision 7130
1#
2#	$Id: Makefile,v 1.45 1995/03/17 04:59:44 phk 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_MSUN)
218	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
219.endif
220	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
221	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
222	cd ${.CURDIR}/lib/libtermcap &&		${MAKE}	beforeinstall
223	cd ${.CURDIR}/lib/libcom_err &&		${MAKE} beforeinstall
224	cd ${.CURDIR}/lib/libss &&		${MAKE} beforeinstall
225	cd ${.CURDIR}/lib/libforms &&		${MAKE}	beforeinstall
226	cd ${.CURDIR}/lib/libscsi &&		${MAKE}	beforeinstall
227
228lib-tools:
229	@echo "--------------------------------------------------------------"
230	@echo " Rebuilding tools needed to build the libraries"
231	@echo "--------------------------------------------------------------"
232	@echo
233	cd ${.CURDIR}/usr.bin/ar && \
234		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
235	cd ${.CURDIR}/usr.bin/ranlib && \
236		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
237	cd ${.CURDIR}/usr.bin/nm && \
238		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
239	cd ${.CURDIR}/usr.bin/lex/lib && \
240		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
241	cd ${.CURDIR}/usr.bin/compile_et && \
242		${MAKE} depend all install ${CLEANDIR} ${OBJDIR} && \
243		rm -f /usr/sbin/compile_et
244	cd ${.CURDIR}/usr.bin/mk_cmds && \
245		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
246
247libraries:
248	@echo "--------------------------------------------------------------"
249	@echo " Rebuilding ${DESTDIR}/usr/lib"
250	@echo "--------------------------------------------------------------"
251	@echo
252.if defined(CLOBBER)
253	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
254		xargs rm -rf
255.endif
256	cd ${.CURDIR}/gnu/lib && \
257		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
258	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
259		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
260.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
261	cd ${.CURDIR}/secure/lib && \
262		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
263.endif
264.if exists(lib)
265	cd ${.CURDIR}/lib/csu/i386 && \
266		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
267	cd ${.CURDIR}/lib && \
268		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
269.endif
270	cd ${.CURDIR}/usr.bin/lex/lib && \
271		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
272.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
273	cd ${.CURDIR}/eBones/des && \
274		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
275	cd ${.CURDIR}/eBones/acl && \
276		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
277	cd ${.CURDIR}/eBones/kdb && \
278		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
279	cd ${.CURDIR}/eBones/krb && \
280		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
281.endif
282
283tools:
284	@echo "--------------------------------------------------------------"
285	@echo " Rebuilding ${DESTDIR} Compiler and Make"
286	@echo "--------------------------------------------------------------"
287	@echo
288	cd ${.CURDIR}/gnu/usr.bin/cc && \
289		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
290	cd ${.CURDIR}/usr.bin/make && \
291		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
292
293.include <bsd.subdir.mk>
294