Makefile revision 3242
138032Speter#
264562Sgshapiro#	$Id: Makefile,v 1.23 1994/09/29 21:20:12 pst Exp $
364562Sgshapiro#
438032Speter# Make command line options:
538032Speter#	-DCLOBBER will remove /usr/include and MOST of /usr/lib 
638032Speter#	-DMAKE_LOCAL to add ./local to the SUBDIR list
738032Speter#	-DMAKE_PORTS to add ./ports to the SUBDIR list
838032Speter# XXX1	-DMAKE_KERBEROS to build KerberosIV
938032Speter#	-DMAKE_EBONES to build eBones (KerberosIV)
1038032Speter#
1138032Speter#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
1238032Speter#	-DNOCRYPT will prevent building of crypt versions
1338032Speter#	-DNOLKM do not build loadable kernel modules
1438032Speter#	-DNOOBJDIR do not run ``${MAKE} obj''
1564562Sgshapiro#	-DNOPROFILE do not build profiled libraries
1664562Sgshapiro#	-DNOSECURE do not go into secure subdir
1738032Speter#
1864562Sgshapiro#
1964562Sgshapiro# XXX1	The kerberos IV off the 4.4-Lite tape (src/kerberosIV)
2064562Sgshapiro#	will not build successfully yet.  MAKE_KERBEROS should not be
2164562Sgshapiro#	defined.
2264562Sgshapiro
2364562Sgshapiro# Put initial settings here.
2438032SpeterSUBDIR=
2538032Speter
2638032Speter.if exists(bin)
2764562SgshapiroSUBDIR+= bin
2838032Speter.endif
2964562Sgshapiro.if exists(contrib)
3064562SgshapiroSUBDIR+= contrib
3164562Sgshapiro.endif
3264562Sgshapiro.if exists(etc)
3364562Sgshapiro# XXX until etc vs release conversion is done
3464562Sgshapiro# SUBDIR+= etc
3564562Sgshapiro.endif
3664562Sgshapiro.if exists(games)
3738032SpeterSUBDIR+= games
3838032Speter.endif
3938032Speter.if exists(gnu)
4038032SpeterSUBDIR+= gnu
4138032Speter.endif
4238032Speter.if exists(include)
4338032SpeterSUBDIR+= include
4438032Speter.endif
4538032Speter.if exists(lib)
4638032SpeterSUBDIR+= lib
4738032Speter.endif
4838032Speter.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS)
4938032SpeterSUBDIR+= kerberosIV
5038032Speter.endif
5138032Speter.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
5238032SpeterSUBDIR+= eBones
5338032Speter.endif
5464562Sgshapiro.if exists(libexec)
5538032SpeterSUBDIR+= libexec
5664562Sgshapiro.endif
5764562Sgshapiro.if exists(sbin)
5864562SgshapiroSUBDIR+= sbin
5964562Sgshapiro.endif
6064562Sgshapiro.if exists(share)
6164562SgshapiroSUBDIR+= share
6264562Sgshapiro.endif
6364562Sgshapiro.if exists(sys)
6464562SgshapiroSUBDIR+= sys
6564562Sgshapiro.endif
6664562Sgshapiro.if exists(usr.bin)
6764562SgshapiroSUBDIR+= usr.bin
6864562Sgshapiro.endif
6964562Sgshapiro.if exists(usr.sbin)
7038032SpeterSUBDIR+= usr.sbin
7138032Speter.endif
7238032Speter.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
7338032SpeterSUBDIR+= secure
7438032Speter.endif
7538032Speter.if exists(lkm) && !defined(NOLKM)
7638032SpeterSUBDIR+= lkm
7738032Speter.endif
7838032Speter
7938032Speter# These are last, since it is nice to at least get the base system
8038032Speter# rebuilt before you do them.
8138032Speter.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
8238032SpeterSUBDIR+= local
8338032Speter.endif
8438032Speter.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
8538032SpeterSUBDIR+= ports
8664562Sgshapiro.endif
8764562Sgshapiro
8838032Speter# Handle the -DNOOBJDIR and -DNOCLEANDIR
8938032Speter.if defined(NOOBJDIR)
9038032SpeterOBJDIR=
9138032Speter.else
9238032SpeterOBJDIR=		obj
9338032Speter.endif
9438032Speter.if defined(NOCLEANDIR)
9538032SpeterCLEANDIR=	clean
9638032Speter.else 
9764562SgshapiroCLEANDIR=	cleandir
9838032Speter.endif
9938032Speter
10038032Speterworld:	hierarchy cleandist mk includes libraries tools
10138032Speter	@echo "--------------------------------------------------------------"
10238032Speter	@echo " Rebuilding ${DESTDIR} The whole thing"
10364562Sgshapiro	@echo "--------------------------------------------------------------"
10438032Speter	@echo
10538032Speter	${MAKE} depend all install
10638032Speter	cd ${.CURDIR}/share/man &&		${MAKE} makedb
10738032Speter
10838032Speter
10938032Speterhierarchy:
11038032Speter	@echo "--------------------------------------------------------------"
11138032Speter	@echo " Making hierarchy"
11238032Speter	@echo "--------------------------------------------------------------"
11364562Sgshapiro	cd ${.CURDIR}/release &&		${MAKE} hierarchy
11438032Speter
11538032Speterupdate:
11638032Speter.if defined(SUP_UPDATE)
11738032Speter	@echo "--------------------------------------------------------------"
11838032Speter	@echo "Running sup"
11938032Speter	@echo "--------------------------------------------------------------"
12038032Speter	@sup -v ${SUPFILE}
12164562Sgshapiro.endif
12264562Sgshapiro.if defined(CVS_UPDATE)
12364562Sgshapiro	@echo "--------------------------------------------------------------"
12464562Sgshapiro	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
12538032Speter	@echo "--------------------------------------------------------------"
12638032Speter	cd ${.CURDIR} &&  cvs update -P -d
12738032Speter.endif
12864562Sgshapiro
12938032Spetercleandist:
13064562Sgshapiro.if !defined(NOCLEANDIR)
13164562Sgshapiro	@echo "--------------------------------------------------------------"
13264562Sgshapiro	@echo " Cleaning up the source tree, and rebuilding the obj tree"
13364562Sgshapiro	@echo "--------------------------------------------------------------"
13464562Sgshapiro	@echo
13564562Sgshapiro	here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
13664562Sgshapiro	if test -d /usr/obj -a ! -d $$dest; then \
13764562Sgshapiro		mkdir -p $$dest; \
13864562Sgshapiro	else \
13964562Sgshapiro		true; \
14064562Sgshapiro	fi; \
14164562Sgshapiro	cd $$dest && rm -rf ${SUBDIR}
14264562Sgshapiro	find . -name obj | xargs rm -rf
14364562Sgshapiro.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
14464562Sgshapiro	# The cd is done as local may well be a symbolic link
14564562Sgshapiro	-cd local && find . -name obj | xargs rm -rf
14664562Sgshapiro.endif
14764562Sgshapiro.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
14864562Sgshapiro	# The cd is done as local may well be a symbolic link
14964562Sgshapiro	-cd ports && find . -name obj | xargs rm -rf
15064562Sgshapiro.endif
15138032Speter	${MAKE} cleandir
15264562Sgshapiro	${MAKE} obj
15338032Speter.endif
15464562Sgshapiro
15538032Spetermk:
15638032Speter	@echo "--------------------------------------------------------------"
15738032Speter	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
15864562Sgshapiro	@echo "--------------------------------------------------------------"
15964562Sgshapiro	cd ${.CURDIR}/share/mk &&		${MAKE} install
16064562Sgshapiro
16164562Sgshapiroincludes:
16264562Sgshapiro	@echo "--------------------------------------------------------------"
16364562Sgshapiro	@echo " Rebuilding ${DESTDIR}/usr/include"
16464562Sgshapiro	@echo "--------------------------------------------------------------"
16538032Speter	@echo
16638032Speter.if defined(CLOBBER)
16738032Speter	rm -rf ${DESTDIR}/usr/include
16838032Speter	mkdir ${DESTDIR}/usr/include
16938032Speter	chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include
17064562Sgshapiro	chmod 755 ${DESTDIR}/usr/include
17138032Speter.endif
17238032Speter	cd ${.CURDIR}/include &&		${MAKE} install
17364562Sgshapiro	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
17438032Speter	cd ${.CURDIR}/gnu/lib/libg++ &&         ${MAKE} beforeinstall
17564562Sgshapiro.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS)
17638032Speter	cd ${.CURDIR}/kerberosIV/include &&	${MAKE} install
17764562Sgshapiro.endif
17864562Sgshapiro.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
17938032Speter	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
18064562Sgshapiro.endif
18138032Speter	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
18238032Speter	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
18338032Speter	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
18438032Speter	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
18538032Speter.if defined(WANT_MSUN)
18638032Speter	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
18764562Sgshapiro.endif
18864562Sgshapiro	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
18938032Speter	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
19038032Speter
19138032Speterlibraries:
19264562Sgshapiro	@echo "--------------------------------------------------------------"
19338032Speter	@echo " Rebuilding ${DESTDIR}/usr/lib"
19438032Speter	@echo "--------------------------------------------------------------"
19538032Speter	@echo
19638032Speter.if defined(CLOBBER)
19764562Sgshapiro	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
19838032Speter		xargs rm -rf
19938032Speter.endif
20038032Speter	cd ${.CURDIR}/gnu/lib && \
20138032Speter		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
20264562Sgshapiro	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
20338032Speter		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
20464562Sgshapiro.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
20538032Speter	cd ${.CURDIR}/secure/lib && \
20664562Sgshapiro		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
20738032Speter.endif
20838032Speter.if exists(lib)
20938032Speter	cd ${.CURDIR}/lib && \
21038032Speter		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
21138032Speter.endif
21238032Speter	cd ${.CURDIR}/usr.bin/lex/lib && \
21338032Speter		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
21438032Speter.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS)
21564562Sgshapiro	cd ${.CURDIR}/kerberosIV/acl && \
21638032Speter		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
21764562Sgshapiro	cd ${.CURDIR}/kerberosIV/des && \
21864562Sgshapiro		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
21964562Sgshapiro	cd ${.CURDIR}/kerberosIV/kdb && \
22064562Sgshapiro		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
22164562Sgshapiro	cd ${.CURDIR}/kerberosIV/krb && \
22264562Sgshapiro		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
22364562Sgshapiro.endif
22438032Speter.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
22564562Sgshapiro	cd ${.CURDIR}/eBones/des && \
22638032Speter		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
22738032Speter	cd ${.CURDIR}/eBones/acl && \
22864562Sgshapiro		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
22964562Sgshapiro	cd ${.CURDIR}/eBones/kdb && \
23064562Sgshapiro		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
23164562Sgshapiro	cd ${.CURDIR}/eBones/krb && \
23264562Sgshapiro		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
23364562Sgshapiro.endif
23464562Sgshapiro
23564562Sgshapirotools:
23664562Sgshapiro	@echo "--------------------------------------------------------------"
23764562Sgshapiro	@echo " Rebuilding ${DESTDIR} Compiler and Make"
23864562Sgshapiro	@echo "--------------------------------------------------------------"
23964562Sgshapiro	@echo
24064562Sgshapiro	cd ${.CURDIR}/gnu/usr.bin/cc && \
24164562Sgshapiro		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
24264562Sgshapiro	cd ${.CURDIR}/usr.bin/make && \
24364562Sgshapiro		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
24464562Sgshapiro
24564562Sgshapiro.include <bsd.subdir.mk>
24664562Sgshapiro