Home | History | Annotate | Line # | Download | only in mk
bsd.subdir.mk revision 1.18
      1 #	$NetBSD: bsd.subdir.mk,v 1.18 1997/05/06 23:53:40 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:S/realinstall/install/}"; \
     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 .if !target(install)
     46 .if !target(beforeinstall)
     47 beforeinstall:
     48 .endif
     49 .if !target(afterinstall)
     50 afterinstall:
     51 .endif
     52 install: ${MANINSTALL}
     53 ${MANINSTALL}: afterinstall
     54 afterinstall: realinstall
     55 realinstall: beforeinstall _SUBDIRUSE
     56 .endif
     57 
     58 .if !target(all)
     59 all: _SUBDIRUSE
     60 .endif
     61 
     62 .if !target(clean)
     63 clean: _SUBDIRUSE
     64 .endif
     65 
     66 .if !target(cleandir)
     67 cleandir: _SUBDIRUSE
     68 .endif
     69 
     70 .if !target(includes)
     71 includes: _SUBDIRUSE
     72 .endif
     73 
     74 .if !target(depend)
     75 depend: _SUBDIRUSE
     76 .endif
     77 
     78 .if !target(lint)
     79 lint: _SUBDIRUSE
     80 .endif
     81 
     82 .if !target(obj)
     83 obj: _SUBDIRUSE
     84 .endif
     85 
     86 .if !target(tags)
     87 tags: _SUBDIRUSE
     88 .endif
     89 
     90 .include <bsd.own.mk>
     91