xref: /freebsd/Makefile (revision 17ee9d00bc1ae1e598c38f25826f861e4bc6c3ce)
1#
2#	$Id: Makefile,v 1.39 1995/01/24 22:30:37 ache 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
105hierarchy:
106	@echo "--------------------------------------------------------------"
107	@echo " Making hierarchy"
108	@echo "--------------------------------------------------------------"
109	cd ${.CURDIR}/release &&		${MAKE} hierarchy
110
111update:
112.if defined(SUP_UPDATE)
113	@echo "--------------------------------------------------------------"
114	@echo "Running sup"
115	@echo "--------------------------------------------------------------"
116	@sup -v ${SUPFILE}
117.endif
118.if defined(CVS_UPDATE)
119	@echo "--------------------------------------------------------------"
120	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
121	@echo "--------------------------------------------------------------"
122	cd ${.CURDIR} &&  cvs update -P -d
123.endif
124
125cleandist:
126.if !defined(NOCLEANDIR)
127	@echo "--------------------------------------------------------------"
128	@echo " Cleaning up the source tree, and rebuilding the obj tree"
129	@echo "--------------------------------------------------------------"
130	@echo
131	here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
132	if test -d /usr/obj -a ! -d $$dest; then \
133		mkdir -p $$dest; \
134	else \
135		true; \
136	fi; \
137	cd $$dest && rm -rf ${SUBDIR}
138	find . -name obj | xargs rm -rf
139.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
140	# The cd is done as local may well be a symbolic link
141	-cd local && find . -name obj | xargs rm -rf
142.endif
143.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
144	# The cd is done as local may well be a symbolic link
145	-cd ports && find . -name obj | xargs rm -rf
146.endif
147	${MAKE} cleandir
148	${MAKE} obj
149.endif
150
151installmost:
152	@echo "--------------------------------------------------------------"
153	@echo " Installing programs only"
154	@echo "--------------------------------------------------------------"
155	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} install
156	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} install
157	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} install
158	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} install
159	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} install
160	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} install
161	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} install
162#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
163#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} installmost
164#.endif
165#.if !defined(NOSECURE) && !defined(NOCRYPT)
166#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} installmost
167#.endif
168
169most:
170	@echo "--------------------------------------------------------------"
171	@echo " Building programs only"
172	@echo "--------------------------------------------------------------"
173	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} all
174	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} all
175	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} all
176	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} all
177	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} all
178	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} all
179	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} all
180#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
181#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} most
182#.endif
183#.if !defined(NOSECURE) && !defined(NOCRYPT)
184#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} most
185#.endif
186
187mk:
188	@echo "--------------------------------------------------------------"
189	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
190	@echo "--------------------------------------------------------------"
191	cd ${.CURDIR}/share/mk &&		${MAKE} install
192
193includes:
194	@echo "--------------------------------------------------------------"
195	@echo " Rebuilding ${DESTDIR}/usr/include"
196	@echo "--------------------------------------------------------------"
197	@echo
198.if defined(CLOBBER)
199	rm -rf ${DESTDIR}/usr/include
200	mkdir ${DESTDIR}/usr/include
201	chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include
202	chmod 755 ${DESTDIR}/usr/include
203.endif
204	cd ${.CURDIR}/include &&		${MAKE} install
205	cd ${.CURDIR}/gnu/include &&		${MAKE}	install
206	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
207	cd ${.CURDIR}/gnu/lib/libg++ &&         ${MAKE} beforeinstall
208	cd ${.CURDIR}/gnu/lib/libdialog &&      ${MAKE} beforeinstall
209.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
210	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
211.endif
212	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
213	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
214	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
215	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
216	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE}	beforeinstall
217	cd ${.CURDIR}/lib/libncurses &&		${MAKE}	beforeinstall
218.if defined(WANT_MSUN)
219	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
220.endif
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}/usr.bin/ar && \
235		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
236	cd ${.CURDIR}/usr.bin/ranlib && \
237		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
238	cd ${.CURDIR}/usr.bin/nm && \
239		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
240	cd ${.CURDIR}/usr.bin/lex/lib && \
241		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
242	cd ${.CURDIR}/usr.bin/compile_et && \
243		${MAKE} depend all install ${CLEANDIR} ${OBJDIR} && \
244		rm -f /usr/sbin/compile_et
245	cd ${.CURDIR}/usr.bin/mk_cmds && \
246		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
247
248libraries:
249	@echo "--------------------------------------------------------------"
250	@echo " Rebuilding ${DESTDIR}/usr/lib"
251	@echo "--------------------------------------------------------------"
252	@echo
253.if defined(CLOBBER)
254	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
255		xargs rm -rf
256.endif
257	cd ${.CURDIR}/gnu/lib && \
258		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
259	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
260		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
261.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
262	cd ${.CURDIR}/secure/lib && \
263		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
264.endif
265.if exists(lib)
266	cd ${.CURDIR}/lib/csu/i386 && \
267		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
268	cd ${.CURDIR}/lib && \
269		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
270.endif
271	cd ${.CURDIR}/usr.bin/lex/lib && \
272		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
273.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
274	cd ${.CURDIR}/eBones/des && \
275		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
276	cd ${.CURDIR}/eBones/acl && \
277		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
278	cd ${.CURDIR}/eBones/kdb && \
279		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
280	cd ${.CURDIR}/eBones/krb && \
281		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
282.endif
283
284tools:
285	@echo "--------------------------------------------------------------"
286	@echo " Rebuilding ${DESTDIR} Compiler and Make"
287	@echo "--------------------------------------------------------------"
288	@echo
289	cd ${.CURDIR}/gnu/usr.bin/cc && \
290		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
291	cd ${.CURDIR}/usr.bin/make && \
292		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
293
294.include <bsd.subdir.mk>
295