Makefile revision 7108
12061Sjkh#
27108Sphk#	$Id: Makefile,v 1.44 1995/03/14 21:32:46 roberto 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
207108Sphk# do include first.
217108Sphk.if exists(include)
227108SphkSUBDIR+= include
237108Sphk.endif
247108Sphk
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(lib)
382061SjkhSUBDIR+= lib
392061Sjkh.endif
403197Scsgr.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
412626ScsgrSUBDIR+= eBones
422626Scsgr.endif
432061Sjkh.if exists(libexec)
442061SjkhSUBDIR+= libexec
452061Sjkh.endif
462061Sjkh.if exists(sbin)
472061SjkhSUBDIR+= sbin
482061Sjkh.endif
492061Sjkh.if exists(share)
502061SjkhSUBDIR+= share
512061Sjkh.endif
522061Sjkh.if exists(sys)
532061SjkhSUBDIR+= sys
542061Sjkh.endif
552061Sjkh.if exists(usr.bin)
562061SjkhSUBDIR+= usr.bin
572061Sjkh.endif
582061Sjkh.if exists(usr.sbin)
592061SjkhSUBDIR+= usr.sbin
602061Sjkh.endif
612834Swollman.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
622834SwollmanSUBDIR+= secure
632834Swollman.endif
642834Swollman.if exists(lkm) && !defined(NOLKM)
652834SwollmanSUBDIR+= lkm
662834Swollman.endif
671594Srgrimes
684486Sphk# etc must be last for "distribute" to work
694486Sphk.if exists(etc) && make(distribute)
704486SphkSUBDIR+= etc
714486Sphk.endif
724486Sphk
732061Sjkh# These are last, since it is nice to at least get the base system
742061Sjkh# rebuilt before you do them.
752061Sjkh.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
762061SjkhSUBDIR+= local
772061Sjkh.endif
782061Sjkh.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
792061SjkhSUBDIR+= ports
802061Sjkh.endif
812061Sjkh
822061Sjkh# Handle the -DNOOBJDIR and -DNOCLEANDIR
832061Sjkh.if defined(NOOBJDIR)
842061SjkhOBJDIR=
852061Sjkh.else
862061SjkhOBJDIR=		obj
872061Sjkh.endif
882061Sjkh.if defined(NOCLEANDIR)
892061SjkhCLEANDIR=	clean
902061Sjkh.else 
912061SjkhCLEANDIR=	cleandir
922061Sjkh.endif
932061Sjkh
945511Sjkhworld:	hierarchy mk cleandist includes lib-tools libraries tools
952061Sjkh	@echo "--------------------------------------------------------------"
962061Sjkh	@echo " Rebuilding ${DESTDIR} The whole thing"
972061Sjkh	@echo "--------------------------------------------------------------"
982061Sjkh	@echo
992061Sjkh	${MAKE} depend all install
1002061Sjkh	cd ${.CURDIR}/share/man &&		${MAKE} makedb
1012061Sjkh
1023030Srgrimeshierarchy:
1032061Sjkh	@echo "--------------------------------------------------------------"
1043030Srgrimes	@echo " Making hierarchy"
1052061Sjkh	@echo "--------------------------------------------------------------"
1066722Sphk	cd ${.CURDIR}/etc &&		${MAKE} distrib-dirs
1072061Sjkh
1082302Spaulupdate:
1092302Spaul.if defined(SUP_UPDATE)
1102302Spaul	@echo "--------------------------------------------------------------"
1112302Spaul	@echo "Running sup"
1122302Spaul	@echo "--------------------------------------------------------------"
1132302Spaul	@sup -v ${SUPFILE}
1142302Spaul.endif
1152302Spaul.if defined(CVS_UPDATE)
1162302Spaul	@echo "--------------------------------------------------------------"
1172302Spaul	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
1182302Spaul	@echo "--------------------------------------------------------------"
1192302Spaul	cd ${.CURDIR} &&  cvs update -P -d
1202302Spaul.endif
1212302Spaul
1222061Sjkhcleandist:
1232061Sjkh.if !defined(NOCLEANDIR)
1242061Sjkh	@echo "--------------------------------------------------------------"
1252061Sjkh	@echo " Cleaning up the source tree, and rebuilding the obj tree"
1262061Sjkh	@echo "--------------------------------------------------------------"
1272061Sjkh	@echo
1282061Sjkh	here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
1292061Sjkh	if test -d /usr/obj -a ! -d $$dest; then \
1302061Sjkh		mkdir -p $$dest; \
1312061Sjkh	else \
1322061Sjkh		true; \
1332061Sjkh	fi; \
1342061Sjkh	cd $$dest && rm -rf ${SUBDIR}
1352061Sjkh	find . -name obj | xargs rm -rf
1362061Sjkh.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
1372061Sjkh	# The cd is done as local may well be a symbolic link
1382061Sjkh	-cd local && find . -name obj | xargs rm -rf
1392061Sjkh.endif
1402061Sjkh.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
1412061Sjkh	# The cd is done as local may well be a symbolic link
1422061Sjkh	-cd ports && find . -name obj | xargs rm -rf
1432061Sjkh.endif
1442061Sjkh	${MAKE} cleandir
1452061Sjkh	${MAKE} obj
1462061Sjkh.endif
1472061Sjkh
1483626Swollmaninstallmost:
1493626Swollman	@echo "--------------------------------------------------------------"
1503626Swollman	@echo " Installing programs only"
1513626Swollman	@echo "--------------------------------------------------------------"
1523626Swollman	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} install
1533626Swollman	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} install
1543626Swollman	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} install
1553626Swollman	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} install
1563626Swollman	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} install
1573626Swollman	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} install
1583626Swollman	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} install
1597059Sroberto	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} install
1603626Swollman#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
1613626Swollman#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} installmost
1623626Swollman#.endif
1633626Swollman#.if !defined(NOSECURE) && !defined(NOCRYPT)
1643626Swollman#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} installmost
1653626Swollman#.endif
1663626Swollman
1673626Swollmanmost:
1683626Swollman	@echo "--------------------------------------------------------------"
1693626Swollman	@echo " Building programs only"
1703626Swollman	@echo "--------------------------------------------------------------"
1713626Swollman	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} all
1723626Swollman	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} all
1733626Swollman	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} all
1743626Swollman	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} all
1753626Swollman	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} all
1763626Swollman	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} all
1773626Swollman	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} all
1787059Sroberto	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} install
1793626Swollman#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
1803626Swollman#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} most
1813626Swollman#.endif
1823626Swollman#.if !defined(NOSECURE) && !defined(NOCRYPT)
1833626Swollman#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} most
1843626Swollman#.endif
1853626Swollman
1862061Sjkhmk:
1872061Sjkh	@echo "--------------------------------------------------------------"
1882061Sjkh	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
1892061Sjkh	@echo "--------------------------------------------------------------"
1902061Sjkh	cd ${.CURDIR}/share/mk &&		${MAKE} install
1912061Sjkh
1922061Sjkhincludes:
1932061Sjkh	@echo "--------------------------------------------------------------"
1942061Sjkh	@echo " Rebuilding ${DESTDIR}/usr/include"
1952061Sjkh	@echo "--------------------------------------------------------------"
1962061Sjkh	@echo
1972061Sjkh.if defined(CLOBBER)
1982061Sjkh	rm -rf ${DESTDIR}/usr/include
1992061Sjkh	mkdir ${DESTDIR}/usr/include
2002061Sjkh	chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include
2012061Sjkh	chmod 755 ${DESTDIR}/usr/include
2022061Sjkh.endif
2032061Sjkh	cd ${.CURDIR}/include &&		${MAKE} install
2044249Sache	cd ${.CURDIR}/gnu/include &&		${MAKE}	install
2052685Srgrimes	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
2066927Snate	cd ${.CURDIR}/gnu/lib/libregex &&	${MAKE} beforeinstall
2072685Srgrimes	cd ${.CURDIR}/gnu/lib/libg++ &&         ${MAKE} beforeinstall
2083518Sache	cd ${.CURDIR}/gnu/lib/libdialog &&      ${MAKE} beforeinstall
2093197Scsgr.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
2103197Scsgr	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
2113197Scsgr.endif
2122061Sjkh	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
2132061Sjkh	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
2142061Sjkh	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
2152883Sphk	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
2163429Sache	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE}	beforeinstall
2173429Sache	cd ${.CURDIR}/lib/libncurses &&		${MAKE}	beforeinstall
2183242Spaul.if defined(WANT_MSUN)
2193242Spaul	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
2203242Spaul.endif
2212061Sjkh	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
2223213Spst	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
2234942Sache	cd ${.CURDIR}/lib/libtermcap &&		${MAKE}	beforeinstall
2245749Swollman	cd ${.CURDIR}/lib/libcom_err &&		${MAKE} beforeinstall
2255772Swollman	cd ${.CURDIR}/lib/libss &&		${MAKE} beforeinstall
2265865Sache	cd ${.CURDIR}/lib/libforms &&		${MAKE}	beforeinstall
2275866Sache	cd ${.CURDIR}/lib/libscsi &&		${MAKE}	beforeinstall
2282061Sjkh
2295366Snatelib-tools:
2305366Snate	@echo "--------------------------------------------------------------"
2316934Sse	@echo " Rebuilding tools needed to build the libraries"
2325366Snate	@echo "--------------------------------------------------------------"
2335366Snate	@echo
2345366Snate	cd ${.CURDIR}/usr.bin/ar && \
2355366Snate		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2365366Snate	cd ${.CURDIR}/usr.bin/ranlib && \
2375366Snate		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2385366Snate	cd ${.CURDIR}/usr.bin/nm && \
2395366Snate		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2405772Swollman	cd ${.CURDIR}/usr.bin/lex/lib && \
2415772Swollman		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2425728Swollman	cd ${.CURDIR}/usr.bin/compile_et && \
2435728Swollman		${MAKE} depend all install ${CLEANDIR} ${OBJDIR} && \
2445728Swollman		rm -f /usr/sbin/compile_et
2455728Swollman	cd ${.CURDIR}/usr.bin/mk_cmds && \
2465728Swollman		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2475366Snate
2482061Sjkhlibraries:
2492061Sjkh	@echo "--------------------------------------------------------------"
2502061Sjkh	@echo " Rebuilding ${DESTDIR}/usr/lib"
2512061Sjkh	@echo "--------------------------------------------------------------"
2522061Sjkh	@echo
2532061Sjkh.if defined(CLOBBER)
2542061Sjkh	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
2552061Sjkh		xargs rm -rf
2562061Sjkh.endif
2572468Spaul	cd ${.CURDIR}/gnu/lib && \
2582061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2592273Spaul	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
2602061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2612160Scsgr.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
2622160Scsgr	cd ${.CURDIR}/secure/lib && \
2632160Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2642160Scsgr.endif
2652279Spaul.if exists(lib)
2664054Spst	cd ${.CURDIR}/lib/csu/i386 && \
2674054Spst		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2682061Sjkh	cd ${.CURDIR}/lib && \
2692061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2702279Spaul.endif
2712468Spaul	cd ${.CURDIR}/usr.bin/lex/lib && \
2722468Spaul		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2733197Scsgr.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
2742626Scsgr	cd ${.CURDIR}/eBones/des && \
2752626Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2762626Scsgr	cd ${.CURDIR}/eBones/acl && \
2772626Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2782626Scsgr	cd ${.CURDIR}/eBones/kdb && \
2792626Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2802626Scsgr	cd ${.CURDIR}/eBones/krb && \
2812626Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2822626Scsgr.endif
2832061Sjkh
2842061Sjkhtools:
2852061Sjkh	@echo "--------------------------------------------------------------"
2862061Sjkh	@echo " Rebuilding ${DESTDIR} Compiler and Make"
2872061Sjkh	@echo "--------------------------------------------------------------"
2882061Sjkh	@echo
2892273Spaul	cd ${.CURDIR}/gnu/usr.bin/cc && \
2902061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2912061Sjkh	cd ${.CURDIR}/usr.bin/make && \
2922061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2932061Sjkh
2941594Srgrimes.include <bsd.subdir.mk>
295