Makefile revision 7059
1#
2#	$Id: Makefile,v 1.43 1995/03/06 13:32:58 se 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.if exists(bin)
21SUBDIR+= bin
22.endif
23.if exists(contrib)
24SUBDIR+= contrib
25.endif
26.if exists(games)
27SUBDIR+= games
28.endif
29.if exists(gnu)
30SUBDIR+= gnu
31.endif
32.if exists(include)
33SUBDIR+= include
34.endif
35.if exists(lib)
36SUBDIR+= lib
37.endif
38.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
39SUBDIR+= eBones
40.endif
41.if exists(libexec)
42SUBDIR+= libexec
43.endif
44.if exists(sbin)
45SUBDIR+= sbin
46.endif
47.if exists(share)
48SUBDIR+= share
49.endif
50.if exists(sys)
51SUBDIR+= sys
52.endif
53.if exists(usr.bin)
54SUBDIR+= usr.bin
55.endif
56.if exists(usr.sbin)
57SUBDIR+= usr.sbin
58.endif
59.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
60SUBDIR+= secure
61.endif
62.if exists(lkm) && !defined(NOLKM)
63SUBDIR+= lkm
64.endif
65
66# etc must be last for "distribute" to work
67.if exists(etc) && make(distribute)
68SUBDIR+= etc
69.endif
70
71# These are last, since it is nice to at least get the base system
72# rebuilt before you do them.
73.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
74SUBDIR+= local
75.endif
76.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
77SUBDIR+= ports
78.endif
79
80# Handle the -DNOOBJDIR and -DNOCLEANDIR
81.if defined(NOOBJDIR)
82OBJDIR=
83.else
84OBJDIR=		obj
85.endif
86.if defined(NOCLEANDIR)
87CLEANDIR=	clean
88.else 
89CLEANDIR=	cleandir
90.endif
91
92world:	hierarchy mk cleandist includes lib-tools libraries tools
93	@echo "--------------------------------------------------------------"
94	@echo " Rebuilding ${DESTDIR} The whole thing"
95	@echo "--------------------------------------------------------------"
96	@echo
97	${MAKE} depend all install
98	cd ${.CURDIR}/share/man &&		${MAKE} makedb
99
100hierarchy:
101	@echo "--------------------------------------------------------------"
102	@echo " Making hierarchy"
103	@echo "--------------------------------------------------------------"
104	cd ${.CURDIR}/etc &&		${MAKE} distrib-dirs
105
106update:
107.if defined(SUP_UPDATE)
108	@echo "--------------------------------------------------------------"
109	@echo "Running sup"
110	@echo "--------------------------------------------------------------"
111	@sup -v ${SUPFILE}
112.endif
113.if defined(CVS_UPDATE)
114	@echo "--------------------------------------------------------------"
115	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
116	@echo "--------------------------------------------------------------"
117	cd ${.CURDIR} &&  cvs update -P -d
118.endif
119
120cleandist:
121.if !defined(NOCLEANDIR)
122	@echo "--------------------------------------------------------------"
123	@echo " Cleaning up the source tree, and rebuilding the obj tree"
124	@echo "--------------------------------------------------------------"
125	@echo
126	here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
127	if test -d /usr/obj -a ! -d $$dest; then \
128		mkdir -p $$dest; \
129	else \
130		true; \
131	fi; \
132	cd $$dest && rm -rf ${SUBDIR}
133	find . -name obj | xargs rm -rf
134.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
135	# The cd is done as local may well be a symbolic link
136	-cd local && find . -name obj | xargs rm -rf
137.endif
138.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
139	# The cd is done as local may well be a symbolic link
140	-cd ports && find . -name obj | xargs rm -rf
141.endif
142	${MAKE} cleandir
143	${MAKE} obj
144.endif
145
146installmost:
147	@echo "--------------------------------------------------------------"
148	@echo " Installing programs only"
149	@echo "--------------------------------------------------------------"
150	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} install
151	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} install
152	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} install
153	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} install
154	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} install
155	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} install
156	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} install
157	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} install
158#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
159#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} installmost
160#.endif
161#.if !defined(NOSECURE) && !defined(NOCRYPT)
162#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} installmost
163#.endif
164
165most:
166	@echo "--------------------------------------------------------------"
167	@echo " Building programs only"
168	@echo "--------------------------------------------------------------"
169	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} all
170	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} all
171	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} all
172	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} all
173	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} all
174	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} all
175	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} all
176	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} install
177#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
178#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} most
179#.endif
180#.if !defined(NOSECURE) && !defined(NOCRYPT)
181#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} most
182#.endif
183
184mk:
185	@echo "--------------------------------------------------------------"
186	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
187	@echo "--------------------------------------------------------------"
188	cd ${.CURDIR}/share/mk &&		${MAKE} install
189
190includes:
191	@echo "--------------------------------------------------------------"
192	@echo " Rebuilding ${DESTDIR}/usr/include"
193	@echo "--------------------------------------------------------------"
194	@echo
195.if defined(CLOBBER)
196	rm -rf ${DESTDIR}/usr/include
197	mkdir ${DESTDIR}/usr/include
198	chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include
199	chmod 755 ${DESTDIR}/usr/include
200.endif
201	cd ${.CURDIR}/include &&		${MAKE} install
202	cd ${.CURDIR}/gnu/include &&		${MAKE}	install
203	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
204	cd ${.CURDIR}/gnu/lib/libregex &&	${MAKE} beforeinstall
205	cd ${.CURDIR}/gnu/lib/libg++ &&         ${MAKE} beforeinstall
206	cd ${.CURDIR}/gnu/lib/libdialog &&      ${MAKE} beforeinstall
207.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
208	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
209.endif
210	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
211	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
212	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
213	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
214	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE}	beforeinstall
215	cd ${.CURDIR}/lib/libncurses &&		${MAKE}	beforeinstall
216.if defined(WANT_MSUN)
217	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
218.endif
219	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
220	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
221	cd ${.CURDIR}/lib/libtermcap &&		${MAKE}	beforeinstall
222	cd ${.CURDIR}/lib/libcom_err &&		${MAKE} beforeinstall
223	cd ${.CURDIR}/lib/libss &&		${MAKE} beforeinstall
224	cd ${.CURDIR}/lib/libforms &&		${MAKE}	beforeinstall
225	cd ${.CURDIR}/lib/libscsi &&		${MAKE}	beforeinstall
226
227lib-tools:
228	@echo "--------------------------------------------------------------"
229	@echo " Rebuilding tools needed to build the libraries"
230	@echo "--------------------------------------------------------------"
231	@echo
232	cd ${.CURDIR}/usr.bin/ar && \
233		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
234	cd ${.CURDIR}/usr.bin/ranlib && \
235		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
236	cd ${.CURDIR}/usr.bin/nm && \
237		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
238	cd ${.CURDIR}/usr.bin/lex/lib && \
239		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
240	cd ${.CURDIR}/usr.bin/compile_et && \
241		${MAKE} depend all install ${CLEANDIR} ${OBJDIR} && \
242		rm -f /usr/sbin/compile_et
243	cd ${.CURDIR}/usr.bin/mk_cmds && \
244		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
245
246libraries:
247	@echo "--------------------------------------------------------------"
248	@echo " Rebuilding ${DESTDIR}/usr/lib"
249	@echo "--------------------------------------------------------------"
250	@echo
251.if defined(CLOBBER)
252	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
253		xargs rm -rf
254.endif
255	cd ${.CURDIR}/gnu/lib && \
256		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
257	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
258		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
259.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
260	cd ${.CURDIR}/secure/lib && \
261		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
262.endif
263.if exists(lib)
264	cd ${.CURDIR}/lib/csu/i386 && \
265		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
266	cd ${.CURDIR}/lib && \
267		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
268.endif
269	cd ${.CURDIR}/usr.bin/lex/lib && \
270		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
271.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
272	cd ${.CURDIR}/eBones/des && \
273		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
274	cd ${.CURDIR}/eBones/acl && \
275		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
276	cd ${.CURDIR}/eBones/kdb && \
277		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
278	cd ${.CURDIR}/eBones/krb && \
279		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
280.endif
281
282tools:
283	@echo "--------------------------------------------------------------"
284	@echo " Rebuilding ${DESTDIR} Compiler and Make"
285	@echo "--------------------------------------------------------------"
286	@echo
287	cd ${.CURDIR}/gnu/usr.bin/cc && \
288		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
289	cd ${.CURDIR}/usr.bin/make && \
290		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
291
292.include <bsd.subdir.mk>
293