summaryrefslogtreecommitdiff
path: root/mk/target.mk
diff options
context:
space:
mode:
authorsof <unknown>1998-04-16 12:05:48 +0000
committersof <unknown>1998-04-16 12:05:48 +0000
commite55388ee0ac898aa781342e74dab5b412a6b08b4 (patch)
treec297528358cf3bc92237c2d8b6271e0408a2594c /mk/target.mk
parent2e4e780f95a1de66661e702b2f06d5c5b5d74634 (diff)
downloadhaskell-e55388ee0ac898aa781342e74dab5b412a6b08b4.tar.gz
[project @ 1998-04-16 12:05:48 by sof]
Handle the case where already exists (as a file)
Diffstat (limited to 'mk/target.mk')
-rw-r--r--mk/target.mk12
1 files changed, 11 insertions, 1 deletions
diff --git a/mk/target.mk b/mk/target.mk
index a89f1b06cc..44093a5a8b 100644
--- a/mk/target.mk
+++ b/mk/target.mk
@@ -413,8 +413,18 @@ endif
ifneq "$(SCRIPT_LINK)" ""
all :: $(SCRIPT_LINK)
+# The use of -L is non-standard, but I've yet to find
+# an implementation of `test' that doesn't like it.
$(SCRIPT_LINK) : $(SCRIPT_PROG)
- $(LN_S) $(SCRIPT_PROG) $(SCRIPT_LINK)
+ @if ( test ! -f $(SCRIPT_LINK) -o -L $(SCRIPT_LINK) ); then \
+ echo "Creating a symbol link from $(SCRIPT_PROG) to $(SCRIPT_LINK)"; \
+ $(RM) $(SCRIPT_LINK); \
+ $(LN_S) $(SCRIPT_PROG) $(SCRIPT_LINK); \
+ else \
+ echo "Creating a symbol link from $(SCRIPT_PROG) to $(SCRIPT_LINK) failed: \`$(SCRIPT_LINK)' already exists"; \
+ echo "Perhaps remove \`$(SCRIPT_LINK)' manually?"; \
+ exit 1; \
+ fi;
endif