Makefile revision 2834
12061Sjkh#
22834Swollman#	$Id: Makefile,v 1.17 1994/09/12 05:17:15 rgrimes Exp $
32061Sjkh#
42061Sjkh# Make command line options:
52061Sjkh#	-DCLOBBER will remove /usr/include and MOST of /usr/lib 
62061Sjkh#	-DMAKE_LOCAL to add ./local to the SUBDIR list
72061Sjkh#	-DMAKE_PORTS to add ./ports to the SUBDIR list
82061Sjkh#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
92160Scsgr#	-DNOCRYPT will prevent building of crypt versions
102160Scsgr# XXX2	-DNOKERBEROS do not build Kerberos
112834Swollman#	-DNOLKM do not build loadable kernel modules
122061Sjkh#	-DNOOBJDIR do not run ``${MAKE} obj''
132061Sjkh#	-DNOPROFILE do not build profiled libraries
142160Scsgr#	-DNOSECURE do not go into secure subdir
152626Scsgr#	-DNOEBONES do not make eBones (kerberosIV)
162061Sjkh#
172160Scsgr# XXX2	Mandatory, and Kerberos will not build sucessfully yet
181594Srgrimes
192061Sjkh# Put initial settings here.
202160ScsgrNOKERBEROS=	yes
212061SjkhSUBDIR=
221594Srgrimes
232061Sjkh.if exists(bin)
242061SjkhSUBDIR+= bin
252061Sjkh.endif
262061Sjkh.if exists(contrib)
272061SjkhSUBDIR+= contrib
282061Sjkh.endif
292061Sjkh.if exists(etc)
302061SjkhSUBDIR+= etc
312061Sjkh.endif
322061Sjkh.if exists(games)
332061SjkhSUBDIR+= games
342061Sjkh.endif
352061Sjkh.if exists(gnu)
362061SjkhSUBDIR+= gnu
372061Sjkh.endif
382061Sjkh.if exists(include)
392061SjkhSUBDIR+= include
402061Sjkh.endif
412061Sjkh.if exists(lib)
422061SjkhSUBDIR+= lib
432061Sjkh.endif
442160Scsgr.if exists(kerberosIV) && !defined(NOCRYPT) && !defined(NOKERBEROS)
452061SjkhSUBDIR+= kerberosIV
462061Sjkh.endif
472626Scsgr.if exists(eBones) && !defined(NOCRYPT) && defined(NOKERBEROS) \
482626Scsgr			&& !defined(NOEBONES)
492626ScsgrSUBDIR+= eBones
502626Scsgr.endif
512061Sjkh.if exists(libexec)
522061SjkhSUBDIR+= libexec
532061Sjkh.endif
542061Sjkh.if exists(sbin)
552061SjkhSUBDIR+= sbin
562061Sjkh.endif
572061Sjkh.if exists(share)
582061SjkhSUBDIR+= share
592061Sjkh.endif
602061Sjkh.if exists(sys)
612061SjkhSUBDIR+= sys
622061Sjkh.endif
632061Sjkh.if exists(usr.bin)
642061SjkhSUBDIR+= usr.bin
652061Sjkh.endif
662061Sjkh.if exists(usr.sbin)
672061SjkhSUBDIR+= usr.sbin
682061Sjkh.endif
692834Swollman.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
702834SwollmanSUBDIR+= secure
712834Swollman.endif
722834Swollman.if exists(lkm) && !defined(NOLKM)
732834SwollmanSUBDIR+= lkm
742834Swollman.endif
751594Srgrimes
762061Sjkh# These are last, since it is nice to at least get the base system
772061Sjkh# rebuilt before you do them.
782061Sjkh.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
792061SjkhSUBDIR+= local
802061Sjkh.endif
812061Sjkh.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
822061SjkhSUBDIR+= ports
832061Sjkh.endif
842061Sjkh
852061Sjkh# Handle the -DNOOBJDIR and -DNOCLEANDIR
862061Sjkh.if defined(NOOBJDIR)
872061SjkhOBJDIR=
882061Sjkh.else
892061SjkhOBJDIR=		obj
902061Sjkh.endif
912061Sjkh.if defined(NOCLEANDIR)
922061SjkhCLEANDIR=	clean
932061Sjkh.else 
942061SjkhCLEANDIR=	cleandir
952061Sjkh.endif
962061Sjkh
972468Spaulworld:	directories cleandist mk includes libraries tools
982061Sjkh	@echo "--------------------------------------------------------------"
992061Sjkh	@echo " Rebuilding ${DESTDIR} The whole thing"
1002061Sjkh	@echo "--------------------------------------------------------------"
1012061Sjkh	@echo
1022061Sjkh	${MAKE} depend all install
1032061Sjkh	cd ${.CURDIR}/share/man &&		${MAKE} makedb
1042061Sjkh
1052302Spaul
1062061Sjkhdirectories:
1072061Sjkh	@echo "--------------------------------------------------------------"
1082061Sjkh	@echo " Making directories"
1092061Sjkh	@echo "--------------------------------------------------------------"
1102302Spaul	cd ${.CURDIR}/etc &&			${MAKE} distrib-dirs
1112061Sjkh
1122302Spaulupdate:
1132302Spaul.if defined(SUP_UPDATE)
1142302Spaul	@echo "--------------------------------------------------------------"
1152302Spaul	@echo "Running sup"
1162302Spaul	@echo "--------------------------------------------------------------"
1172302Spaul	@sup -v ${SUPFILE}
1182302Spaul.endif
1192302Spaul.if defined(CVS_UPDATE)
1202302Spaul	@echo "--------------------------------------------------------------"
1212302Spaul	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
1222302Spaul	@echo "--------------------------------------------------------------"
1232302Spaul	cd ${.CURDIR} &&  cvs update -P -d
1242302Spaul.endif
1252302Spaul
1262061Sjkhcleandist:
1272061Sjkh.if !defined(NOCLEANDIR)
1282061Sjkh	@echo "--------------------------------------------------------------"
1292061Sjkh	@echo " Cleaning up the source tree, and rebuilding the obj tree"
1302061Sjkh	@echo "--------------------------------------------------------------"
1312061Sjkh	@echo
1322061Sjkh	here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
1332061Sjkh	if test -d /usr/obj -a ! -d $$dest; then \
1342061Sjkh		mkdir -p $$dest; \
1352061Sjkh	else \
1362061Sjkh		true; \
1372061Sjkh	fi; \
1382061Sjkh	cd $$dest && rm -rf ${SUBDIR}
1392061Sjkh	find . -name obj | xargs rm -rf
1402061Sjkh.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
1412061Sjkh	# The cd is done as local may well be a symbolic link
1422061Sjkh	-cd local && find . -name obj | xargs rm -rf
1432061Sjkh.endif
1442061Sjkh.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
1452061Sjkh	# The cd is done as local may well be a symbolic link
1462061Sjkh	-cd ports && find . -name obj | xargs rm -rf
1472061Sjkh.endif
1482061Sjkh	${MAKE} cleandir
1492061Sjkh	${MAKE} obj
1502061Sjkh.endif
1512061Sjkh
1522061Sjkhmk:
1532061Sjkh	@echo "--------------------------------------------------------------"
1542061Sjkh	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
1552061Sjkh	@echo "--------------------------------------------------------------"
1562061Sjkh	cd ${.CURDIR}/share/mk &&		${MAKE} install
1572061Sjkh
1582061Sjkhincludes:
1592061Sjkh	@echo "--------------------------------------------------------------"
1602061Sjkh	@echo " Rebuilding ${DESTDIR}/usr/include"
1612061Sjkh	@echo "--------------------------------------------------------------"
1622061Sjkh	@echo
1632061Sjkh.if defined(CLOBBER)
1642061Sjkh	rm -rf ${DESTDIR}/usr/include
1652061Sjkh	mkdir ${DESTDIR}/usr/include
1662061Sjkh	chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include
1672061Sjkh	chmod 755 ${DESTDIR}/usr/include
1682061Sjkh.endif
1692061Sjkh	cd ${.CURDIR}/include &&		${MAKE} install
1702685Srgrimes	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
1712685Srgrimes	cd ${.CURDIR}/gnu/lib/libg++ &&         ${MAKE} beforeinstall
1722626Scsgr.if exists(kerberosIV) && !defined(NOCRYPT) && !defined(NOKERBEROS)
1732061Sjkh	cd ${.CURDIR}/kerberosIV/include &&	${MAKE} install
1742061Sjkh.endif
1752061Sjkh	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
1762061Sjkh	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
1772061Sjkh	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
1782061Sjkh	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
1792626Scsgr.if exists(eBones) && !defined(NOCRYPT) && defined(NOKERBEROS) && \
1802626Scsgr			!defined(NOEBONES)
1812626Scsgr	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
1822626Scsgr.endif
1832061Sjkh
1842061Sjkhlibraries:
1852061Sjkh	@echo "--------------------------------------------------------------"
1862061Sjkh	@echo " Rebuilding ${DESTDIR}/usr/lib"
1872061Sjkh	@echo "--------------------------------------------------------------"
1882061Sjkh	@echo
1892061Sjkh.if defined(CLOBBER)
1902061Sjkh	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
1912061Sjkh		xargs rm -rf
1922061Sjkh.endif
1932468Spaul	cd ${.CURDIR}/gnu/lib && \
1942061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
1952273Spaul	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
1962061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
1972160Scsgr.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
1982160Scsgr	cd ${.CURDIR}/secure/lib && \
1992160Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2002160Scsgr.endif
2012279Spaul.if exists(lib)
2022061Sjkh	cd ${.CURDIR}/lib && \
2032061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2042279Spaul.endif
2052468Spaul	cd ${.CURDIR}/usr.bin/lex/lib && \
2062468Spaul		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2072626Scsgr.if exists(kerberosIV) && !defined(NOCRYPT) && !defined(NOKERBEROS)
2082061Sjkh	cd ${.CURDIR}/kerberosIV/acl && \
2092061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2102061Sjkh	cd ${.CURDIR}/kerberosIV/des && \
2112061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2122061Sjkh	cd ${.CURDIR}/kerberosIV/kdb && \
2132061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2142061Sjkh	cd ${.CURDIR}/kerberosIV/krb && \
2152061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2162061Sjkh.endif
2172626Scsgr.if exists(eBones) && !defined(NOCRYPT) && defined(NOKERBEROS) && \
2182626Scsgr			!defined(NOEBONES)
2192626Scsgr	cd ${.CURDIR}/eBones/des && \
2202626Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2212626Scsgr	cd ${.CURDIR}/eBones/acl && \
2222626Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2232626Scsgr	cd ${.CURDIR}/eBones/kdb && \
2242626Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2252626Scsgr	cd ${.CURDIR}/eBones/krb && \
2262626Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2272626Scsgr.endif
2282061Sjkh
2292061Sjkhtools:
2302061Sjkh	@echo "--------------------------------------------------------------"
2312061Sjkh	@echo " Rebuilding ${DESTDIR} Compiler and Make"
2322061Sjkh	@echo "--------------------------------------------------------------"
2332061Sjkh	@echo
2342273Spaul	cd ${.CURDIR}/gnu/usr.bin/cc && \
2352061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2362061Sjkh	cd ${.CURDIR}/usr.bin/make && \
2372061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2382061Sjkh
2391594Srgrimes.include <bsd.subdir.mk>
240