summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorTony Theodore <tonyt@logyst.com>2015-10-13 12:40:32 (GMT)
committerTony Theodore <tonyt@logyst.com>2015-10-25 01:23:27 (GMT)
commitc8dd7556b42d67c6134dc222399c026fdecf83ab (patch)
treee3431071017b4465c38388dd4ada64fa6fe6c392 /Makefile
parentb5d2ade2bf4b1f039767987fe4462fc648dfebc6 (diff)
downloadmxe-c8dd7556b42d67c6134dc222399c026fdecf83ab.zip
mxe-c8dd7556b42d67c6134dc222399c026fdecf83ab.tar.gz
mxe-c8dd7556b42d67c6134dc222399c026fdecf83ab.tar.bz2
Makefile: enable target deps and native pkg build rules
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile20
1 files changed, 18 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 9c57064..f4e49ee 100644
--- a/Makefile
+++ b/Makefile
@@ -327,6 +327,21 @@ BUILD_PKGS := $(call set_create, \
$(SED) -n 's,.*src/\(.*\)\.mk,\1,p'), \
$(if $(value $(call LOOKUP_PKG_RULE,$(PKG),BUILD,$(BUILD))), $(PKG))))
+# create target sets for PKG_TARGET_RULE loop to avoid creating empty rules
+# and having to explicitly disable $(BUILD) for most packages
+CROSS_TARGETS := $(filter-out $(BUILD),$(MXE_TARGETS))
+$(foreach PKG,$(PKGS), \
+ $(foreach TARGET,$(or $(sort $($(PKG)_TARGETS)),$(CROSS_TARGETS)), \
+ $(eval $(TARGET)_PKGS += $(PKG)) \
+ $(eval FILTERED_PKGS += $(PKG))))
+
+# cross targets depend on native target
+$(foreach TARGET,$(CROSS_TARGETS),\
+ $(eval $(TARGET)_DEPS = $(BUILD)))
+
+# always add $(BUILD) to our targets
+override MXE_TARGETS := $(CROSS_TARGETS) $(BUILD)
+
# set column widths for build status messages
PKG_COL_WIDTH := $(call plus,2,$(call LIST_NMAX, $(sort $(call map, strlen, $(PKGS)))))
MAX_TARGET_WIDTH := $(call LIST_NMAX, $(sort $(call map, strlen, $(MXE_TARGETS))))
@@ -394,6 +409,7 @@ $(PREFIX)/$(3)/installed/$(1): $(TOP_DIR)/src/$(1).mk \
$(PATCHES) \
$(wildcard $(TOP_DIR)/src/$(1)-test*) \
$(addprefix $(PREFIX)/$(3)/installed/,$(value $(call LOOKUP_PKG_RULE,$(1),DEPS,$(3)))) \
+ $(and $($(3)_DEPS),$(addprefix $(PREFIX)/$($(3)_DEPS)/installed/,$($($(3)_DEPS)_PKGS))) \
| $(if $(DONT_CHECK_REQUIREMENTS),,check-requirements) \
$(if $(value $(call LOOKUP_PKG_RULE,$(1),URL,$(3))),download-only-$(1)) \
$(addprefix $(PREFIX)/$(3)/installed/,$(if $(call set_is_not_member,$(1),$(MXE_CONF_PKGS)),$(MXE_CONF_PKGS)))
@@ -456,7 +472,7 @@ build-only-$(1)_$(3):
endef
$(foreach TARGET,$(MXE_TARGETS), \
$(shell [ -d '$(PREFIX)/$(TARGET)/installed' ] || mkdir -p '$(PREFIX)/$(TARGET)/installed') \
- $(foreach PKG,$(PKGS), \
+ $(foreach PKG,$($(TARGET)_PKGS), \
$(eval $(call PKG_TARGET_RULE,$(PKG),$(call TMP_DIR,$(PKG)-$(TARGET)),$(TARGET)))))
# convenience set-like functions for unique lists
@@ -495,7 +511,7 @@ RECURSIVELY_EXCLUDED_PKGS = \
$(call WALK_DOWNSTREAM,$(EXCLUDE_PKGS)))
.PHONY: all-filtered
-all-filtered: $(filter-out $(call RECURSIVELY_EXCLUDED_PKGS),$(PKGS))
+all-filtered: $(filter-out $(call RECURSIVELY_EXCLUDED_PKGS),$(FILTERED_PKGS))
# print a list of upstream dependencies and downstream dependents
show-deps-%: