summaryrefslogtreecommitdiff
path: root/mkc_imp.subprj.mk
blob: 69dc369a0169e141522afce7e889bab5ab4cd6de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Copyright (c) 2010 by Aleksey Cheusov
# Copyright (c) 1994-2009 The NetBSD Foundation, Inc.
# Copyright (c) 1988, 1989, 1993 The Regents of the University of California
# Copyright (c) 1988, 1989 by Adam de Boor
# Copyright (c) 1989 by Berkeley Softworks
#
# See COPYRIGHT file in the distribution.
############################################################

.if !defined(_MKC_IMP_SUBPRJ_MK)
_MKC_IMP_SUBPRJ_MK := 1

.for dir in ${SUBPRJ:S/:/ /g}
.if empty(NOSUBDIR:U:M${dir})
__REALSUBPRJ += ${dir}
.endif
.endfor

__REALSUBPRJ := ${__REALSUBPRJ:O:u}

SUBPRJ_DFLT ?=	${__REALSUBPRJ}

.for targ in ${TARGETS}
.for dir in ${__REALSUBPRJ}
.PHONY: nodeps-${targ}-${dir} subdir-${targ}-${dir} ${targ}-${dir}
nodeps-${targ}-${dir}: .MAKE __recurse
       ${targ}-${dir}: .MAKE __recurse # nodeps-${targ}-${dir}
subdir-${targ}-${dir}: .MAKE __recurse # nodeps-${targ}-${dir}
.endfor # dir

.for dir in ${SUBPRJ_DFLT}
.if !commands(${targ})
${targ}: ${targ}-${dir}
.endif
.endfor

.for dep prj in ${SUBPRJ:M*\:*:S/:/ /}
.PHONY: ${targ}-${prj} ${targ}-${dep}
${targ}-${prj}: ${targ}-${dep}
.endfor

.endfor # targ

.for dir in ${__REALSUBPRJ}
.PHONY: ${dir}
${dir}: all-${dir}
.endfor # dir

# Make sure all of the standard targets are defined, even if they do nothing.
${TARGETS}:

.include <mkc_imp.objdir.mk>

.endif # _MKC_IMP_SUBPRJ_MK