Home | History | Annotate | Line # | Download | only in mk
bsd.subdir.mk revision 1.20
      1 #	$NetBSD: bsd.subdir.mk,v 1.20 1997/05/07 17:06:30 mycroft Exp $
      2 #	@(#)bsd.subdir.mk	8.1 (Berkeley) 6/8/93
      3 
      4 .include <bsd.own.mk>
      5 
      6 .if !target(.MAIN)
      7 .MAIN: all
      8 .endif
      9 
     10 _SUBDIRUSE: .USE ${SUBDIR:S/^/${.TARGET}-/}
     11 
     12 __SUBDIRINTERNALUSE: .USE
     13 	@(_maketarget_="${.TARGET}"; \
     14 	entry="$${_maketarget_#*-}";\
     15 	target="$${_maketarget_%%-*}";\
     16 	set -e; if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \
     17 		_newdir_="$${entry}.${MACHINE}"; \
     18 	else \
     19 		_newdir_="$${entry}"; \
     20 	fi; \
     21 	if test X"${_THISDIR_}" = X""; then \
     22 		_nextdir_="$${_newdir_}"; \
     23 	else \
     24 		_nextdir_="$${_THISDIR_}/$${_newdir_}"; \
     25 	fi; \
     26 	if test -d ${.CURDIR}/$${_newdir_}; then \
     27 		echo "===> $${_nextdir_}"; \
     28 		cd ${.CURDIR}/$${_newdir_}; \
     29 		${MAKE} _THISDIR_="$${_nextdir_}" $${target}; \
     30 	else \
     31 		echo "===> $${_nextdir_} [skipped: missing]"; \
     32 	fi)
     33 
     34 .for dir in ${SUBDIR}
     35 .for targ in ${TARGETS}
     36 .PHONY: ${targ}-${dir}
     37 ${targ}-${dir}: .MAKE __SUBDIRINTERNALUSE
     38 .endfor
     39 
     40 # Backward-compatibility with the old rules.  If this went away,
     41 # 'xlint' could become 'lint', 'xinstall' could become 'install', etc.
     42 ${dir}: all-${dir}
     43 .endfor
     44 
     45 .for targ in ${TARGETS}
     46 ${targ}: _SUBDIRUSE
     47 .endfor
     48 
     49 .include <bsd.own.mk>
     50