1##
2# Makefile support for subproject action target recursion
3##
4# Daniel A. Steffen <das@users.sourceforge.net>
5##
6
7##
8# Set these variables as needed, then include this file
9#
10#  SubProjects
11#  Actions
12#  Actions_nodeps
13#
14##
15
16define subproj_action_targets
17$(1)_subprojs        := $$(SubProjects:%=$(1)-%)
18targets              += $$($(1)_subprojs)
19$$($(1)_subprojs):      TARGET := $(1)
20$$($(1)_subprojs):      $(1)-%:
21$(1)::                  $(if $(2),,$$($(1)_subprojs))
22endef
23
24$(foreach action,$(Actions),$(eval $(call subproj_action_targets,$(action),)))
25ifdef Actions_nodeps
26$(foreach action,$(Actions_nodeps),$(eval $(call subproj_action_targets,$(action),nodeps)))
27endif
28
29$(targets):
30	$(_v) $(MAKE) -C $(SRCROOT)/$* $(TARGET) $(MAKE_ARGS) \
31	        SRCROOT=$(SRCROOT)/$* OBJROOT=$(OBJROOT)/$* SYMROOT=$(SYMROOT)/$* DSTROOT=$(DSTROOT)
32
33.PHONY: $(Actions) $(Actions_nodeps) $(targets)
34.NOTPARALLEL:
35