This repository has been archived on 2024-05-11. You can view files and clone it, but cannot push or open issues or pull requests.
gluon-firmware/patches/openwrt/0001-tools-Makefile-fix-hos...

55 lines
2.0 KiB
Diff

From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sat, 26 Jul 2014 06:10:23 +0200
Subject: tools/Makefile: fix host tools build dependencies
diff --git a/tools/Makefile b/tools/Makefile
index 75d2b0d..ff1d299 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -95,10 +95,16 @@ define PrepareStaging
endef
# preparatory work
+ifneq ($(ARCH),)
+staging_prepared = $(STAGING_DIR)/.prepared
+
$(STAGING_DIR)/.prepared: $(TMP_DIR)/.build
$(call PrepareStaging,$(STAGING_DIR))
mkdir -p $(BUILD_DIR)/stamp
touch $@
+else
+staging_prepared :=
+endif
$(STAGING_DIR_HOST)/.prepared: $(TMP_DIR)/.build
$(call PrepareStaging,$(STAGING_DIR_HOST))
@@ -110,7 +116,7 @@ $(STAGING_DIR_HOST)/.prepared: $(TMP_DIR)/.build
define PrepareCommand
-$(STAGING_DIR_HOST)/bin/$(1): $(STAGING_DIR)/.prepared
+$(STAGING_DIR_HOST)/bin/$(1): $(STAGING_DIR_HOST)/.prepared
@mkdir -p "$$(dir $$@)"; rm -f "$$@"
@export FILE="$$$$(which $(2) 2>/dev/null | grep -v 'not found' | head -n1)"; [ -n "$$$$FILE" ] || { \
echo "Command $(1) not found."; false; \
@@ -119,7 +125,7 @@ $(STAGING_DIR_HOST)/bin/$(1): $(STAGING_DIR)/.prepared
endef
endif
-$(STAGING_DIR_HOST)/bin/stat: $(STAGING_DIR)/.prepared
+$(STAGING_DIR_HOST)/bin/stat: $(STAGING_DIR_HOST)/.prepared
@rm -f $@
@if stat --version > /dev/null 2>&1; then \
ln -s `which stat` $@; \
@@ -143,8 +149,8 @@ $(eval $(call PrepareCommand,tar,gtar tar))
$(eval $(call PrepareCommand,diff,gdiff diff))
$(curdir)/cmddeps = $(patsubst %,$(STAGING_DIR_HOST)/bin/%,md5sum cp stat seq python awk getopt grep tar diff)
-$(curdir)//prepare = $(STAGING_DIR)/.prepared $(STAGING_DIR_HOST)/.prepared $($(curdir)/cmddeps)
-$(curdir)//compile = $(STAGING_DIR)/.prepared $(STAGING_DIR_HOST)/.prepared $($(curdir)/cmddeps)
+$(curdir)//prepare = $(staging_prepared) $(STAGING_DIR_HOST)/.prepared $($(curdir)/cmddeps)
+$(curdir)//compile = $(staging_prepared) $(STAGING_DIR_HOST)/.prepared $($(curdir)/cmddeps)
# prerequisites for the individual targets
$(curdir)/ := .config prereq