Makefile revision 8295
12061Sjkh#
28295Srgrimes#	$Id: Makefile,v 1.53 1995/04/27 11:25:48 jkh 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
207407Srgrimes# We must do include and lib first so that the perl *.ph generation
217407Srgrimes# works correctly as it uses the header files installed by this.
227108Sphk.if exists(include)
237108SphkSUBDIR+= include
247108Sphk.endif
257407Srgrimes.if exists(lib)
267407SrgrimesSUBDIR+= lib
277407Srgrimes.endif
287108Sphk
292061Sjkh.if exists(bin)
302061SjkhSUBDIR+= bin
312061Sjkh.endif
322061Sjkh.if exists(contrib)
332061SjkhSUBDIR+= contrib
342061Sjkh.endif
352061Sjkh.if exists(games)
362061SjkhSUBDIR+= games
372061Sjkh.endif
382061Sjkh.if exists(gnu)
392061SjkhSUBDIR+= gnu
402061Sjkh.endif
413197Scsgr.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
422626ScsgrSUBDIR+= eBones
432626Scsgr.endif
442061Sjkh.if exists(libexec)
452061SjkhSUBDIR+= libexec
462061Sjkh.endif
472061Sjkh.if exists(sbin)
482061SjkhSUBDIR+= sbin
492061Sjkh.endif
502061Sjkh.if exists(share)
512061SjkhSUBDIR+= share
522061Sjkh.endif
532061Sjkh.if exists(sys)
542061SjkhSUBDIR+= sys
552061Sjkh.endif
562061Sjkh.if exists(usr.bin)
572061SjkhSUBDIR+= usr.bin
582061Sjkh.endif
592061Sjkh.if exists(usr.sbin)
602061SjkhSUBDIR+= usr.sbin
612061Sjkh.endif
622834Swollman.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
632834SwollmanSUBDIR+= secure
642834Swollman.endif
652834Swollman.if exists(lkm) && !defined(NOLKM)
662834SwollmanSUBDIR+= lkm
672834Swollman.endif
681594Srgrimes
694486Sphk# etc must be last for "distribute" to work
704486Sphk.if exists(etc) && make(distribute)
714486SphkSUBDIR+= etc
724486Sphk.endif
734486Sphk
742061Sjkh# These are last, since it is nice to at least get the base system
752061Sjkh# rebuilt before you do them.
762061Sjkh.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
772061SjkhSUBDIR+= local
782061Sjkh.endif
792061Sjkh.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
802061SjkhSUBDIR+= ports
812061Sjkh.endif
822061Sjkh
832061Sjkh# Handle the -DNOOBJDIR and -DNOCLEANDIR
842061Sjkh.if defined(NOOBJDIR)
852061SjkhOBJDIR=
862061Sjkh.else
872061SjkhOBJDIR=		obj
882061Sjkh.endif
892061Sjkh.if defined(NOCLEANDIR)
902061SjkhCLEANDIR=	clean
912061Sjkh.else 
922061SjkhCLEANDIR=	cleandir
932061Sjkh.endif
942061Sjkh
955511Sjkhworld:	hierarchy mk cleandist includes lib-tools libraries tools
962061Sjkh	@echo "--------------------------------------------------------------"
972061Sjkh	@echo " Rebuilding ${DESTDIR} The whole thing"
982061Sjkh	@echo "--------------------------------------------------------------"
992061Sjkh	@echo
1002061Sjkh	${MAKE} depend all install
1012061Sjkh	cd ${.CURDIR}/share/man &&		${MAKE} makedb
1022061Sjkh
1033030Srgrimeshierarchy:
1042061Sjkh	@echo "--------------------------------------------------------------"
1053030Srgrimes	@echo " Making hierarchy"
1062061Sjkh	@echo "--------------------------------------------------------------"
1076722Sphk	cd ${.CURDIR}/etc &&		${MAKE} distrib-dirs
1082061Sjkh
1092302Spaulupdate:
1102302Spaul.if defined(SUP_UPDATE)
1112302Spaul	@echo "--------------------------------------------------------------"
1122302Spaul	@echo "Running sup"
1132302Spaul	@echo "--------------------------------------------------------------"
1142302Spaul	@sup -v ${SUPFILE}
1152302Spaul.endif
1162302Spaul.if defined(CVS_UPDATE)
1172302Spaul	@echo "--------------------------------------------------------------"
1182302Spaul	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
1192302Spaul	@echo "--------------------------------------------------------------"
1202302Spaul	cd ${.CURDIR} &&  cvs update -P -d
1212302Spaul.endif
1222302Spaul
1232061Sjkhcleandist:
1242061Sjkh.if !defined(NOCLEANDIR)
1252061Sjkh	@echo "--------------------------------------------------------------"
1262061Sjkh	@echo " Cleaning up the source tree, and rebuilding the obj tree"
1272061Sjkh	@echo "--------------------------------------------------------------"
1282061Sjkh	@echo
1292061Sjkh	here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
1302061Sjkh	if test -d /usr/obj -a ! -d $$dest; then \
1312061Sjkh		mkdir -p $$dest; \
1322061Sjkh	else \
1332061Sjkh		true; \
1342061Sjkh	fi; \
1352061Sjkh	cd $$dest && rm -rf ${SUBDIR}
1362061Sjkh	find . -name obj | xargs rm -rf
1372061Sjkh.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
1382061Sjkh	# The cd is done as local may well be a symbolic link
1392061Sjkh	-cd local && find . -name obj | xargs rm -rf
1402061Sjkh.endif
1412061Sjkh.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
1422061Sjkh	# The cd is done as local may well be a symbolic link
1432061Sjkh	-cd ports && find . -name obj | xargs rm -rf
1442061Sjkh.endif
1452061Sjkh	${MAKE} cleandir
1462061Sjkh	${MAKE} obj
1472061Sjkh.endif
1482061Sjkh
1493626Swollmaninstallmost:
1503626Swollman	@echo "--------------------------------------------------------------"
1513626Swollman	@echo " Installing programs only"
1523626Swollman	@echo "--------------------------------------------------------------"
1533626Swollman	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} install
1543626Swollman	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} install
1553626Swollman	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} install
1563626Swollman	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} install
1573626Swollman	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} install
1583626Swollman	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} install
1593626Swollman	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} install
1607059Sroberto	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} install
1613626Swollman#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
1623626Swollman#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} installmost
1633626Swollman#.endif
1643626Swollman#.if !defined(NOSECURE) && !defined(NOCRYPT)
1653626Swollman#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} installmost
1663626Swollman#.endif
1673626Swollman
1683626Swollmanmost:
1693626Swollman	@echo "--------------------------------------------------------------"
1703626Swollman	@echo " Building programs only"
1713626Swollman	@echo "--------------------------------------------------------------"
1723626Swollman	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} all
1733626Swollman	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} all
1743626Swollman	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} all
1753626Swollman	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} all
1763626Swollman	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} all
1773626Swollman	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} all
1783626Swollman	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} all
1797446Ssos	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} all
1803626Swollman#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
1813626Swollman#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} most
1823626Swollman#.endif
1833626Swollman#.if !defined(NOSECURE) && !defined(NOCRYPT)
1843626Swollman#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} most
1853626Swollman#.endif
1863626Swollman
1872061Sjkhmk:
1882061Sjkh	@echo "--------------------------------------------------------------"
1892061Sjkh	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
1902061Sjkh	@echo "--------------------------------------------------------------"
1912061Sjkh	cd ${.CURDIR}/share/mk &&		${MAKE} install
1922061Sjkh
1932061Sjkhincludes:
1942061Sjkh	@echo "--------------------------------------------------------------"
1952061Sjkh	@echo " Rebuilding ${DESTDIR}/usr/include"
1962061Sjkh	@echo "--------------------------------------------------------------"
1972061Sjkh	@echo
1982061Sjkh.if defined(CLOBBER)
1997130Srgrimes	rm -rf ${DESTDIR}/usr/include/*
2007130Srgrimes	mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
2017130Srgrimes		-p ${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
2187281Srgrimes.if !defined(WANT_CSRG_LIBM)
2193242Spaul	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
2203242Spaul.endif
2217171Sats	cd ${.CURDIR}/lib/libpcap &&		${MAKE} beforeinstall
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
2265772Swollman	cd ${.CURDIR}/lib/libss &&		${MAKE} beforeinstall
2275865Sache	cd ${.CURDIR}/lib/libforms &&		${MAKE}	beforeinstall
2285866Sache	cd ${.CURDIR}/lib/libscsi &&		${MAKE}	beforeinstall
2298095Sjkh	cd ${.CURDIR}/lib/libftp &&		${MAKE}	beforeinstall
2302061Sjkh
2315366Snatelib-tools:
2325366Snate	@echo "--------------------------------------------------------------"
2336934Sse	@echo " Rebuilding tools needed to build the libraries"
2345366Snate	@echo "--------------------------------------------------------------"
2355366Snate	@echo
2367292Srgrimes	cd ${.CURDIR}/gnu/usr.bin/ld && \
2377292Srgrimes		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2385366Snate	cd ${.CURDIR}/usr.bin/ar && \
2395366Snate		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2405366Snate	cd ${.CURDIR}/usr.bin/ranlib && \
2415366Snate		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2425366Snate	cd ${.CURDIR}/usr.bin/nm && \
2435366Snate		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2445772Swollman	cd ${.CURDIR}/usr.bin/lex/lib && \
2455772Swollman		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2465728Swollman	cd ${.CURDIR}/usr.bin/compile_et && \
2475728Swollman		${MAKE} depend all install ${CLEANDIR} ${OBJDIR} && \
2485728Swollman		rm -f /usr/sbin/compile_et
2495728Swollman	cd ${.CURDIR}/usr.bin/mk_cmds && \
2505728Swollman		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2515366Snate
2522061Sjkhlibraries:
2532061Sjkh	@echo "--------------------------------------------------------------"
2542061Sjkh	@echo " Rebuilding ${DESTDIR}/usr/lib"
2552061Sjkh	@echo "--------------------------------------------------------------"
2562061Sjkh	@echo
2572061Sjkh.if defined(CLOBBER)
2582061Sjkh	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
2592061Sjkh		xargs rm -rf
2602061Sjkh.endif
2618295Srgrimes.if exists(lib/libcompat)
2628295Srgrimes	cd ${.CURDIR}/lib/libcompat && \
2638295Srgrimes		${MAKE} depend all install
2648295Srgrimes.endif
2658295Srgrimes.if exists(gnu)
2662468Spaul	cd ${.CURDIR}/gnu/lib && \
2672061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2682273Spaul	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
2692061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2708295Srgrimes.endif
2712160Scsgr.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
2722160Scsgr	cd ${.CURDIR}/secure/lib && \
2732160Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2742160Scsgr.endif
2752279Spaul.if exists(lib)
2764054Spst	cd ${.CURDIR}/lib/csu/i386 && \
2774054Spst		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2782061Sjkh	cd ${.CURDIR}/lib && \
2792061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2802279Spaul.endif
2812468Spaul	cd ${.CURDIR}/usr.bin/lex/lib && \
2822468Spaul		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2833197Scsgr.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
2842626Scsgr	cd ${.CURDIR}/eBones/des && \
2852626Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2862626Scsgr	cd ${.CURDIR}/eBones/acl && \
2872626Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2882626Scsgr	cd ${.CURDIR}/eBones/kdb && \
2892626Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2902626Scsgr	cd ${.CURDIR}/eBones/krb && \
2912626Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2922626Scsgr.endif
2932061Sjkh
2942061Sjkhtools:
2952061Sjkh	@echo "--------------------------------------------------------------"
2962061Sjkh	@echo " Rebuilding ${DESTDIR} Compiler and Make"
2972061Sjkh	@echo "--------------------------------------------------------------"
2982061Sjkh	@echo
2992273Spaul	cd ${.CURDIR}/gnu/usr.bin/cc && \
3002061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
3012061Sjkh	cd ${.CURDIR}/usr.bin/make && \
3022061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
3032061Sjkh
3041594Srgrimes.include <bsd.subdir.mk>
305