Makefile revision 5749
12061Sjkh#
25749Swollman#	$Id: Makefile,v 1.35 1995/01/19 22:41:25 wollman 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#	-DMAKE_EBONES to build eBones (KerberosIV)
93197Scsgr#
102061Sjkh#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
112160Scsgr#	-DNOCRYPT will prevent building of crypt versions
122834Swollman#	-DNOLKM do not build loadable kernel modules
132061Sjkh#	-DNOOBJDIR do not run ``${MAKE} obj''
142061Sjkh#	-DNOPROFILE do not build profiled libraries
152160Scsgr#	-DNOSECURE do not go into secure subdir
161594Srgrimes
172061Sjkh# Put initial settings here.
182061SjkhSUBDIR=
191594Srgrimes
204486Sphk# Must be first for "distribute" to work
214486Sphk.if exists(release)
224486SphkSUBDIR+= release
234486Sphk.endif
244486Sphk
252061Sjkh.if exists(bin)
262061SjkhSUBDIR+= bin
272061Sjkh.endif
282061Sjkh.if exists(contrib)
292061SjkhSUBDIR+= contrib
302061Sjkh.endif
312061Sjkh.if exists(games)
322061SjkhSUBDIR+= games
332061Sjkh.endif
342061Sjkh.if exists(gnu)
352061SjkhSUBDIR+= gnu
362061Sjkh.endif
372061Sjkh.if exists(include)
382061SjkhSUBDIR+= include
392061Sjkh.endif
402061Sjkh.if exists(lib)
412061SjkhSUBDIR+= lib
422061Sjkh.endif
433197Scsgr.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
442626ScsgrSUBDIR+= eBones
452626Scsgr.endif
462061Sjkh.if exists(libexec)
472061SjkhSUBDIR+= libexec
482061Sjkh.endif
492061Sjkh.if exists(sbin)
502061SjkhSUBDIR+= sbin
512061Sjkh.endif
522061Sjkh.if exists(share)
532061SjkhSUBDIR+= share
542061Sjkh.endif
552061Sjkh.if exists(sys)
562061SjkhSUBDIR+= sys
572061Sjkh.endif
582061Sjkh.if exists(usr.bin)
592061SjkhSUBDIR+= usr.bin
602061Sjkh.endif
612061Sjkh.if exists(usr.sbin)
622061SjkhSUBDIR+= usr.sbin
632061Sjkh.endif
642834Swollman.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
652834SwollmanSUBDIR+= secure
662834Swollman.endif
672834Swollman.if exists(lkm) && !defined(NOLKM)
682834SwollmanSUBDIR+= lkm
692834Swollman.endif
701594Srgrimes
714486Sphk# etc must be last for "distribute" to work
724486Sphk.if exists(etc) && make(distribute)
734486SphkSUBDIR+= etc
744486Sphk.endif
754486Sphk
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
975511Sjkhworld:	hierarchy mk cleandist includes lib-tools 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
1063030Srgrimeshierarchy:
1072061Sjkh	@echo "--------------------------------------------------------------"
1083030Srgrimes	@echo " Making hierarchy"
1092061Sjkh	@echo "--------------------------------------------------------------"
1103030Srgrimes	cd ${.CURDIR}/release &&		${MAKE} hierarchy
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
1523626Swollmaninstallmost:
1533626Swollman	@echo "--------------------------------------------------------------"
1543626Swollman	@echo " Installing programs only"
1553626Swollman	@echo "--------------------------------------------------------------"
1563626Swollman	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} install
1573626Swollman	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} install
1583626Swollman	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} install
1593626Swollman	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} install
1603626Swollman	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} install
1613626Swollman	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} install
1623626Swollman	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} install
1633626Swollman#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
1643626Swollman#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} installmost
1653626Swollman#.endif
1663626Swollman#.if !defined(NOSECURE) && !defined(NOCRYPT)
1673626Swollman#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} installmost
1683626Swollman#.endif
1693626Swollman
1703626Swollmanmost:
1713626Swollman	@echo "--------------------------------------------------------------"
1723626Swollman	@echo " Building programs only"
1733626Swollman	@echo "--------------------------------------------------------------"
1743626Swollman	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} all
1753626Swollman	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} all
1763626Swollman	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} all
1773626Swollman	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} all
1783626Swollman	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} all
1793626Swollman	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} all
1803626Swollman	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} all
1813626Swollman#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
1823626Swollman#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} most
1833626Swollman#.endif
1843626Swollman#.if !defined(NOSECURE) && !defined(NOCRYPT)
1853626Swollman#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} most
1863626Swollman#.endif
1873626Swollman
1882061Sjkhmk:
1892061Sjkh	@echo "--------------------------------------------------------------"
1902061Sjkh	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
1912061Sjkh	@echo "--------------------------------------------------------------"
1922061Sjkh	cd ${.CURDIR}/share/mk &&		${MAKE} install
1932061Sjkh
1942061Sjkhincludes:
1952061Sjkh	@echo "--------------------------------------------------------------"
1962061Sjkh	@echo " Rebuilding ${DESTDIR}/usr/include"
1972061Sjkh	@echo "--------------------------------------------------------------"
1982061Sjkh	@echo
1992061Sjkh.if defined(CLOBBER)
2002061Sjkh	rm -rf ${DESTDIR}/usr/include
2012061Sjkh	mkdir ${DESTDIR}/usr/include
2022061Sjkh	chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include
2032061Sjkh	chmod 755 ${DESTDIR}/usr/include
2042061Sjkh.endif
2052061Sjkh	cd ${.CURDIR}/include &&		${MAKE} install
2064249Sache	cd ${.CURDIR}/gnu/include &&		${MAKE}	install
2072685Srgrimes	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
2082685Srgrimes	cd ${.CURDIR}/gnu/lib/libg++ &&         ${MAKE} beforeinstall
2093518Sache	cd ${.CURDIR}/gnu/lib/libdialog &&      ${MAKE} beforeinstall
2103197Scsgr.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
2113197Scsgr	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
2123197Scsgr.endif
2132061Sjkh	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
2142061Sjkh	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
2152061Sjkh	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
2162883Sphk	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
2173429Sache	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE}	beforeinstall
2183429Sache	cd ${.CURDIR}/lib/libncurses &&		${MAKE}	beforeinstall
2193242Spaul.if defined(WANT_MSUN)
2203242Spaul	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
2213242Spaul.endif
2222061Sjkh	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
2233213Spst	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
2244942Sache	cd ${.CURDIR}/lib/libtermcap &&		${MAKE}	beforeinstall
2255749Swollman	cd ${.CURDIR}/lib/libcom_err &&		${MAKE} beforeinstall
2262061Sjkh
2275366Snatelib-tools:
2285366Snate	@echo "--------------------------------------------------------------"
2295366Snate	@echo " Rebuilding tools needed to build the libraries
2305366Snate	@echo "--------------------------------------------------------------"
2315366Snate	@echo
2325366Snate	cd ${.CURDIR}/usr.bin/ar && \
2335366Snate		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2345366Snate	cd ${.CURDIR}/usr.bin/ranlib && \
2355366Snate		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2365366Snate	cd ${.CURDIR}/usr.bin/nm && \
2375366Snate		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2385728Swollman	cd ${.CURDIR}/usr.bin/compile_et && \
2395728Swollman		${MAKE} depend all install ${CLEANDIR} ${OBJDIR} && \
2405728Swollman		rm -f /usr/sbin/compile_et
2415728Swollman	cd ${.CURDIR}/usr.bin/mk_cmds && \
2425728Swollman		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2435366Snate
2442061Sjkhlibraries:
2452061Sjkh	@echo "--------------------------------------------------------------"
2462061Sjkh	@echo " Rebuilding ${DESTDIR}/usr/lib"
2472061Sjkh	@echo "--------------------------------------------------------------"
2482061Sjkh	@echo
2492061Sjkh.if defined(CLOBBER)
2502061Sjkh	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
2512061Sjkh		xargs rm -rf
2522061Sjkh.endif
2532468Spaul	cd ${.CURDIR}/gnu/lib && \
2542061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2552273Spaul	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
2562061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2572160Scsgr.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
2582160Scsgr	cd ${.CURDIR}/secure/lib && \
2592160Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2602160Scsgr.endif
2612279Spaul.if exists(lib)
2624054Spst	cd ${.CURDIR}/lib/csu/i386 && \
2634054Spst		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2642061Sjkh	cd ${.CURDIR}/lib && \
2652061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2662279Spaul.endif
2672468Spaul	cd ${.CURDIR}/usr.bin/lex/lib && \
2682468Spaul		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2693197Scsgr.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
2702626Scsgr	cd ${.CURDIR}/eBones/des && \
2712626Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2722626Scsgr	cd ${.CURDIR}/eBones/acl && \
2732626Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2742626Scsgr	cd ${.CURDIR}/eBones/kdb && \
2752626Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2762626Scsgr	cd ${.CURDIR}/eBones/krb && \
2772626Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2782626Scsgr.endif
2792061Sjkh
2802061Sjkhtools:
2812061Sjkh	@echo "--------------------------------------------------------------"
2822061Sjkh	@echo " Rebuilding ${DESTDIR} Compiler and Make"
2832061Sjkh	@echo "--------------------------------------------------------------"
2842061Sjkh	@echo
2852273Spaul	cd ${.CURDIR}/gnu/usr.bin/cc && \
2862061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2872061Sjkh	cd ${.CURDIR}/usr.bin/make && \
2882061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2892061Sjkh
2901594Srgrimes.include <bsd.subdir.mk>
291