Home | History | Annotate | Line # | Download | only in mk
bsd.subdir.mk revision 1.13
      1 #	$NetBSD: bsd.subdir.mk,v 1.13 1997/03/24 21:54:22 christos Exp $
      2 #	@(#)bsd.subdir.mk	5.9 (Berkeley) 2/1/91
      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 	echo "===> $${_nextdir_}"; \
     27 	cd ${.CURDIR}/$${_newdir_}; \
     28 	${MAKE} _THISDIR_="$${_nextdir_}" $${target});
     29 
     30 .for dir in ${SUBDIR}
     31 all-${dir}: __SUBDIRINTERNALUSE
     32 install-${dir}: __SUBDIRINTERNALUSE
     33 realinstall-${dir}: __SUBDIRINTERNALUSE
     34 clean-${dir}: __SUBDIRINTERNALUSE
     35 cleandir-${dir}: __SUBDIRINTERNALUSE
     36 includes-${dir}: __SUBDIRINTERNALUSE
     37 depend-${dir}: __SUBDIRINTERNALUSE
     38 lint-${dir}: __SUBDIRINTERNALUSE
     39 obj-${dir}: __SUBDIRINTERNALUSE
     40 tags-${dir}: __SUBDIRINTERNALUSE
     41 
     42 # Backward-compatibility with the old rules.  If this went away,
     43 # 'xlint' could become 'lint', 'xinstall' could become 'install', etc.
     44 ${dir}: all-${dir}
     45 .endfor
     46 
     47 .if !target(install)
     48 .if !target(beforeinstall)
     49 beforeinstall:
     50 .endif
     51 .if !target(afterinstall)
     52 afterinstall:
     53 .endif
     54 install: ${MANINSTALL}
     55 ${MANINSTALL}: afterinstall
     56 afterinstall: realinstall
     57 realinstall: beforeinstall _SUBDIRUSE
     58 .endif
     59 
     60 .if !target(all)
     61 all: _SUBDIRUSE
     62 .endif
     63 
     64 .if !target(clean)
     65 clean: _SUBDIRUSE
     66 .endif
     67 
     68 .if !target(cleandir)
     69 cleandir: _SUBDIRUSE
     70 .endif
     71 
     72 .if !target(includes)
     73 includes: _SUBDIRUSE
     74 .endif
     75 
     76 .if !target(depend)
     77 depend: _SUBDIRUSE
     78 .endif
     79 
     80 .if !target(lint)
     81 lint: _SUBDIRUSE
     82 .endif
     83 
     84 .if !target(obj)
     85 obj: _SUBDIRUSE
     86 .endif
     87 
     88 .if !target(tags)
     89 tags: _SUBDIRUSE
     90 .endif
     91 
     92 .include <bsd.own.mk>
     93