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