The few remaining cases where I would have liked to use "$<", instead
of writing it out long-hand relative to the build tree more than
once, I've stored it in a shell variable and referenced that.

There are another couple of instances that don't show in this patch
where there was only a single "$<" required, in which case I just
typed the path out longhand as you suggested.

Okay to push?

* Makefile.am (libltdl/m4/ltversion.m4, libltdl/config/ltmain.sh):
Use sed to calculate input file names from "$@".

Signed-off-by: Gary V. Vaughan <g...@gnu.org>
---
 ChangeLog   |    4 ++++
 Makefile.am |   21 +++++++++++----------
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 85ac802..d923588 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2010-08-31  Gary V. Vaughan  <g...@gnu.org>
 
+       build: don't hardcode repeated long paths in Makefile rules.
+       * Makefile.am (libltdl/m4/ltversion.m4, libltdl/config/ltmain.sh):
+       Use sed to calculate input file names from "$@".
+
        build: make better use of automatic variables in `Makefile.am'.
        * Makefile.am (libtoolize, libtoolize.in, libltdl/Makefile.am)
        (libltdl/config/mkstamp, libltdl/config/ltmain.m4sh)
diff --git a/Makefile.am b/Makefile.am
index 32b192c..90cd671 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -118,9 +118,10 @@ $(srcdir)/$(m4dir)/ltversion.m4: $(m4dir)/ltversion.in 
configure.ac ChangeLog
        done; \
        if $$rebuild; then \
          rm -f "$...@t"; \
+         in=`echo "$@" | sed 's:\.m4$$:.in:'`; \
          serial=`echo "$$revision" | sed 's,^1[.],,g'`; \
-         echo "$(bootstrap_edit) $(srcdir)/$(m4dir)/ltversion.in > $@"; \
-         $(bootstrap_edit) "$(srcdir)/$(m4dir)/ltversion.in" > "$...@t"; \
+         echo "$(bootstrap_edit) $$in > $@"; \
+         $(bootstrap_edit) "$$in" > "$...@t"; \
          chmod a-w "$...@t"; \
          mv -f "$...@t" "$@"; \
        fi
@@ -146,14 +147,14 @@ $(srcdir)/$(auxdir)/ltmain.sh: $(sh_files) 
$(auxdir)/ltmain.m4sh configure.ac Ch
          case $$prereq in *ChangeLog);; *) rebuild=:;; esac; \
        done; \
        if $$rebuild; then \
-         rm -f "$(srcdir)/$(auxdir)/ltmain.in" "$...@t" "$@"; \
-         echo $(LT_M4SH) $(srcdir)/$(auxdir)/ltmain.m4sh \
-           \> $(srcdir)/$(auxdir)/ltmain.in; \
-         $(LT_M4SH) "$(srcdir)/$(auxdir)/ltmain.m4sh" \
-           > "$(srcdir)/$(auxdir)/ltmain.in"; \
-         echo "$(bootstrap_edit) $(srcdir)/$(auxdir)/ltmain.in > $@"; \
-         $(bootstrap_edit) "$(srcdir)/$(auxdir)/ltmain.in" > "$...@t"; \
-         rm -f $(srcdir)/$(auxdir)/ltmain.in; \
+         in=`echo "$@" | sed 's:\.sh$$:.m4sh:'`; \
+         intermediate=`echo "$@" | sed 's:\.sh$$:.in'`; \
+         rm -f "$$intermediate" "$...@t" "$@"; \
+         echo "$(LT_M4SH) $$in > $$intermediate"; \
+         $(LT_M4SH) "$$in" > "$$intermediate"; \
+         echo "$(bootstrap_edit) $$intermediate > $@"; \
+         $(bootstrap_edit) "$$intermediate" > "$...@t"; \
+         rm -f "$$intermediate"; \
          chmod a-w "$...@t"; \
          mv -f "$...@t" "$@"; \
        fi
-- 
1.7.3


Reply via email to