17 ALT_TARGET_PATHS
= $(filter-out %/target
,$(basename $(wildcard $(ROOT
)/src
/main
/target
/*/*.mk
)))
18 ALT_TARGET_NAMES
= $(notdir $(ALT_TARGET_PATHS
))
19 BASE_TARGET_NAMES
= $(notdir $(patsubst %/,%,$(dir $(ALT_TARGET_PATHS
))))
20 BASE_ALT_PAIRS
= $(join $(BASE_TARGET_NAMES
:=/),$(ALT_TARGET_NAMES
))
22 ALT_TARGETS
= $(sort $(notdir $(BASE_ALT_PAIRS
)))
23 BASE_TARGETS
= $(sort $(notdir $(patsubst %/,%,$(dir $(wildcard $(ROOT
)/src
/main
/target
/*/target.mk
)))))
24 NOBUILD_TARGETS
= $(sort $(filter-out target
,$(basename $(notdir $(wildcard $(ROOT
)/src
/main
/target
/*/*.nomk
)))))
25 OPBL_TARGETS
= $(sort $(filter %_OPBL
,$(ALT_TARGETS
)))
27 VALID_TARGETS
= $(sort $(filter-out $(NOBUILD_TARGETS
),$(BASE_TARGETS
) $(ALT_TARGETS
)))
29 # For alt targets, returns their base target name.
30 # For base targets, returns the (same) target name.
31 # param $1 = target name
32 find_target_pair
= $(filter %/$(1),$(BASE_ALT_PAIRS
))
33 get_base_target
= $(if
$(call find_target_pair
,$(1)),$(patsubst %/,%,$(dir $(call find_target_pair
,$(1)))),$(1))
35 UNSUPPORTED_TARGETS
:= \
97 SUPPORTED_TARGETS
:= $(filter-out $(UNSUPPORTED_TARGETS
), $(VALID_TARGETS
))
99 TARGETS_TOTAL
:= $(words $(SUPPORTED_TARGETS
))
101 TARGETS_PER_GROUP
:= $(shell expr
$(TARGETS_TOTAL
) / $(TARGET_GROUPS
) )
104 ET
:= $(shell expr
$(ST
) + $(TARGETS_PER_GROUP
))
105 GROUP_1_TARGETS
:= $(wordlist
$(ST
), $(ET
), $(SUPPORTED_TARGETS
))
107 ST
:= $(shell expr
$(ET
) + 1)
108 ET
:= $(shell expr
$(ST
) + $(TARGETS_PER_GROUP
))
109 GROUP_2_TARGETS
:= $(wordlist
$(ST
), $(ET
), $(SUPPORTED_TARGETS
))
111 ST
:= $(shell expr
$(ET
) + 1)
112 ET
:= $(shell expr
$(ST
) + $(TARGETS_PER_GROUP
))
113 GROUP_3_TARGETS
:= $(wordlist
$(ST
), $(ET
), $(SUPPORTED_TARGETS
))
115 ST
:= $(shell expr
$(ET
) + 1)
116 ET
:= $(shell expr
$(ST
) + $(TARGETS_PER_GROUP
))
117 GROUP_4_TARGETS
:= $(wordlist
$(ST
), $(ET
), $(SUPPORTED_TARGETS
))
119 GROUP_OTHER_TARGETS
:= $(filter-out $(GROUP_1_TARGETS
) $(GROUP_2_TARGETS
) $(GROUP_3_TARGETS
) $(GROUP_4_TARGETS
), $(SUPPORTED_TARGETS
))