[PATCH] Makefile: add clean-obsolete-scripts target

From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Date: 2007-01-10 23:20:19
On Cygwin, newly builtins are not recognized, because there exist both
the executable binaries (with .exe extension) _and_ the now-obsolete
scripts (without extension), but the script is executed.

"make clean-obsolete-scripts" removes these ambiguities by removing the
older of these file pairs.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
 Makefile |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index 007ceb2..a46683a 100644
--- a/Makefile
+++ b/Makefile
@@ -905,6 +905,25 @@ dist-doc:
 
 ### Cleaning rules
 
+clean-obsolete-scripts:
+	@if test -n "$X"; \
+	then \
+		ls *$X '$(DESTDIR_SQ)$(gitexecdir_SQ)'/*$X | while read f; do \
+			script="`echo "$$f" | sed 's/$X\$$/./'`"; \
+			if test -f "$$script"; \
+			then \
+				if test "$$script" -ot "$$f"; \
+				then \
+					echo removing "$$script"; \
+					rm "$$script"; \
+				else \
+					echo removing "$$f"; \
+					rm "$$f"; \
+				fi; \
+			fi; \
+		done; \
+	fi
+
 clean:
 	rm -f *.o mozilla-sha1/*.o arm/*.o ppc/*.o compat/*.o xdiff/*.o \
 		$(LIB_FILE) $(XDIFF_LIB)
-- 
1.4.4.4.g774d-dirty

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Wed Jan 10 23:20:59 2007

This archive was generated by hypermail 2.1.8 : 2007-01-10 23:22:22 EST