xref: /csrg-svn/share/mk/bsd.subdir.mk (revision 40511)
140508Sbostic# A Makefile for handling subdirectories.
240508Sbostic# Machine dependent subdirectories take precedence.
340508Sbostic#
4*40511Sbostic#	@(#)bsd.subdir.mk	5.2 (Berkeley) 03/16/90
540508Sbostic#
640508Sbostic
740508Sbostic# user defines:
840508Sbostic#	SUBDIR -- the list of subdirectories to be processed
940508Sbostic
1040508Sbostic# the default target.
1140508Sbostic.MAIN: all
1240508Sbostic
1340508Sbostic# The standard targets change to the subdirectory and make the
1440508Sbostic# target.
1540508SbosticSTDALL STDDEPEND STDCLEAN STDCLEANDIR STDLINT STDINSTALL STDTAGS: .USE
1640508Sbostic	@for entry in ${SUBDIR}; do \
1740508Sbostic		(echo "===> $$entry"; \
1840508Sbostic		if test -d $${entry}.${MACHINE}; then \
1940508Sbostic			cd $${entry}.${MACHINE}; \
2040508Sbostic		else \
2140508Sbostic			cd $${entry}; \
2240508Sbostic		fi; \
2340508Sbostic		${MAKE} ${.TARGET}) \
2440508Sbostic	done
2540508Sbostic
2640508Sbostic# If the user has not specified the target, use the standard version.
2740508Sbosticall: STDALL
2840508Sbosticclean: STDCLEAN
2940508Sbosticcleandir: STDCLEANDIR
30*40511Sbosticdepend: STDDEPEND
3140508Sbosticlint: STDLINT
3240508Sbosticinstall: STDINSTALL
3340508Sbostictags: STDTAGS
3440508Sbostic
3540508Sbostic# If trying to make one of the subdirectories, change to it and make
3640508Sbostic# the default target.
3740508Sbostic${SUBDIR}:
3840508Sbostic	@if test -d ${.TARGET}.${MACHINE}; then \
3940508Sbostic		cd ${.TARGET}.${MACHINE}; \
4040508Sbostic	else \
4140508Sbostic		cd ${.TARGET}; \
4240508Sbostic	fi; \
4340508Sbostic	${MAKE}
44