1 # $Id: subdir.mk,v 1.16 2017/02/08 22:16:59 sjg Exp $
2 # skip missing directories...
4 # $NetBSD: bsd.subdir.mk,v 1.11 1996/04/04 02:05:06 jtc Exp $
5 # @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91
7 .if
${.MAKE.LEVEL
} == 0 && ${.MAKE.MODE
:Uno
:Mmeta
*} != ""
8 .
include <meta.subdir.mk
>
11 .elif
!commands
(_SUBDIRUSE
) && !defined
(NO_SUBDIR
) && !defined
(NOSUBDIR
)
12 .
-include <${.CURDIR
}/Makefile.inc
>
18 .
ifdef SUBDIR_MUST_EXIST
19 MISSING_DIR
=echo
"Missing ===> ${.CURDIR}/$${entry}"; exit
1
21 MISSING_DIR
=echo
"Skipping ===> ${.CURDIR}/$${entry}"; continue
26 @Exists
() { test -f
$$1; }; \
27 for entry in
${SUBDIR}; do \
29 if Exists
${.CURDIR
}/$${entry}.
${MACHINE}/[mM
]akefile
; then \
30 _newdir_
="$${entry}.${MACHINE}"; \
31 elif Exists
${.CURDIR
}/$${entry}/[mM
]akefile
; then \
32 _newdir_
="$${entry}"; \
36 if
test X
"${_THISDIR_}" = X
""; then \
37 _nextdir_
="$${_newdir_}"; \
39 _nextdir_
="$${_THISDIR_}/$${_newdir_}"; \
41 ${ECHO_DIR} "===> $${_nextdir_}"; \
42 cd
${.CURDIR
}/$${_newdir_}; \
43 ${.MAKE
} _THISDIR_
="$${_nextdir_}" \
44 ${.TARGET
:S
/realinstall
/install/:S
/.depend
/depend
/}) || exit
1; \
48 @set
-e
; _r
=${.CURDIR
}/; \
49 if
test -z
"${.TARGET:M/*}"; then \
50 if
test -d
${.CURDIR
}/${.TARGET
}.
${MACHINE}; then \
51 _newdir_
=${.TARGET
}.
${MACHINE}; \
53 _newdir_
=${.TARGET
}; \
56 _r
= _newdir_
=${.TARGET
}; \
58 ${ECHO_DIR} "===> $${_newdir_}"; \
59 cd
$${_r}$${_newdir_}; \
60 ${.MAKE
} _THISDIR_
="$${_newdir_}" all
64 .if
!target
(beforeinstall
)
67 .if
!target
(afterinstall
)
71 maninstall
: afterinstall
72 afterinstall
: realinstall
73 realinstall
: beforeinstall _SUBDIRUSE
78 -cd
${.CURDIR
}; etags
`echo ${.ALLSRC:N*.h} | sed 's;${.CURDIR}/;;'`
93 .for t in
${SUBDIR_TARGETS
:O
:u
}
102 # make sure this exists