summaryrefslogtreecommitdiffstats
path: root/make/grep.mk
diff options
context:
space:
mode:
Diffstat (limited to 'make/grep.mk')
-rw-r--r--make/grep.mk15
1 files changed, 10 insertions, 5 deletions
diff --git a/make/grep.mk b/make/grep.mk
index 88dbbbe4a..eadf0df4b 100644
--- a/make/grep.mk
+++ b/make/grep.mk
@@ -45,12 +45,17 @@ $(GNUGREP_DIR)/.configured: $(GNUGREP_DIR)/.unpacked
$(GNUGREP_DIR)/$(GNUGREP_BINARY): $(GNUGREP_DIR)/.configured
$(MAKE) -C $(GNUGREP_DIR)
-$(TARGET_DIR)/$(GNUGREP_TARGET_BINARY): $(GNUGREP_DIR)/$(GNUGREP_BINARY)
- rm -f $(TARGET_DIR)/bin/grep $(TARGET_DIR)/bin/egrep $(TARGET_DIR)/bin/fgrep
- cp -a $(GNUGREP_DIR)/src/grep $(GNUGREP_DIR)/src/egrep $(GNUGREP_DIR)/src/fgrep $(TARGET_DIR)/bin/
+# This stuff is needed to work around GNU make deficiencies
+grep-target_binary: $(GNUGREP_DIR)/$(GNUGREP_BINARY)
+ @if [ -L $(TARGET_DIR)/$(GNUGREP_TARGET_BINARY) ] ; then \
+ rm -f $(TARGET_DIR)/$(GNUGREP_TARGET_BINARY); fi;
+ @if [ $(TARGET_DIR)/$(GNUGREP_TARGET_BINARY) -ot $(GNUGREP_DIR)/$(GNUGREP_BINARY) ] ; then \
+ set -x; \
+ rm -f $(TARGET_DIR)/bin/grep $(TARGET_DIR)/bin/egrep $(TARGET_DIR)/bin/fgrep; \
+ cp -a $(GNUGREP_DIR)/src/grep $(GNUGREP_DIR)/src/egrep \
+ $(GNUGREP_DIR)/src/fgrep $(TARGET_DIR)/bin/; fi
-
-grep: uclibc $(TARGET_DIR)/$(GNUGREP_TARGET_BINARY)
+grep: uclibc grep-target_binary
grep-clean:
$(MAKE) DESTDIR=$(TARGET_DIR) -C $(GNUGREP_DIR) uninstall