rework for pmake 2.1
[unix-history] / usr / src / share / mk / bsd.subdir.mk
CommitLineData
9ad5c186
KB
1# A Makefile for handling subdirectories.
2# Machine dependent subdirectories take precedence.
3#
4# @(#)bsd.subdir.mk 5.1 (Berkeley) %G%
5#
6
7# user defines:
8# SUBDIR -- the list of subdirectories to be processed
9
10# the default target.
11.MAIN: all
12
13# The standard targets change to the subdirectory and make the
14# target.
15STDALL STDDEPEND STDCLEAN STDCLEANDIR STDLINT STDINSTALL STDTAGS: .USE
16 @for entry in ${SUBDIR}; do \
17 (echo "===> $$entry"; \
18 if test -d $${entry}.${MACHINE}; then \
19 cd $${entry}.${MACHINE}; \
20 else \
21 cd $${entry}; \
22 fi; \
23 ${MAKE} ${.TARGET}) \
24 done
25
26# If the user has not specified the target, use the standard version.
27all: STDALL
28depend: STDDEPEND
29clean: STDCLEAN
30cleandir: STDCLEANDIR
31lint: STDLINT
32install: STDINSTALL
33tags: STDTAGS
34
35# If trying to make one of the subdirectories, change to it and make
36# the default target.
37${SUBDIR}:
38 @if test -d ${.TARGET}.${MACHINE}; then \
39 cd ${.TARGET}.${MACHINE}; \
40 else \
41 cd ${.TARGET}; \
42 fi; \
43 ${MAKE}