Makefile revision 16813
1314818Sngie#
2272343Sngie#	$Id: Makefile,v 1.87 1996/06/27 06:00:52 peter Exp $
3272343Sngie#
4272343Sngie# Make command line options:
5272343Sngie#	-DCLOBBER will remove /usr/include
6272343Sngie#	-DMAKE_LOCAL to add ./local to the SUBDIR list
7272343Sngie#	-DMAKE_PORTS to add ./ports to the SUBDIR list
8272343Sngie#	-DMAKE_EBONES to build eBones (KerberosIV)
9272343Sngie#
10272343Sngie#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
11272343Sngie#	-DNOCLEAN do not clean at all
12272343Sngie#	-DNOCRYPT will prevent building of crypt versions
13272343Sngie#	-DNOLKM do not build loadable kernel modules
14272343Sngie#	-DNOOBJDIR do not run ``${MAKE} obj''
15272343Sngie#	-DNOPROFILE do not build profiled libraries
16272343Sngie#	-DNOSECURE do not go into secure subdir
17272343Sngie
18272343Sngie# Put initial settings here.
19272343SngieSUBDIR=
20272343Sngie
21272343Sngie# We must do include and lib first so that the perl *.ph generation
22272343Sngie# works correctly as it uses the header files installed by this.
23272343Sngie.if exists(include)
24272343SngieSUBDIR+= include
25272343Sngie.endif
26272343Sngie.if exists(lib)
27272343SngieSUBDIR+= lib
28272343Sngie.endif
29272343Sngie
30272343Sngie.if exists(bin)
31272343SngieSUBDIR+= bin
32272343Sngie.endif
33272343Sngie#.if exists(contrib)
34272343Sngie#SUBDIR+= contrib
35272343Sngie#.endif
36272343Sngie.if exists(games)
37272343SngieSUBDIR+= games
38272343Sngie.endif
39272343Sngie.if exists(gnu)
40272343SngieSUBDIR+= gnu
41273395Sngie.endif
42272343Sngie.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
43272343SngieSUBDIR+= eBones
44272343Sngie.endif
45272343Sngie.if exists(libexec)
46272343SngieSUBDIR+= libexec
47272343Sngie.endif
48272343Sngie.if exists(sbin)
49272343SngieSUBDIR+= sbin
50272343Sngie.endif
51272343Sngie.if exists(share)
52272343SngieSUBDIR+= share
53272343Sngie.endif
54272343Sngie.if exists(sys)
55272343SngieSUBDIR+= sys
56272343Sngie.endif
57272343Sngie.if exists(usr.bin)
58272343SngieSUBDIR+= usr.bin
59272343Sngie.endif
60272343Sngie.if exists(usr.sbin)
61272343SngieSUBDIR+= usr.sbin
62272343Sngie.endif
63272343Sngie.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
64272343SngieSUBDIR+= secure
65272343Sngie.endif
66272343Sngie.if exists(lkm) && !defined(NOLKM)
67272343SngieSUBDIR+= lkm
68272343Sngie.endif
69272343Sngie
70272343Sngie# etc must be last for "distribute" to work
71272343Sngie.if exists(etc) && make(distribute)
72272343SngieSUBDIR+= etc
73272343Sngie.endif
74272343Sngie
75272343Sngie# These are last, since it is nice to at least get the base system
76272343Sngie# rebuilt before you do them.
77272343Sngie.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
78272343SngieSUBDIR+= local
79272343Sngie.endif
80272343Sngie.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
81272343SngieSUBDIR+= ports
82272343Sngie.endif
83272343Sngie
84272343Sngie# Handle the -DNOOBJDIR and -DNOCLEANDIR
85272343Sngie.if defined(NOOBJDIR)
86272343SngieOBJDIR=
87272343Sngie.else
88272343SngieOBJDIR=		obj
89272343Sngie.endif
90272343Sngie
91272343Sngie.if defined(NOCLEAN)
92272343SngieCLEANDIR=
93272343SngieWORLD_CLEANDIST=obj
94272343Sngie.else
95272343SngieWORLD_CLEANDIST=cleandist
96272343Sngie.if defined(NOCLEANDIR)
97272343SngieCLEANDIR=	clean
98272343Sngie.else
99272343SngieCLEANDIR=	cleandir
100272343Sngie.endif
101272343Sngie.endif
102272343Sngie
103272343SngieMK_FLAGS=	-DNOMAN -DNOPROFILE
104272343Sngie
105272343Sngie.if !target(pre-world)
106272343Sngiepre-world:
107272343Sngie	@/usr/bin/true
108272343Sngie.endif
109272343Sngie
110272343Sngieworld:	pre-world hierarchy mk $(WORLD_CLEANDIST) bootstrap include-tools includes lib-tools libraries build-tools
111272343Sngie	@echo "--------------------------------------------------------------"
112272343Sngie	@echo " Rebuilding ${DESTDIR} The whole thing"
113272343Sngie	@echo "--------------------------------------------------------------"
114272343Sngie	@echo
115272343Sngie	cd ${.CURDIR} && ${MAKE} depend all install
116272343Sngie	cd ${.CURDIR}/share/man &&		${MAKE} makedb
117272343Sngie.if target(post-world)
118272343Sngie	cd ${.CURDIR} && ${MAKE} post-world
119272343Sngie.endif
120272343Sngie	@echo "make world completed on `date`"
121272343Sngie
122272343Sngiebootstrap:
123272343Sngie	cd ${.CURDIR}/usr.bin/xlint && ${MAKE} ${MK_FLAGS} lint1 lint2 xlint
124272343Sngie	cd ${.CURDIR}/usr.bin/xlint/lint1 && ${MAKE} ${MK_FLAGS} install
125272343Sngie	cd ${.CURDIR}/usr.bin/xlint/lint2 && ${MAKE} ${MK_FLAGS} install
126272343Sngie	cd ${.CURDIR}/usr.bin/xlint/xlint && ${MAKE} ${MK_FLAGS} install
127272343Sngie	cd ${.CURDIR}/usr.bin/lex && ${MAKE} ${MK_FLAGS} bootstrap && \
128272343Sngie		${MAKE} ${MK_FLAGS} all install
129272343Sngie
130272343Sngiereinstall:	hierarchy mk includes
131272343Sngie	@echo "--------------------------------------------------------------"
132272343Sngie	@echo " Reinstall ${DESTDIR} The whole thing"
133272343Sngie	@echo "--------------------------------------------------------------"
134272343Sngie	@echo
135272343Sngie	cd ${.CURDIR} && ${MAKE} install
136272343Sngie	cd ${.CURDIR}/share/man &&		${MAKE} makedb
137272343Sngie
138272343Sngiehierarchy:
139272343Sngie	@echo "--------------------------------------------------------------"
140272343Sngie	@echo " Making hierarchy"
141272343Sngie	@echo "--------------------------------------------------------------"
142272343Sngie	cd ${.CURDIR}/etc &&		${MAKE} distrib-dirs
143272343Sngie
144272343Sngieupdate:
145272343Sngie.if defined(SUP_UPDATE)
146272343Sngie	@echo "--------------------------------------------------------------"
147272343Sngie	@echo "Running sup"
148272343Sngie	@echo "--------------------------------------------------------------"
149272343Sngie	@sup -v ${SUPFILE}
150272343Sngie.if defined(SUPFILE1)
151272343Sngie	@sup -v ${SUPFILE1}
152272343Sngie.endif
153272343Sngie.if defined(SUPFILE2)
154272343Sngie	@sup -v ${SUPFILE2}
155272343Sngie.endif
156272343Sngie.endif
157272343Sngie.if defined(CVS_UPDATE)
158272343Sngie	@echo "--------------------------------------------------------------"
159272343Sngie	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
160272343Sngie	@echo "--------------------------------------------------------------"
161272343Sngie	cd ${.CURDIR} &&  cvs -q update -P -d
162272343Sngie.endif
163272343Sngie
164272343Sngiecleandist:
165272343Sngie.if !defined(NOCLEANDIR)
166272343Sngie	@echo "--------------------------------------------------------------"
167272343Sngie	@echo " Cleaning up the source tree, and rebuilding the obj tree"
168272343Sngie	@echo "--------------------------------------------------------------"
169272343Sngie	cd ${.CURDIR} && ${MAKE} cleandir
170272343Sngie	cd ${.CURDIR} && ${MAKE} obj
171272343Sngie.endif
172272343Sngie
173272343Sngieinstallmost:
174272343Sngie	@echo "--------------------------------------------------------------"
175272343Sngie	@echo " Installing programs only"
176272343Sngie	@echo "--------------------------------------------------------------"
177272343Sngie	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} install
178272343Sngie	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} install
179272343Sngie	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} install
180272343Sngie	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} install
181272343Sngie	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} install
182272343Sngie	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} install
183272343Sngie	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} install
184272343Sngie	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} install
185272343Sngie#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
186272343Sngie#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} installmost
187272343Sngie#.endif
188272343Sngie#.if !defined(NOSECURE) && !defined(NOCRYPT)
189272343Sngie#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} installmost
190272343Sngie#.endif
191272343Sngie
192272343Sngiemost:
193272343Sngie	@echo "--------------------------------------------------------------"
194272343Sngie	@echo " Building programs only"
195272343Sngie	@echo "--------------------------------------------------------------"
196272343Sngie	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} all
197272343Sngie	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} all
198272343Sngie	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} all
199272343Sngie	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} all
200272343Sngie	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} all
201272343Sngie	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} all
202272343Sngie	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} all
203272343Sngie	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} all
204272343Sngie#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
205272343Sngie#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} most
206272343Sngie#.endif
207272343Sngie#.if !defined(NOSECURE) && !defined(NOCRYPT)
208#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} most
209#.endif
210
211mk:
212	@echo "--------------------------------------------------------------"
213	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
214	@echo "--------------------------------------------------------------"
215	cd ${.CURDIR}/share/mk &&	${MAKE} install
216
217includes:
218	@echo "--------------------------------------------------------------"
219	@echo " Rebuilding ${DESTDIR}/usr/include"
220	@echo "--------------------------------------------------------------"
221	@echo
222.if defined(CLOBBER)
223	rm -rf ${DESTDIR}/usr/include/*
224	mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
225		-p ${DESTDIR}/usr/include
226.endif
227	cd ${.CURDIR}/include &&		${MAKE} install
228	cd ${.CURDIR}/gnu/include &&		${MAKE}	install
229	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
230	cd ${.CURDIR}/gnu/lib/libregex &&	${MAKE} beforeinstall
231	cd ${.CURDIR}/gnu/lib/libg++ &&         ${MAKE} beforeinstall
232	cd ${.CURDIR}/gnu/lib/libdialog &&      ${MAKE} beforeinstall
233.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
234	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
235	cd ${.CURDIR}/eBones/lib/libkrb &&	${MAKE} beforeinstall
236	cd ${.CURDIR}/eBones/lib/libkadm &&	${MAKE} beforeinstall
237.endif
238	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
239	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
240	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
241	cd ${.CURDIR}/lib/libftpio &&		${MAKE} beforeinstall
242	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
243	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE}	beforeinstall
244	cd ${.CURDIR}/lib/libncurses &&		${MAKE}	beforeinstall
245.if !defined(WANT_CSRG_LIBM)
246	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
247.endif
248	cd ${.CURDIR}/lib/libpcap &&		${MAKE} beforeinstall
249	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
250	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
251	cd ${.CURDIR}/lib/libtcl &&		${MAKE}	beforeinstall
252	cd ${.CURDIR}/lib/libtermcap &&		${MAKE}	beforeinstall
253	cd ${.CURDIR}/lib/libcom_err &&		${MAKE} beforeinstall
254	cd ${.CURDIR}/lib/libss &&		${MAKE} beforeinstall
255	cd ${.CURDIR}/lib/libscsi &&		${MAKE}	beforeinstall
256	cd ${.CURDIR}/lib/libutil &&		${MAKE}	beforeinstall
257
258lib-tools:
259	@echo "--------------------------------------------------------------"
260	@echo " Rebuilding tools needed to build the libraries"
261	@echo "--------------------------------------------------------------"
262	@echo
263	cd ${.CURDIR}/usr.bin/xinstall && \
264		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
265	cd ${.CURDIR}/gnu/usr.bin/ld && \
266		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
267	cd ${.CURDIR}/usr.bin/ar && \
268		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
269	cd ${.CURDIR}/usr.bin/ranlib && \
270		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
271	cd ${.CURDIR}/usr.bin/nm && \
272		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
273	cd ${.CURDIR}/usr.bin/lex/lib && \
274		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
275	cd ${.CURDIR}/usr.bin/compile_et && \
276		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR} && \
277		rm -f /usr/sbin/compile_et
278	cd ${.CURDIR}/usr.bin/mk_cmds && \
279		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
280
281libraries:
282	@echo "--------------------------------------------------------------"
283	@echo " Rebuilding ${DESTDIR}/usr/lib"
284	@echo "--------------------------------------------------------------"
285	@echo
286.if exists(lib/libcompat)
287	cd ${.CURDIR}/lib/libcompat && \
288		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
289.endif
290.if exists(lib/libncurses)
291	cd ${.CURDIR}/lib/libncurses && \
292		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
293.endif
294.if exists(lib/libtermcap)
295	cd ${.CURDIR}/lib/libtermcap && \
296		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
297.endif
298.if exists(gnu)
299	cd ${.CURDIR}/gnu/lib && \
300		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
301	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
302		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
303.endif
304.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
305	cd ${.CURDIR}/secure/lib && \
306		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
307.endif
308.if exists(lib)
309	cd ${.CURDIR}/lib/csu/i386 && \
310		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
311	cd ${.CURDIR}/lib && \
312		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
313.endif
314.if exists(usr.sbin/lex/lib)
315	cd ${.CURDIR}/usr.bin/lex/lib && \
316		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
317.endif
318.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
319	cd ${.CURDIR}/eBones/lib && \
320		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
321.endif
322.if exists(usr.sbin/pcvt/keycap)
323	cd ${.CURDIR}/usr.sbin/pcvt/keycap && \
324		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
325.endif
326
327include-tools:
328	@echo "--------------------------------------------------------------"
329	@echo " Rebuild tools necessary to build the include files"
330	@echo "--------------------------------------------------------------"
331	@echo
332	cd ${.CURDIR}/usr.bin/xinstall && \
333		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
334	cd ${.CURDIR}/usr.bin/rpcgen && \
335		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
336
337build-tools:
338	@echo "--------------------------------------------------------------"
339	@echo " Rebuilding ${DESTDIR} C compiler, make, symorder, sgmlfmt and zic(8)"
340	@echo "--------------------------------------------------------------"
341	@echo
342	cd ${.CURDIR}/gnu/usr.bin/cc && \
343		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
344	cd ${.CURDIR}/usr.bin/make && \
345		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
346	cd ${.CURDIR}/usr.bin/symorder && \
347		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
348	cd ${.CURDIR}/usr.bin/sgmlfmt && \
349		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR} 
350	cd ${.CURDIR}/share/sgml && \
351		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR} 
352	cd ${.CURDIR}/usr.sbin/zic && \
353		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
354
355.include <bsd.subdir.mk>
356