Makefile revision 6722
1#
2#	$Id: Makefile,v 1.40 1995/02/09 11:09:41 jkh 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#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
158#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} installmost
159#.endif
160#.if !defined(NOSECURE) && !defined(NOCRYPT)
161#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} installmost
162#.endif
163
164most:
165	@echo "--------------------------------------------------------------"
166	@echo " Building programs only"
167	@echo "--------------------------------------------------------------"
168	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} all
169	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} all
170	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} all
171	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} all
172	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} all
173	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} all
174	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} all
175#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
176#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} most
177#.endif
178#.if !defined(NOSECURE) && !defined(NOCRYPT)
179#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} most
180#.endif
181
182mk:
183	@echo "--------------------------------------------------------------"
184	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
185	@echo "--------------------------------------------------------------"
186	cd ${.CURDIR}/share/mk &&		${MAKE} install
187
188includes:
189	@echo "--------------------------------------------------------------"
190	@echo " Rebuilding ${DESTDIR}/usr/include"
191	@echo "--------------------------------------------------------------"
192	@echo
193.if defined(CLOBBER)
194	rm -rf ${DESTDIR}/usr/include
195	mkdir ${DESTDIR}/usr/include
196	chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include
197	chmod 755 ${DESTDIR}/usr/include
198.endif
199	cd ${.CURDIR}/include &&		${MAKE} install
200	cd ${.CURDIR}/gnu/include &&		${MAKE}	install
201	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
202	cd ${.CURDIR}/gnu/lib/libg++ &&         ${MAKE} beforeinstall
203	cd ${.CURDIR}/gnu/lib/libdialog &&      ${MAKE} beforeinstall
204.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
205	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
206.endif
207	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
208	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
209	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
210	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
211	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE}	beforeinstall
212	cd ${.CURDIR}/lib/libncurses &&		${MAKE}	beforeinstall
213.if defined(WANT_MSUN)
214	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
215.endif
216	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
217	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
218	cd ${.CURDIR}/lib/libtermcap &&		${MAKE}	beforeinstall
219	cd ${.CURDIR}/lib/libcom_err &&		${MAKE} beforeinstall
220	cd ${.CURDIR}/lib/libss &&		${MAKE} beforeinstall
221	cd ${.CURDIR}/lib/libforms &&		${MAKE}	beforeinstall
222	cd ${.CURDIR}/lib/libscsi &&		${MAKE}	beforeinstall
223
224lib-tools:
225	@echo "--------------------------------------------------------------"
226	@echo " Rebuilding tools needed to build the libraries
227	@echo "--------------------------------------------------------------"
228	@echo
229	cd ${.CURDIR}/usr.bin/ar && \
230		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
231	cd ${.CURDIR}/usr.bin/ranlib && \
232		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
233	cd ${.CURDIR}/usr.bin/nm && \
234		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
235	cd ${.CURDIR}/usr.bin/lex/lib && \
236		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
237	cd ${.CURDIR}/usr.bin/compile_et && \
238		${MAKE} depend all install ${CLEANDIR} ${OBJDIR} && \
239		rm -f /usr/sbin/compile_et
240	cd ${.CURDIR}/usr.bin/mk_cmds && \
241		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
242
243libraries:
244	@echo "--------------------------------------------------------------"
245	@echo " Rebuilding ${DESTDIR}/usr/lib"
246	@echo "--------------------------------------------------------------"
247	@echo
248.if defined(CLOBBER)
249	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
250		xargs rm -rf
251.endif
252	cd ${.CURDIR}/gnu/lib && \
253		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
254	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
255		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
256.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
257	cd ${.CURDIR}/secure/lib && \
258		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
259.endif
260.if exists(lib)
261	cd ${.CURDIR}/lib/csu/i386 && \
262		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
263	cd ${.CURDIR}/lib && \
264		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
265.endif
266	cd ${.CURDIR}/usr.bin/lex/lib && \
267		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
268.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
269	cd ${.CURDIR}/eBones/des && \
270		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
271	cd ${.CURDIR}/eBones/acl && \
272		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
273	cd ${.CURDIR}/eBones/kdb && \
274		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
275	cd ${.CURDIR}/eBones/krb && \
276		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
277.endif
278
279tools:
280	@echo "--------------------------------------------------------------"
281	@echo " Rebuilding ${DESTDIR} Compiler and Make"
282	@echo "--------------------------------------------------------------"
283	@echo
284	cd ${.CURDIR}/gnu/usr.bin/cc && \
285		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
286	cd ${.CURDIR}/usr.bin/make && \
287		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
288
289.include <bsd.subdir.mk>
290