From: sof Date: Fri, 17 Apr 1998 10:02:57 +0000 (+0000) Subject: [project @ 1998-04-17 10:02:57 by sof] X-Git-Tag: Approx_2487_patches~784 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=ec3650db0d232553e14d8f59388177ca7f6efe9e;p=ghc-hetmet.git [project @ 1998-04-17 10:02:57 by sof] $(SCRIPT_LINK): use perl to test for symlinks rather than relying /bin/sh 'test' --- diff --git a/mk/target.mk b/mk/target.mk index f0cccef..3c46011 100644 --- a/mk/target.mk +++ b/mk/target.mk @@ -413,10 +413,14 @@ 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. +# +# Don't want to overwrite $(SCRIPT_LINK)s that aren't symbolic +# links. Testing for symbol links is problematic to do in +# a portable fashion using a /bin/sh test, so we simply rely +# on perl. +# $(SCRIPT_LINK) : $(SCRIPT_PROG) - @if ( test ! -f $(SCRIPT_LINK) -o -L $(SCRIPT_LINK) ); then \ + @if ( perl -e '$$fn="$(SCRIPT_LINK)"; exit ((! -f $$fn || -l $$fn) ? 0 : 1);' ); then \ echo "Creating a symbol link from $(SCRIPT_PROG) to $(SCRIPT_LINK)"; \ $(RM) $(SCRIPT_LINK); \ $(LN_S) $(SCRIPT_PROG) $(SCRIPT_LINK); \ @@ -477,8 +481,9 @@ install-dirs :: ifneq "$(INSTALL_PROGS)" "" install:: $(INSTALL_PROGS) @$(INSTALL_DIR) $(bindir) - for i in $(INSTALL_PROGS); do \ - $(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i$(exeext) $(bindir); \ + @for i in $(INSTALL_PROGS); do \ + echo $(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i$(exeext) $(bindir); \ + $(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i$(exeext) $(bindir); \ done endif @@ -607,30 +612,30 @@ endif # Use with care.. # uninstall:: -ifeq ($(INSTALL_PROGS),) - @for i in $(INSTALL_PROGS) ; do \ + @for i in $(INSTALL_PROGS) "" ; do \ + if test "$$i"; then \ echo rm -f $(bindir)/`basename $$i`; \ rm -f $(bindir)/`basename $$i`; \ + fi; \ done -endif -ifeq ($(INSTALL_LIBS),) - @for i in $(INSTALL_LIBS); do \ + @for i in $(INSTALL_LIBS) ""; do \ + if test "$$i"; then \ echo rm -f $(libdir)/`basename $$i`; \ rm -f $(libdir)/`basename $$i`; \ + fi; \ done -endif -ifeq ($(INSTALL_LIBEXECS),) - @for i in $(INSTALL_LIBEXECS); do \ + @for i in $(INSTALL_LIBEXECS) ""; do \ + if test "$$i"; then \ echo rm -f $(libexecdir)/`basename $$i`; \ rm -f $(libexecdir)/`basename $$i`; \ + fi; \ done -endif -ifeq ($(INSTALL_DATAS),) - @for i in $(INSTALL_DATAS); do \ + @for i in $(INSTALL_DATAS) ""; do \ + if test "$$i"; then \ echo rm -f $(datadir)/`basename $$i`; \ rm -f $(datadir)/`basename $$i`; \ + fi; \ done -endif # # install-strip is from the GNU Makefile standard.