Makefile revision 5366
12061Sjkh#
25366Snate#	$Id: Makefile,v 1.31 1994/12/04 02:46:28 ache 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
83197Scsgr# XXX1	-DMAKE_KERBEROS to build KerberosIV
93197Scsgr#	-DMAKE_EBONES to build eBones (KerberosIV)
103197Scsgr#
112061Sjkh#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
122160Scsgr#	-DNOCRYPT will prevent building of crypt versions
132834Swollman#	-DNOLKM do not build loadable kernel modules
142061Sjkh#	-DNOOBJDIR do not run ``${MAKE} obj''
152061Sjkh#	-DNOPROFILE do not build profiled libraries
162160Scsgr#	-DNOSECURE do not go into secure subdir
172061Sjkh#
183197Scsgr#
193197Scsgr# XXX1	The kerberos IV off the 4.4-Lite tape (src/kerberosIV)
203197Scsgr#	will not build successfully yet.  MAKE_KERBEROS should not be
213197Scsgr#	defined.
221594Srgrimes
232061Sjkh# Put initial settings here.
242061SjkhSUBDIR=
251594Srgrimes
264486Sphk# Must be first for "distribute" to work
274486Sphk.if exists(release)
284486SphkSUBDIR+= release
294486Sphk.endif
304486Sphk
312061Sjkh.if exists(bin)
322061SjkhSUBDIR+= bin
332061Sjkh.endif
342061Sjkh.if exists(contrib)
352061SjkhSUBDIR+= contrib
362061Sjkh.endif
372061Sjkh.if exists(games)
382061SjkhSUBDIR+= games
392061Sjkh.endif
402061Sjkh.if exists(gnu)
412061SjkhSUBDIR+= gnu
422061Sjkh.endif
432061Sjkh.if exists(include)
442061SjkhSUBDIR+= include
452061Sjkh.endif
462061Sjkh.if exists(lib)
472061SjkhSUBDIR+= lib
482061Sjkh.endif
493197Scsgr.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS)
502061SjkhSUBDIR+= kerberosIV
512061Sjkh.endif
523197Scsgr.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
532626ScsgrSUBDIR+= eBones
542626Scsgr.endif
552061Sjkh.if exists(libexec)
562061SjkhSUBDIR+= libexec
572061Sjkh.endif
582061Sjkh.if exists(sbin)
592061SjkhSUBDIR+= sbin
602061Sjkh.endif
612061Sjkh.if exists(share)
622061SjkhSUBDIR+= share
632061Sjkh.endif
642061Sjkh.if exists(sys)
652061SjkhSUBDIR+= sys
662061Sjkh.endif
672061Sjkh.if exists(usr.bin)
682061SjkhSUBDIR+= usr.bin
692061Sjkh.endif
702061Sjkh.if exists(usr.sbin)
712061SjkhSUBDIR+= usr.sbin
722061Sjkh.endif
732834Swollman.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
742834SwollmanSUBDIR+= secure
752834Swollman.endif
762834Swollman.if exists(lkm) && !defined(NOLKM)
772834SwollmanSUBDIR+= lkm
782834Swollman.endif
791594Srgrimes
804486Sphk# etc must be last for "distribute" to work
814486Sphk.if exists(etc) && make(distribute)
824486SphkSUBDIR+= etc
834486Sphk.endif
844486Sphk
852061Sjkh# These are last, since it is nice to at least get the base system
862061Sjkh# rebuilt before you do them.
872061Sjkh.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
882061SjkhSUBDIR+= local
892061Sjkh.endif
902061Sjkh.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
912061SjkhSUBDIR+= ports
922061Sjkh.endif
932061Sjkh
942061Sjkh# Handle the -DNOOBJDIR and -DNOCLEANDIR
952061Sjkh.if defined(NOOBJDIR)
962061SjkhOBJDIR=
972061Sjkh.else
982061SjkhOBJDIR=		obj
992061Sjkh.endif
1002061Sjkh.if defined(NOCLEANDIR)
1012061SjkhCLEANDIR=	clean
1022061Sjkh.else 
1032061SjkhCLEANDIR=	cleandir
1042061Sjkh.endif
1052061Sjkh
1065366Snateworld:	hierarchy cleandist mk includes lib-tools libraries tools
1072061Sjkh	@echo "--------------------------------------------------------------"
1082061Sjkh	@echo " Rebuilding ${DESTDIR} The whole thing"
1092061Sjkh	@echo "--------------------------------------------------------------"
1102061Sjkh	@echo
1112061Sjkh	${MAKE} depend all install
1122061Sjkh	cd ${.CURDIR}/share/man &&		${MAKE} makedb
1132061Sjkh
1142302Spaul
1153030Srgrimeshierarchy:
1162061Sjkh	@echo "--------------------------------------------------------------"
1173030Srgrimes	@echo " Making hierarchy"
1182061Sjkh	@echo "--------------------------------------------------------------"
1193030Srgrimes	cd ${.CURDIR}/release &&		${MAKE} hierarchy
1202061Sjkh
1212302Spaulupdate:
1222302Spaul.if defined(SUP_UPDATE)
1232302Spaul	@echo "--------------------------------------------------------------"
1242302Spaul	@echo "Running sup"
1252302Spaul	@echo "--------------------------------------------------------------"
1262302Spaul	@sup -v ${SUPFILE}
1272302Spaul.endif
1282302Spaul.if defined(CVS_UPDATE)
1292302Spaul	@echo "--------------------------------------------------------------"
1302302Spaul	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
1312302Spaul	@echo "--------------------------------------------------------------"
1322302Spaul	cd ${.CURDIR} &&  cvs update -P -d
1332302Spaul.endif
1342302Spaul
1352061Sjkhcleandist:
1362061Sjkh.if !defined(NOCLEANDIR)
1372061Sjkh	@echo "--------------------------------------------------------------"
1382061Sjkh	@echo " Cleaning up the source tree, and rebuilding the obj tree"
1392061Sjkh	@echo "--------------------------------------------------------------"
1402061Sjkh	@echo
1412061Sjkh	here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
1422061Sjkh	if test -d /usr/obj -a ! -d $$dest; then \
1432061Sjkh		mkdir -p $$dest; \
1442061Sjkh	else \
1452061Sjkh		true; \
1462061Sjkh	fi; \
1472061Sjkh	cd $$dest && rm -rf ${SUBDIR}
1482061Sjkh	find . -name obj | xargs rm -rf
1492061Sjkh.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
1502061Sjkh	# The cd is done as local may well be a symbolic link
1512061Sjkh	-cd local && find . -name obj | xargs rm -rf
1522061Sjkh.endif
1532061Sjkh.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
1542061Sjkh	# The cd is done as local may well be a symbolic link
1552061Sjkh	-cd ports && find . -name obj | xargs rm -rf
1562061Sjkh.endif
1572061Sjkh	${MAKE} cleandir
1582061Sjkh	${MAKE} obj
1592061Sjkh.endif
1602061Sjkh
1613626Swollmaninstallmost:
1623626Swollman	@echo "--------------------------------------------------------------"
1633626Swollman	@echo " Installing programs only"
1643626Swollman	@echo "--------------------------------------------------------------"
1653626Swollman	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} install
1663626Swollman	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} install
1673626Swollman	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} install
1683626Swollman	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} install
1693626Swollman	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} install
1703626Swollman	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} install
1713626Swollman	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} install
1723626Swollman#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
1733626Swollman#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} installmost
1743626Swollman#.endif
1753626Swollman#.if !defined(NOSECURE) && !defined(NOCRYPT)
1763626Swollman#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} installmost
1773626Swollman#.endif
1783626Swollman
1793626Swollmanmost:
1803626Swollman	@echo "--------------------------------------------------------------"
1813626Swollman	@echo " Building programs only"
1823626Swollman	@echo "--------------------------------------------------------------"
1833626Swollman	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} all
1843626Swollman	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} all
1853626Swollman	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} all
1863626Swollman	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} all
1873626Swollman	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} all
1883626Swollman	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} all
1893626Swollman	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} all
1903626Swollman#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
1913626Swollman#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} most
1923626Swollman#.endif
1933626Swollman#.if !defined(NOSECURE) && !defined(NOCRYPT)
1943626Swollman#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} most
1953626Swollman#.endif
1963626Swollman
1972061Sjkhmk:
1982061Sjkh	@echo "--------------------------------------------------------------"
1992061Sjkh	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
2002061Sjkh	@echo "--------------------------------------------------------------"
2012061Sjkh	cd ${.CURDIR}/share/mk &&		${MAKE} install
2022061Sjkh
2032061Sjkhincludes:
2042061Sjkh	@echo "--------------------------------------------------------------"
2052061Sjkh	@echo " Rebuilding ${DESTDIR}/usr/include"
2062061Sjkh	@echo "--------------------------------------------------------------"
2072061Sjkh	@echo
2082061Sjkh.if defined(CLOBBER)
2092061Sjkh	rm -rf ${DESTDIR}/usr/include
2102061Sjkh	mkdir ${DESTDIR}/usr/include
2112061Sjkh	chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include
2122061Sjkh	chmod 755 ${DESTDIR}/usr/include
2132061Sjkh.endif
2142061Sjkh	cd ${.CURDIR}/include &&		${MAKE} install
2154249Sache	cd ${.CURDIR}/gnu/include &&		${MAKE}	install
2162685Srgrimes	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
2172685Srgrimes	cd ${.CURDIR}/gnu/lib/libg++ &&         ${MAKE} beforeinstall
2183518Sache	cd ${.CURDIR}/gnu/lib/libdialog &&      ${MAKE} beforeinstall
2193197Scsgr.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS)
2202061Sjkh	cd ${.CURDIR}/kerberosIV/include &&	${MAKE} install
2212061Sjkh.endif
2223197Scsgr.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
2233197Scsgr	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
2243197Scsgr.endif
2252061Sjkh	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
2262061Sjkh	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
2272061Sjkh	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
2282883Sphk	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
2293429Sache	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE}	beforeinstall
2303429Sache	cd ${.CURDIR}/lib/libncurses &&		${MAKE}	beforeinstall
2313242Spaul.if defined(WANT_MSUN)
2323242Spaul	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
2333242Spaul.endif
2342061Sjkh	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
2353213Spst	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
2364942Sache	cd ${.CURDIR}/lib/libtermcap &&		${MAKE}	beforeinstall
2372061Sjkh
2385366Snatelib-tools:
2395366Snate	@echo "--------------------------------------------------------------"
2405366Snate	@echo " Rebuilding tools needed to build the libraries
2415366Snate	@echo "--------------------------------------------------------------"
2425366Snate	@echo
2435366Snate	cd ${.CURDIR}/usr.bin/ar && \
2445366Snate		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2455366Snate	cd ${.CURDIR}/usr.bin/ranlib && \
2465366Snate		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2475366Snate	cd ${.CURDIR}/usr.bin/nm && \
2485366Snate		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2495366Snate
2502061Sjkhlibraries:
2512061Sjkh	@echo "--------------------------------------------------------------"
2522061Sjkh	@echo " Rebuilding ${DESTDIR}/usr/lib"
2532061Sjkh	@echo "--------------------------------------------------------------"
2542061Sjkh	@echo
2552061Sjkh.if defined(CLOBBER)
2562061Sjkh	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
2572061Sjkh		xargs rm -rf
2582061Sjkh.endif
2592468Spaul	cd ${.CURDIR}/gnu/lib && \
2602061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2612273Spaul	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
2622061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2632160Scsgr.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
2642160Scsgr	cd ${.CURDIR}/secure/lib && \
2652160Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2662160Scsgr.endif
2672279Spaul.if exists(lib)
2684054Spst	cd ${.CURDIR}/lib/csu/i386 && \
2694054Spst		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2702061Sjkh	cd ${.CURDIR}/lib && \
2712061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2722279Spaul.endif
2732468Spaul	cd ${.CURDIR}/usr.bin/lex/lib && \
2742468Spaul		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2753197Scsgr.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS)
2762061Sjkh	cd ${.CURDIR}/kerberosIV/acl && \
2772061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2782061Sjkh	cd ${.CURDIR}/kerberosIV/des && \
2792061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2802061Sjkh	cd ${.CURDIR}/kerberosIV/kdb && \
2812061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2822061Sjkh	cd ${.CURDIR}/kerberosIV/krb && \
2832061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2842061Sjkh.endif
2853197Scsgr.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
2862626Scsgr	cd ${.CURDIR}/eBones/des && \
2872626Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2882626Scsgr	cd ${.CURDIR}/eBones/acl && \
2892626Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2902626Scsgr	cd ${.CURDIR}/eBones/kdb && \
2912626Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2922626Scsgr	cd ${.CURDIR}/eBones/krb && \
2932626Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2942626Scsgr.endif
2952061Sjkh
2962061Sjkhtools:
2972061Sjkh	@echo "--------------------------------------------------------------"
2982061Sjkh	@echo " Rebuilding ${DESTDIR} Compiler and Make"
2992061Sjkh	@echo "--------------------------------------------------------------"
3002061Sjkh	@echo
3012273Spaul	cd ${.CURDIR}/gnu/usr.bin/cc && \
3022061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
3032061Sjkh	cd ${.CURDIR}/usr.bin/make && \
3042061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
3052061Sjkh
3061594Srgrimes.include <bsd.subdir.mk>
307