Makefile revision 12166
14910Swollman#
2139365Srik#	$Id: Makefile,v 1.66 1995/11/05 18:42:23 jfieber Exp $
3139823Simp#
4139823Simp# Make command line options:
5139365Srik#	-DCLOBBER will remove /usr/include and MOST of /usr/lib
625944Sjoerg#	-DMAKE_LOCAL to add ./local to the SUBDIR list
74910Swollman#	-DMAKE_PORTS to add ./ports to the SUBDIR list
825944Sjoerg#	-DMAKE_EBONES to build eBones (KerberosIV)
925944Sjoerg#
1025944Sjoerg#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
114910Swollman#	-DNOCRYPT will prevent building of crypt versions
124910Swollman#	-DNOLKM do not build loadable kernel modules
134910Swollman#	-DNOOBJDIR do not run ``${MAKE} obj''
1413765Smpp#	-DNOPROFILE do not build profiled libraries
154910Swollman#	-DNOSECURE do not go into secure subdir
164910Swollman
174910Swollman# Put initial settings here.
1830300SjoergSUBDIR=
1925944Sjoerg
2050477Speter# We must do include and lib first so that the perl *.ph generation
214910Swollman# works correctly as it uses the header files installed by this.
224910Swollman.if exists(include)
2341687SphkSUBDIR+= include
2441687Sphk.endif
254910Swollman.if exists(lib)
2625944SjoergSUBDIR+= lib
2725944Sjoerg.endif
284910Swollman
2925944Sjoerg.if exists(bin)
304910SwollmanSUBDIR+= bin
3125944Sjoerg.endif
3225944Sjoerg.if exists(contrib)
3325944SjoergSUBDIR+= contrib
3411189Sjkh.endif
3525944Sjoerg.if exists(games)
3625944SjoergSUBDIR+= games
3725944Sjoerg.endif
3825944Sjoerg.if exists(gnu)
3925944SjoergSUBDIR+= gnu
404910Swollman.endif
414910Swollman.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
4225944SjoergSUBDIR+= eBones
4378064Sume.endif
4425944Sjoerg.if exists(libexec)
454910SwollmanSUBDIR+= libexec
4625944Sjoerg.endif
4725944Sjoerg.if exists(sbin)
4825944SjoergSUBDIR+= sbin
4925944Sjoerg.endif
5042104Sphk.if exists(share)
5178064SumeSUBDIR+= share
5288507Sjoerg.endif
5378064Sume.if exists(sys)
5488507SjoergSUBDIR+= sys
5588534Sjoerg.endif
5688534Sjoerg.if exists(usr.bin)
5788534SjoergSUBDIR+= usr.bin
584910Swollman.endif
594910Swollman.if exists(usr.sbin)
6088711SjoergSUBDIR+= usr.sbin
6130300Sjoerg.endif
6225944Sjoerg.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
6330300SjoergSUBDIR+= secure
6430300Sjoerg.endif
6530300Sjoerg.if exists(lkm) && !defined(NOLKM)
6630300SjoergSUBDIR+= lkm
6730300Sjoerg.endif
6830300Sjoerg
6930300Sjoerg# etc must be last for "distribute" to work
7030300Sjoerg.if exists(etc) && make(distribute)
7130300SjoergSUBDIR+= etc
7230300Sjoerg.endif
7330300Sjoerg
7478064Sume# These are last, since it is nice to at least get the base system
7578064Sume# rebuilt before you do them.
7630300Sjoerg.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
7730300SjoergSUBDIR+= local
7830300Sjoerg.endif
7925944Sjoerg.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
8025944SjoergSUBDIR+= ports
8125944Sjoerg.endif
8225944Sjoerg
8325944Sjoerg# Handle the -DNOOBJDIR and -DNOCLEANDIR
8425944Sjoerg.if defined(NOOBJDIR)
8525944SjoergOBJDIR=
8625944Sjoerg.else
8725944SjoergOBJDIR=		obj
8825944Sjoerg.endif
8988558Sjoerg.if defined(NOCLEANDIR)
9088558SjoergCLEANDIR=	clean
9188558Sjoerg.else
9288558SjoergCLEANDIR=	cleandir
9388558Sjoerg.endif
9488558Sjoerg
9588558Sjoergworld:	hierarchy mk cleandist includes lib-tools libraries build-tools
9688558Sjoerg	@echo "--------------------------------------------------------------"
9788558Sjoerg	@echo " Rebuilding ${DESTDIR} The whole thing"
9888558Sjoerg	@echo "--------------------------------------------------------------"
9988558Sjoerg	@echo
10088558Sjoerg	${MAKE} depend all install
10188723Sjoerg	cd ${.CURDIR}/share/man &&		${MAKE} makedb
10288723Sjoerg
10388723Sjoerghierarchy:
10488723Sjoerg	@echo "--------------------------------------------------------------"
10588723Sjoerg	@echo " Making hierarchy"
10688723Sjoerg	@echo "--------------------------------------------------------------"
10788723Sjoerg	cd ${.CURDIR}/etc &&		${MAKE} distrib-dirs
10888558Sjoerg
10988558Sjoergupdate:
11088558Sjoerg.if defined(SUP_UPDATE)
11188558Sjoerg	@echo "--------------------------------------------------------------"
11288558Sjoerg	@echo "Running sup"
11388558Sjoerg	@echo "--------------------------------------------------------------"
11488558Sjoerg	@sup -v ${SUPFILE}
11588558Sjoerg.if defined(SUPFILE1)
11688558Sjoerg	@sup -v ${SUPFILE1}
11788558Sjoerg.endif
11888558Sjoerg.if defined(SUPFILE2)
11988558Sjoerg	@sup -v ${SUPFILE2}
12088558Sjoerg.endif
12188558Sjoerg.endif
12288558Sjoerg.if defined(CVS_UPDATE)
12388558Sjoerg	@echo "--------------------------------------------------------------"
12488558Sjoerg	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
12588558Sjoerg	@echo "--------------------------------------------------------------"
12688558Sjoerg	cd ${.CURDIR} &&  cvs update -P -d
12788558Sjoerg.endif
12888558Sjoerg
12988558Sjoergcleandist:
13088558Sjoerg.if !defined(NOCLEANDIR)
13188558Sjoerg	@echo "--------------------------------------------------------------"
13288558Sjoerg	@echo " Cleaning up the source tree, and rebuilding the obj tree"
13388558Sjoerg	@echo "--------------------------------------------------------------"
13488558Sjoerg	@echo
13588558Sjoerg	here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
13688558Sjoerg	if test -d /usr/obj -a ! -d $$dest; then \
13788558Sjoerg		mkdir -p $$dest; \
1384910Swollman	else \
139147256Sbrooks		true; \
1404910Swollman	fi; \
14126018Sjoerg	cd $$dest && rm -rf ${SUBDIR}
1424910Swollman	find . -name obj | xargs rm -rf
14345152Sphk.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
14445152Sphk	# The cd is done as local may well be a symbolic link
1454910Swollman	-cd local && find . -name obj | xargs rm -rf
1464910Swollman.endif
14778064Sume.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
14878064Sume	# The cd is done as local may well be a symbolic link
14925944Sjoerg	-cd ports && find . -name obj | xargs rm -rf
15025944Sjoerg.endif
15125944Sjoerg	${MAKE} cleandir
15225944Sjoerg	${MAKE} obj
15325944Sjoerg.endif
15488723Sjoerg
15588723Sjoerginstallmost:
15688723Sjoerg	@echo "--------------------------------------------------------------"
15788577Sjoerg	@echo " Installing programs only"
15888577Sjoerg	@echo "--------------------------------------------------------------"
159138745Srik	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} install
160138745Srik	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} install
161138745Srik	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} install
16230300Sjoerg	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} install
16330300Sjoerg	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} install
16478064Sume	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} install
16530300Sjoerg	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} install
16630300Sjoerg	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} install
16788599Sjoerg#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
168139365Srik#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} installmost
169139365Srik#.endif
17025944Sjoerg#.if !defined(NOSECURE) && !defined(NOCRYPT)
17125944Sjoerg#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} installmost
17225944Sjoerg#.endif
17325944Sjoerg
17425944Sjoergmost:
17525944Sjoerg	@echo "--------------------------------------------------------------"
17625944Sjoerg	@echo " Building programs only"
17725944Sjoerg	@echo "--------------------------------------------------------------"
17825944Sjoerg	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} all
17925944Sjoerg	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} all
18025944Sjoerg	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} all
18125944Sjoerg	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} all
18225944Sjoerg	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} all
18325944Sjoerg	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} all
18425944Sjoerg	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} all
18525944Sjoerg	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} all
18625944Sjoerg#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
18725944Sjoerg#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} most
18842104Sphk#.endif
18942104Sphk#.if !defined(NOSECURE) && !defined(NOCRYPT)
19042104Sphk#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} most
19142104Sphk#.endif
19242104Sphk
19342104Sphkmk:
19442104Sphk	@echo "--------------------------------------------------------------"
19542104Sphk	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
19642104Sphk	@echo "--------------------------------------------------------------"
19741963Sphk	cd ${.CURDIR}/share/mk &&		${MAKE} install
19841963Sphk
19941963Sphkincludes:
200138745Srik	@echo "--------------------------------------------------------------"
201138745Srik	@echo " Rebuilding ${DESTDIR}/usr/include"
202138745Srik	@echo "--------------------------------------------------------------"
203138745Srik	@echo
204138745Srik.if defined(CLOBBER)
2054910Swollman	rm -rf ${DESTDIR}/usr/include/*
206147256Sbrooks	mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
207147256Sbrooks		-p ${DESTDIR}/usr/include
2084910Swollman.endif
20988558Sjoerg	cd ${.CURDIR}/include &&		${MAKE} install
2104910Swollman	cd ${.CURDIR}/gnu/include &&		${MAKE}	install
211139365Srik	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
21230300Sjoerg	cd ${.CURDIR}/gnu/lib/libregex &&	${MAKE} beforeinstall
21330300Sjoerg	cd ${.CURDIR}/gnu/lib/libg++ &&         ${MAKE} beforeinstall
21430300Sjoerg	cd ${.CURDIR}/gnu/lib/libdialog &&      ${MAKE} beforeinstall
2154910Swollman.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
2164910Swollman	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
2174910Swollman	cd ${.CURDIR}/eBones/lib/libkrb &&	${MAKE} beforeinstall
2184910Swollman.endif
21938343Sbde	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
2204910Swollman	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
22130300Sjoerg	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
22211189Sjkh	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
2234910Swollman	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE}	beforeinstall
224139365Srik	cd ${.CURDIR}/lib/libncurses &&		${MAKE}	beforeinstall
225139365Srik.if !defined(WANT_CSRG_LIBM)
226139365Srik	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
227139365Srik.endif
228139365Srik	cd ${.CURDIR}/lib/libpcap &&		${MAKE} beforeinstall
229139365Srik	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
230139365Srik	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
231139365Srik	cd ${.CURDIR}/lib/libtermcap &&		${MAKE}	beforeinstall
2324910Swollman	cd ${.CURDIR}/lib/libcom_err &&		${MAKE} beforeinstall
2334910Swollman	cd ${.CURDIR}/lib/libss &&		${MAKE} beforeinstall
23441687Sphk	cd ${.CURDIR}/lib/libforms &&		${MAKE}	beforeinstall
235	cd ${.CURDIR}/lib/libscsi &&		${MAKE}	beforeinstall
236
237lib-tools:
238	@echo "--------------------------------------------------------------"
239	@echo " Rebuilding tools needed to build the libraries"
240	@echo "--------------------------------------------------------------"
241	@echo
242	cd ${.CURDIR}/gnu/usr.bin/ld && \
243		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
244	cd ${.CURDIR}/usr.bin/ar && \
245		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
246	cd ${.CURDIR}/usr.bin/ranlib && \
247		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
248	cd ${.CURDIR}/usr.bin/nm && \
249		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
250	cd ${.CURDIR}/usr.bin/lex/lib && \
251		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
252	cd ${.CURDIR}/usr.bin/compile_et && \
253		${MAKE} depend all install ${CLEANDIR} ${OBJDIR} && \
254		rm -f /usr/sbin/compile_et
255	cd ${.CURDIR}/usr.bin/mk_cmds && \
256		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
257
258libraries:
259	@echo "--------------------------------------------------------------"
260	@echo " Rebuilding ${DESTDIR}/usr/lib"
261	@echo "--------------------------------------------------------------"
262	@echo
263.if defined(CLOBBER)
264	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
265		xargs rm -rf
266.endif
267.if exists(lib/libcompat)
268	cd ${.CURDIR}/lib/libcompat && \
269		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
270.endif
271.if exists(lib/libncurses)
272	cd ${.CURDIR}/lib/libncurses && \
273		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
274.endif
275.if exists(lib/libtermcap)
276	cd ${.CURDIR}/lib/libtermcap && \
277		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
278.endif
279.if exists(gnu)
280	cd ${.CURDIR}/gnu/lib && \
281		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
282	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
283		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
284.endif
285.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
286	cd ${.CURDIR}/secure/lib && \
287		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
288.endif
289.if exists(lib)
290	cd ${.CURDIR}/lib/csu/i386 && \
291		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
292	cd ${.CURDIR}/lib && \
293		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
294.endif
295.if exists(usr.sbin/lex/lib)
296	cd ${.CURDIR}/usr.bin/lex/lib && \
297		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
298.endif
299.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
300	cd ${.CURDIR}/eBones/des && \
301		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
302	cd ${.CURDIR}/eBones/lib && \
303		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
304.endif
305.if exists(usr.sbin/pcvt/keycap)
306	cd ${.CURDIR}/usr.sbin/pcvt/keycap && \
307		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
308.endif
309
310build-tools:
311	@echo "--------------------------------------------------------------"
312	@echo " Rebuilding ${DESTDIR} C compiler, make, symorder, sgmlfmt and zic(8)"
313	@echo "--------------------------------------------------------------"
314	@echo
315	cd ${.CURDIR}/gnu/usr.bin/cc && \
316		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
317	cd ${.CURDIR}/usr.bin/make && \
318		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
319	cd ${.CURDIR}/usr.bin/symorder && \
320		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
321	cd ${.CURDIR}/usr.bin/sgmlfmt && \
322		${MAKE} depend all install ${CLEANDIR} ${OBJDIR} 
323	cd ${.CURDIR}/share/sgml && \
324		${MAKE} depend all install ${CLEANDIR} ${OBJDIR} 
325	cd ${.CURDIR}/usr.sbin/zic && \
326		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
327
328.include <bsd.subdir.mk>
329