summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Theodore <tonyt@logyst.com>2018-03-11 02:07:17 (GMT)
committerTony Theodore <tonyt@logyst.com>2018-03-12 03:28:14 (GMT)
commit068d3c0d7b5c23c4307d56fcf6851009290cfe2c (patch)
treea40f82c87cc596f6ac58a05e30b551cf5822fe9d
parent2573d98c7ed462ca38563dd52168860f45cf27de (diff)
downloadmxe-068d3c0d7b5c23c4307d56fcf6851009290cfe2c.zip
mxe-068d3c0d7b5c23c4307d56fcf6851009290cfe2c.tar.gz
mxe-068d3c0d7b5c23c4307d56fcf6851009290cfe2c.tar.bz2
Makefile: unify handling of required pkgs
-rw-r--r--Makefile40
1 files changed, 27 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index b961b9a..45047a6 100644
--- a/Makefile
+++ b/Makefile
@@ -534,8 +534,7 @@ $(foreach PKG,$(PKGS), \
$(foreach TARGET,$(filter $($(PKG)_TARGETS),$(CROSS_TARGETS) $(BUILD)), \
$(eval $(TARGET)~$(PKG)_PKG := $(PKG)) \
$(eval $(TARGET)~$(PKG)_TGT := $(TARGET)) \
- $(eval $(TARGET)_PKGS += $(PKG)) \
- $(eval FILTERED_PKGS += $(PKG))))
+ $(eval $(TARGET)_PKGS += $(PKG))))
# always add $(BUILD) to our targets
override MXE_TARGETS := $(CROSS_TARGETS) $(BUILD)
@@ -588,9 +587,6 @@ PRINTF_FMT := printf '%-$(PRINTF_COL_1_WIDTH)s %-$(PKG_COL_WIDTH)s %-$(TAR
RTRIM := $(SED) 's, \+$$$$,,'
WRAP_MESSAGE = $(\n)$(\n)$(call repeat,-,60)$(\n)$(1)$(and $(2),$(\n)$(\n)$(2))$(\n)$(call repeat,-,60)$(\n)
-.PHONY: download
-download: $(addprefix download-,$(PKGS))
-
define TARGET_RULE
$(if $(findstring i686-pc-mingw32,$(1)),\
$(error $(call WRAP_MESSAGE,\
@@ -815,15 +811,17 @@ SET_CLEAR = \
$(eval $(1) := )
# WALK functions accept a list of pkgs and/or wildcards
+# use PKG_ALL_DEPS and strip target prefixes to get
+# global package level deps
WALK_UPSTREAM = \
$(strip \
$(foreach PKG,$(filter $(1),$(PKGS)),\
- $(foreach DEP,$($(PKG)_DEPS) $(foreach TARGET,$(MXE_TARGETS),\
- $(value $(call LOOKUP_PKG_RULE,$(PKG),DEPS,$(TARGET)))),\
- $(if $(filter-out $(PKGS_VISITED),$(DEP)),\
- $(call SET_APPEND,PKGS_VISITED,$(DEP))\
- $(call WALK_UPSTREAM,$(DEP))\
- $(DEP)))))
+ $(foreach TARGET,$($(PKG)_TARGETS), \
+ $(foreach DEP,$(sort $(subst $(BUILD)~,,$(subst $(TARGET)~,,$(PKG_ALL_DEPS)))),\
+ $(if $(filter-out $(PKGS_VISITED),$(DEP)),\
+ $(call SET_APPEND,PKGS_VISITED,$(DEP))\
+ $(call WALK_UPSTREAM,$(DEP))\
+ $(DEP))))))
# not really walking downstream - that seems to be quadratic, so take
# a linear approach and filter the fully expanded upstream for each pkg
@@ -848,8 +846,24 @@ RECURSIVELY_EXCLUDED_PKGS = \
$(call SET_CLEAR,PKGS_VISITED)\
$(call WALK_DOWNSTREAM,$(EXCLUDE_PKGS)))
+# INCLUDE_PKGS can be a list of pkgs and/or wildcards
+# only used by build-pkg
+INCLUDE_PKGS := $(MXE_BUILD_PKG_PKGS)
+RECURSIVELY_INCLUDED_PKGS = \
+ $(sort \
+ $(filter $(INCLUDE_PKGS),$(PKGS))\
+ $(call SET_CLEAR,PKGS_VISITED)\
+ $(call WALK_UPSTREAM,$(INCLUDE_PKGS)))
+
+REQUIRED_PKGS = \
+ $(filter-out $(and $(EXCLUDE_PKGS),$(RECURSIVELY_EXCLUDED_PKGS)),\
+ $(or $(and $(INCLUDE_PKGS),$(strip $(RECURSIVELY_INCLUDED_PKGS))),$(PKGS)))
+
.PHONY: all-filtered
-all-filtered: $(filter-out $(call RECURSIVELY_EXCLUDED_PKGS),$(FILTERED_PKGS))
+all-filtered: $(REQUIRED_PKGS)
+
+.PHONY: download
+download: $(addprefix download-,$(REQUIRED_PKGS))
# print a list of upstream dependencies and downstream dependents
show-deps-%:
@@ -891,7 +905,7 @@ show-upstream-deps-%:
.PHONY: print-deps-for-build-pkg
print-deps-for-build-pkg:
$(foreach TARGET,$(sort $(MXE_TARGETS)), \
- $(foreach PKG,$(sort $($(TARGET)_PKGS)), \
+ $(foreach PKG,$(filter $(REQUIRED_PKGS),$(sort $($(TARGET)_PKGS))), \
$(if $(or $(value $(call LOOKUP_PKG_RULE,$(PKG),BUILD,$(TARGET))), \
$(filter $($(PKG)_TYPE),$(BUILD_PKG_TYPES))), \
$(info $(strip for-build-pkg $(TARGET)~$(PKG) \