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; \
49 .if
!target
(beforeinstall
)
52 .if
!target
(afterinstall
)
56 maninstall
: afterinstall
57 afterinstall
: realinstall
58 realinstall
: beforeinstall _SUBDIRUSE
63 -cd
${.CURDIR
}; etags
`echo ${.ALLSRC:N*.h} | sed 's;${.CURDIR}/;;'`
77 # this parallelizes, unlike _SUBDIRUSE, but is only in effect if the
78 # SUBDIR_TARGETS target (eg. "all") has not been defined before (eg. in
80 .for t in
${SUBDIR_TARGETS
:O
:u
}
81 .if
!target
($t) && make
($t)
85 @set
-e
; _r
=${.CURDIR
}/; \
86 if
test -z
"${sd:M/*}"; then \
87 if
test -d
${.CURDIR
}/${sd}.
${MACHINE}; then \
88 _newdir_
=${sd}.
${MACHINE}; \
95 ${ECHO_DIR} "===> $${_newdir_}"; \
96 cd
$${_r}$${_newdir_}; \
97 ${.MAKE
} _THISDIR_
="$${_newdir_}" ${t
:S
/realinstall
/install/:S
/.depend
/depend
/}
104 # make sure this exists