Makefile revision 12507
1142425Snectar#
2160814Ssimon#	$Id: Makefile,v 1.69 1995/11/26 07:31:13 jkh Exp $
3142425Snectar#
4142425Snectar# Make command line options:
5142425Snectar#	-DCLOBBER will remove /usr/include and MOST of /usr/lib
6142425Snectar#	-DMAKE_LOCAL to add ./local to the SUBDIR list
7142425Snectar#	-DMAKE_PORTS to add ./ports to the SUBDIR list
8142425Snectar#	-DMAKE_EBONES to build eBones (KerberosIV)
9142425Snectar#
10142425Snectar#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
11142425Snectar#	-DNOCLEAN do not clean at all
12142425Snectar#	-DNOCRYPT will prevent building of crypt versions
13142425Snectar#	-DNOLKM do not build loadable kernel modules
14142425Snectar#	-DNOOBJDIR do not run ``${MAKE} obj''
15142425Snectar#	-DNOPROFILE do not build profiled libraries
16142425Snectar#	-DNOSECURE do not go into secure subdir
17142425Snectar
18142425Snectar# Put initial settings here.
19142425SnectarSUBDIR=
20142425Snectar
21142425Snectar# We must do include and lib first so that the perl *.ph generation
22142425Snectar# works correctly as it uses the header files installed by this.
23142425Snectar.if exists(include)
24142425SnectarSUBDIR+= include
25238405Sjkim.endif
26142425Snectar.if exists(lib)
27142425SnectarSUBDIR+= lib
28238405Sjkim.endif
29142425Snectar
30238405Sjkim.if exists(bin)
31238405SjkimSUBDIR+= bin
32142425Snectar.endif
33142425Snectar.if exists(contrib)
34142425SnectarSUBDIR+= contrib
35142425Snectar.endif
36142425Snectar.if exists(games)
37142425SnectarSUBDIR+= games
38238405Sjkim.endif
39142425Snectar.if exists(gnu)
40142425SnectarSUBDIR+= gnu
41238405Sjkim.endif
42142425Snectar.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
43238405SjkimSUBDIR+= eBones
44238405Sjkim.endif
45142425Snectar.if exists(libexec)
46142425SnectarSUBDIR+= libexec
47142425Snectar.endif
48142425Snectar.if exists(sbin)
49142425SnectarSUBDIR+= sbin
50238405Sjkim.endif
51142425Snectar.if exists(share)
52142425SnectarSUBDIR+= share
53142425Snectar.endif
54142425Snectar.if exists(sys)
55142425SnectarSUBDIR+= sys
56142425Snectar.endif
57142425Snectar.if exists(usr.bin)
58142425SnectarSUBDIR+= usr.bin
59142425Snectar.endif
60142425Snectar.if exists(usr.sbin)
61142425SnectarSUBDIR+= usr.sbin
62142425Snectar.endif
63142425Snectar.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
64142425SnectarSUBDIR+= secure
65142425Snectar.endif
66142425Snectar.if exists(lkm) && !defined(NOLKM)
67142425SnectarSUBDIR+= lkm
68238405Sjkim.endif
69142425Snectar
70142425Snectar# etc must be last for "distribute" to work
71142425Snectar.if exists(etc) && make(distribute)
72142425SnectarSUBDIR+= etc
73142425Snectar.endif
74142425Snectar
75142425Snectar# These are last, since it is nice to at least get the base system
76142425Snectar# rebuilt before you do them.
77142425Snectar.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
78142425SnectarSUBDIR+= local
79142425Snectar.endif
80142425Snectar.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
81160814SsimonSUBDIR+= ports
82160814Ssimon.endif
83142425Snectar
84142425Snectar# Handle the -DNOOBJDIR and -DNOCLEANDIR
85142425Snectar.if defined(NOOBJDIR)
86142425SnectarOBJDIR=
87142425Snectar.else
88142425SnectarOBJDIR=		obj
89142425Snectar.endif
90142425Snectar
91142425Snectar.if defined(NOCLEAN)
92142425SnectarCLEANDIR=
93142425SnectarWORLD_CLEANDIST=obj
94142425Snectar.else
95142425SnectarWORLD_CLEANDIST=cleandist
96142425Snectar.if defined(NOCLEANDIR)
97160814SsimonCLEANDIR=	clean
98142425Snectar.else
99142425SnectarCLEANDIR=	cleandir
100142425Snectar.endif
101142425Snectar.endif
102142425Snectar
103142425Snectarworld:	hierarchy mk $(WORLD_CLEANDIST) includes lib-tools libraries build-tools
104142425Snectar	@echo "--------------------------------------------------------------"
105142425Snectar	@echo " Rebuilding ${DESTDIR} The whole thing"
106142425Snectar	@echo "--------------------------------------------------------------"
107142425Snectar	@echo
108142425Snectar	${MAKE} depend all install
109142425Snectar	cd ${.CURDIR}/share/man &&		${MAKE} makedb
110142425Snectar
111160814Ssimonreinstall:	hierarchy mk includes
112160814Ssimon	@echo "--------------------------------------------------------------"
113160814Ssimon	@echo " Reinstall ${DESTDIR} The whole thing"
114160814Ssimon	@echo "--------------------------------------------------------------"
115142425Snectar	@echo
116142425Snectar	${MAKE} install
117142425Snectar	cd ${.CURDIR}/share/man &&		${MAKE} makedb
118142425Snectar
119142425Snectarhierarchy:
120160814Ssimon	@echo "--------------------------------------------------------------"
121160814Ssimon	@echo " Making hierarchy"
122160814Ssimon	@echo "--------------------------------------------------------------"
123160814Ssimon	cd ${.CURDIR}/etc &&		${MAKE} distrib-dirs
124160814Ssimon
125160814Ssimonupdate:
126142425Snectar.if defined(SUP_UPDATE)
127160814Ssimon	@echo "--------------------------------------------------------------"
128160814Ssimon	@echo "Running sup"
129160814Ssimon	@echo "--------------------------------------------------------------"
130160814Ssimon	@sup -v ${SUPFILE}
131160814Ssimon.if defined(SUPFILE1)
132160814Ssimon	@sup -v ${SUPFILE1}
133160814Ssimon.endif
134142425Snectar.if defined(SUPFILE2)
135142425Snectar	@sup -v ${SUPFILE2}
136160814Ssimon.endif
137160814Ssimon.endif
138160814Ssimon.if defined(CVS_UPDATE)
139142425Snectar	@echo "--------------------------------------------------------------"
140142425Snectar	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
141142425Snectar	@echo "--------------------------------------------------------------"
142160814Ssimon	cd ${.CURDIR} &&  cvs update -P -d
143160814Ssimon.endif
144160814Ssimon
145160814Ssimoncleandist:
146160814Ssimon.if !defined(NOCLEANDIR)
147238405Sjkim	@echo "--------------------------------------------------------------"
148238405Sjkim	@echo " Cleaning up the source tree, and rebuilding the obj tree"
149238405Sjkim	@echo "--------------------------------------------------------------"
150142425Snectar	@echo
151160814Ssimon	here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
152160814Ssimon	if test -d /usr/obj -a ! -d $$dest; then \
153160814Ssimon		mkdir -p $$dest; \
154160814Ssimon	else \
155142425Snectar		true; \
156160814Ssimon	fi; \
157160814Ssimon	cd $$dest && rm -rf ${SUBDIR}
158160814Ssimon	find . -name obj | xargs rm -rf
159160814Ssimon.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
160160814Ssimon	# The cd is done as local may well be a symbolic link
161160814Ssimon	-cd local && find . -name obj | xargs rm -rf
162142425Snectar.endif
163142425Snectar.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
164142425Snectar	# The cd is done as local may well be a symbolic link
165142425Snectar	-cd ports && find . -name obj | xargs rm -rf
166142425Snectar.endif
167142425Snectar	${MAKE} cleandir
168142425Snectar	${MAKE} obj
169142425Snectar.endif
170142425Snectar
171160814Ssimoninstallmost:
172160814Ssimon	@echo "--------------------------------------------------------------"
173160814Ssimon	@echo " Installing programs only"
174160814Ssimon	@echo "--------------------------------------------------------------"
175160814Ssimon	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} install
176160814Ssimon	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} install
177160814Ssimon	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} install
178142425Snectar	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} install
179160814Ssimon	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} install
180160814Ssimon	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} install
181160814Ssimon	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} install
182160814Ssimon	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} install
183142425Snectar#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
184142425Snectar#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} installmost
185142425Snectar#.endif
186142425Snectar#.if !defined(NOSECURE) && !defined(NOCRYPT)
187142425Snectar#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} installmost
188142425Snectar#.endif
189142425Snectar
190142425Snectarmost:
191142425Snectar	@echo "--------------------------------------------------------------"
192142425Snectar	@echo " Building programs only"
193142425Snectar	@echo "--------------------------------------------------------------"
194142425Snectar	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} all
195160814Ssimon	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} all
196160814Ssimon	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} all
197160814Ssimon	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} all
198160814Ssimon	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} all
199160814Ssimon	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} all
200160814Ssimon	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} all
201160814Ssimon	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} all
202142425Snectar#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
203194206Ssimon#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} most
204194206Ssimon#.endif
205194206Ssimon#.if !defined(NOSECURE) && !defined(NOCRYPT)
206194206Ssimon#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} most
207194206Ssimon#.endif
208142425Snectar
209142425Snectarmk:
210142425Snectar	@echo "--------------------------------------------------------------"
211142425Snectar	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
212160814Ssimon	@echo "--------------------------------------------------------------"
213160814Ssimon	cd ${.CURDIR}/share/mk &&		${MAKE} install
214160814Ssimon
215160814Ssimonincludes:
216160814Ssimon	@echo "--------------------------------------------------------------"
217160814Ssimon	@echo " Rebuilding ${DESTDIR}/usr/include"
218160814Ssimon	@echo "--------------------------------------------------------------"
219142425Snectar	@echo
220160814Ssimon.if defined(CLOBBER)
221160814Ssimon	rm -rf ${DESTDIR}/usr/include/*
222160814Ssimon	mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
223160814Ssimon		-p ${DESTDIR}/usr/include
224160814Ssimon.endif
225160814Ssimon	cd ${.CURDIR}/include &&		${MAKE} install
226160814Ssimon	cd ${.CURDIR}/gnu/include &&		${MAKE}	install
227142425Snectar	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
228142425Snectar	cd ${.CURDIR}/gnu/lib/libregex &&	${MAKE} beforeinstall
229160814Ssimon	cd ${.CURDIR}/gnu/lib/libg++ &&         ${MAKE} beforeinstall
230160814Ssimon	cd ${.CURDIR}/gnu/lib/libdialog &&      ${MAKE} beforeinstall
231160814Ssimon.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
232160814Ssimon	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
233160814Ssimon	cd ${.CURDIR}/eBones/lib/libkrb &&	${MAKE} beforeinstall
234160814Ssimon	cd ${.CURDIR}/eBones/lib/libkadm &&	${MAKE} beforeinstall
235160814Ssimon.endif
236142425Snectar	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
237160814Ssimon	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
238160814Ssimon	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
239160814Ssimon	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
240238405Sjkim	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE}	beforeinstall
241238405Sjkim	cd ${.CURDIR}/lib/libncurses &&		${MAKE}	beforeinstall
242238405Sjkim.if !defined(WANT_CSRG_LIBM)
243238405Sjkim	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
244238405Sjkim.endif
245238405Sjkim	cd ${.CURDIR}/lib/libpcap &&		${MAKE} beforeinstall
246238405Sjkim	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
247238405Sjkim	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
248160814Ssimon	cd ${.CURDIR}/lib/libtermcap &&		${MAKE}	beforeinstall
249160814Ssimon	cd ${.CURDIR}/lib/libcom_err &&		${MAKE} beforeinstall
250160814Ssimon	cd ${.CURDIR}/lib/libss &&		${MAKE} beforeinstall
251160814Ssimon	cd ${.CURDIR}/lib/libforms &&		${MAKE}	beforeinstall
252160814Ssimon	cd ${.CURDIR}/lib/libscsi &&		${MAKE}	beforeinstall
253238405Sjkim
254238405Sjkimlib-tools:
255238405Sjkim	@echo "--------------------------------------------------------------"
256238405Sjkim	@echo " Rebuilding tools needed to build the libraries"
257238405Sjkim	@echo "--------------------------------------------------------------"
258238405Sjkim	@echo
259238405Sjkim	cd ${.CURDIR}/usr.bin/xinstall && \
260238405Sjkim		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
261142425Snectar	cd ${.CURDIR}/gnu/usr.bin/ld && \
262160814Ssimon		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
263160814Ssimon	cd ${.CURDIR}/usr.bin/ar && \
264160814Ssimon		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
265160814Ssimon	cd ${.CURDIR}/usr.bin/ranlib && \
266160814Ssimon		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
267142425Snectar	cd ${.CURDIR}/usr.bin/nm && \
268142425Snectar		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
269142425Snectar	cd ${.CURDIR}/usr.bin/lex/lib && \
270142425Snectar		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
271142425Snectar	cd ${.CURDIR}/usr.bin/compile_et && \
272160814Ssimon		${MAKE} depend all install ${CLEANDIR} ${OBJDIR} && \
273160814Ssimon		rm -f /usr/sbin/compile_et
274160814Ssimon	cd ${.CURDIR}/usr.bin/mk_cmds && \
275160814Ssimon		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
276160814Ssimon
277160814Ssimonlibraries:
278142425Snectar	@echo "--------------------------------------------------------------"
279142425Snectar	@echo " Rebuilding ${DESTDIR}/usr/lib"
280160814Ssimon	@echo "--------------------------------------------------------------"
281160814Ssimon	@echo
282194206Ssimon.if defined(CLOBBER)
283194206Ssimon	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
284160814Ssimon		xargs rm -rf
285160814Ssimon.endif
286160814Ssimon.if exists(lib/libcompat)
287142425Snectar	cd ${.CURDIR}/lib/libcompat && \
288160814Ssimon		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
289160814Ssimon.endif
290160814Ssimon.if exists(lib/libncurses)
291160814Ssimon	cd ${.CURDIR}/lib/libncurses && \
292160814Ssimon		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
293160814Ssimon.endif
294160814Ssimon.if exists(lib/libtermcap)
295142425Snectar	cd ${.CURDIR}/lib/libtermcap && \
296160814Ssimon		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
297160814Ssimon.endif
298160814Ssimon.if exists(gnu)
299160814Ssimon	cd ${.CURDIR}/gnu/lib && \
300160814Ssimon		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
301160814Ssimon	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
302160814Ssimon		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
303160814Ssimon.endif
304160814Ssimon.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
305160814Ssimon	cd ${.CURDIR}/secure/lib && \
306160814Ssimon		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
307142425Snectar.endif
308238405Sjkim.if exists(lib)
309238405Sjkim	cd ${.CURDIR}/lib/csu/i386 && \
310142425Snectar		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
311160814Ssimon	cd ${.CURDIR}/lib && \
312160814Ssimon		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
313160814Ssimon.endif
314160814Ssimon.if exists(usr.sbin/lex/lib)
315238405Sjkim	cd ${.CURDIR}/usr.bin/lex/lib && \
316238405Sjkim		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
317238405Sjkim.endif
318238405Sjkim.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
319238405Sjkim	cd ${.CURDIR}/eBones/des && \
320238405Sjkim		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
321238405Sjkim	cd ${.CURDIR}/eBones/lib && \
322238405Sjkim		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
323238405Sjkim.endif
324238405Sjkim.if exists(usr.sbin/pcvt/keycap)
325238405Sjkim	cd ${.CURDIR}/usr.sbin/pcvt/keycap && \
326238405Sjkim		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
327238405Sjkim.endif
328238405Sjkim
329238405Sjkimbuild-tools:
330238405Sjkim	@echo "--------------------------------------------------------------"
331142425Snectar	@echo " Rebuilding ${DESTDIR} C compiler, make, symorder, sgmlfmt and zic(8)"
332160814Ssimon	@echo "--------------------------------------------------------------"
333160814Ssimon	@echo
334160814Ssimon	cd ${.CURDIR}/gnu/usr.bin/cc && \
335142425Snectar		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
336142425Snectar	cd ${.CURDIR}/usr.bin/make && \
337142425Snectar		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
338160814Ssimon	cd ${.CURDIR}/usr.bin/symorder && \
339160814Ssimon		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
340160814Ssimon	cd ${.CURDIR}/usr.bin/sgmlfmt && \
341160814Ssimon		${MAKE} depend all install ${CLEANDIR} ${OBJDIR} 
342160814Ssimon	cd ${.CURDIR}/share/sgml && \
343160814Ssimon		${MAKE} depend all install ${CLEANDIR} ${OBJDIR} 
344238405Sjkim	cd ${.CURDIR}/usr.sbin/zic && \
345238405Sjkim		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
346160814Ssimon
347160814Ssimon.include <bsd.subdir.mk>
348160814Ssimon