automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/6] preproc: prefer '{D}' over '&{D}&' (and similarly for other


From: Stefano Lattarini
Subject: [PATCH 3/6] preproc: prefer '{D}' over '&{D}&' (and similarly for other substs)
Date: Sun, 3 Feb 2013 21:44:41 +0100

The new form is shorter, easier and more natural to type, and less
likely to get wrong due to typos or distractions.  Such issues with
the '&{FOO}&' form (originally suggested by myself, oops) have been
made clear and evident by the recent work on the tests checking the
new preprocessing features (see previous commit 07f3534f).

* automake.in (read_am_file): Adjust.
* doc/automake.texi (Include): Likewise.
* t/preproc-c-compile.sh: Likewise.
* t/preproc-demo.sh: Likewise.
* t/preproc-basics.sh: Likewise, and improve heading comment.
* t/preproc-errmsg.sh: Likewise.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 NEWS                   |  8 ++++----
 automake.in            | 10 +++++-----
 doc/automake.texi      | 18 +++++++++---------
 t/preproc-basics.sh    | 36 ++++++++++++++++++------------------
 t/preproc-c-compile.sh |  8 ++++----
 t/preproc-demo.sh      | 44 ++++++++++++++++++++++----------------------
 t/preproc-errmsg.sh    | 14 +++++++-------
 7 files changed, 69 insertions(+), 69 deletions(-)

diff --git a/NEWS b/NEWS
index 4511fbb..928aea5 100644
--- a/NEWS
+++ b/NEWS
@@ -102,13 +102,13 @@ New in 1.13.2:
 
 * Current directory in makefile fragments:
 
-  - Use the special makefile fragment substitutions &{CURDIR}& and
-    &{CANON_CURDIR}& (a.k.a. &{D}& and &{C}& respectively) to insert the
+  - Use the special makefile fragment substitutions {CURDIR} and
+    {CANON_CURDIR} (a.k.a. {D} and {C} respectively) to insert the
     relative directory of the fragment (or its canonicalized version) in
     the makefile:
 
-        bin_PROGRAMS += &{CURDIR}&/foo
-        &{CANON_CURDIR}&_foo_SOURCES = &{CURDIR}&/bar.c
+        bin_PROGRAMS += {CURDIR}/foo
+        {CANON_CURDIR}_foo_SOURCES = {CURDIR}/bar.c
 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
diff --git a/automake.in b/automake.in
index e8e4c3a..32a7407 100644
--- a/automake.in
+++ b/automake.in
@@ -6427,13 +6427,13 @@ sub read_am_file ($$)
        if ($curdir eq '.')
          {
            # If present, eat the following '_' or '/', converting
-           # "&{CURDIR}&/foo" and "&{CANON_CURDIR}&_foo" into plain "foo"
+           # "{CURDIR}/foo" and "{CANON_CURDIR}_foo" into plain "foo"
            # when $curdir is '.'.
-           $_ =~ s,&\{(D|CURDIR)\}&/,,g;
-           $_ =~ s,&\{(C|CANON_CURDIR)\}&_,,g;
+           $_ =~ s,\{(D|CURDIR)\}/,,g;
+           $_ =~ s,\{(C|CANON_CURDIR)\}_,,g;
          }
-       $_ =~ s/&\{(D|CURDIR)\}&/${curdir}/g;
-       $_ =~ s/&\{(C|CANON_CURDIR)\}&/${cur_dir}/g;
+       $_ =~ s/\{(D|CURDIR)\}/${curdir}/g;
+       $_ =~ s/\{(C|CANON_CURDIR)\}/${cur_dir}/g;
 
        if (/$IGNORE_PATTERN/o)
        {
diff --git a/doc/automake.texi b/doc/automake.texi
index 725f30a..38b9795 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -10519,24 +10519,24 @@ condition applies to the entire contents of that 
fragment.
 Makefile fragments included this way are always distributed because
 they are needed to rebuild @file{Makefile.in}.
 
-Inside a fragment, the construct @code{&@address@hidden&} is replaced with the
+Inside a fragment, the construct @address@hidden@}} is replaced with the
 directory of the fragment relative to the base @file{Makefile.am}.
-Similarly, @code{&@address@hidden&} is replaced with the canonicalized
-(@pxref{Canonicalization}) form of @code{&@address@hidden&}.  As a convenience,
address@hidden&@address@hidden&} is a synonym for @code{&@address@hidden&}, and 
@code{&@address@hidden&}
-is a synonym for @code{&@address@hidden&}.
+Similarly, @address@hidden@}} is replaced with the canonicalized
+(@pxref{Canonicalization}) form of @address@hidden@}}.  As a convenience,
address@hidden@address@hidden is a synonym for @address@hidden@}}, and 
@address@hidden@}}
+is a synonym for @address@hidden@}}.
 
 A special feature is that if the fragment is in the same directory as
-the base @file{Makefile.am} (i.e., @code{&@address@hidden&} is @code{.}), then
address@hidden&@address@hidden&} and @code{&@address@hidden&} will expand to 
the empty
+the base @file{Makefile.am} (i.e., @address@hidden@}} is @code{.}), then
address@hidden@address@hidden and @address@hidden@}} will expand to the empty
 string as well as eat, if present, a following slash or underscore
 respectively.
 
 Thus, a makefile fragment might look like this:
 
 @example
-bin_PROGRAMS += &@address@hidden&/mumble
-&@address@hidden&_mumble_SOURCES = &@address@hidden&/one.c
+bin_PROGRAMS += @address@hidden/mumble
address@hidden@}_mumble_SOURCES = @address@hidden/one.c
 @end example
 
 @node Conditionals
diff --git a/t/preproc-basics.sh b/t/preproc-basics.sh
index 209433d..e7ef1af 100755
--- a/t/preproc-basics.sh
+++ b/t/preproc-basics.sh
@@ -14,9 +14,9 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Basic tests for '&{...}&' preprocessing:
-#   &{CURDIR}&        a.k.a.  &{D}&
-#   &{CANON_CURDIR}&  a.k.a.  &{C}&
+# Basic tests for '{...}' preprocessing in included Makefile fragments:
+#   {CURDIR}        a.k.a.  {D}
+#   {CANON_CURDIR}  a.k.a.  {C}
 
 . test-init.sh
 
@@ -36,28 +36,28 @@ END
 cat > zot/Makefile.am << 'END'
 include $(top_srcdir)/zot/local.mk
 
-## Check that '&{CANON_CURDIR}' doesn't remain overridden
+## Check that '{CANON_CURDIR}' doesn't remain overridden
 ## by the previous include.
-&{CANON_CURDIR}&_zot_whoami:
-       echo "I am &{CURDIR}&/Makefile.am" >$@
+{CANON_CURDIR}_zot_whoami:
+       echo "I am {CURDIR}/Makefile.am" >$@
 
 include $(top_srcdir)/top.mk
 include ../reltop.mk
 END
 
 cat > local.mk << 'END'
-&{CANON_CURDIR}&_whoami:
-       echo "I am &{CURDIR}&/local.mk" >$@
+{CANON_CURDIR}_whoami:
+       echo "I am {CURDIR}/local.mk" >$@
 END
 
 cat > top.mk << 'END'
-&{CANON_CURDIR}&_top_whoami:
-       echo "I am &{CURDIR}&/top.mk" >$@
+{CANON_CURDIR}_top_whoami:
+       echo "I am {CURDIR}/top.mk" >$@
 END
 
 cat > reltop.mk << 'END'
-&{C}&_reltop_whoami:
-       echo "I am &{D}&/reltop.mk" >$@
+{C}_reltop_whoami:
+       echo "I am {D}/reltop.mk" >$@
 END
 
 cp local.mk foo
@@ -66,15 +66,15 @@ cp local.mk foo/foobar
 cp local.mk zot
 
 cat >> foo/local.mk << 'END'
-include &{CURDIR}&/bar/local.mk
-## Check that '&{CANON_CURDIR}' doesn't remain overridden by the
+include {CURDIR}/bar/local.mk
+## Check that '{CANON_CURDIR}' doesn't remain overridden by the
 ## previous include.  The duplicated checks are done to ensure that
 ## Automake substitutes all pre-processing occurrences on a line,
 ## not just the first one.
-test-&{CURDIR}&:
-       test '&{CURDIR}&'       = foo  &&  test '&{CURDIR}&' = foo
-       test '&{D}&'            = foo  &&  test '&{D}&'      = foo
-       test '&{CANON_CURDIR}&' = foo  &&  test '&{C}&'      = foo
+test-{CURDIR}:
+       test '{CURDIR}'       = foo  &&  test '{CURDIR}' = foo
+       test '{D}'            = foo  &&  test '{D}'      = foo
+       test '{CANON_CURDIR}' = foo  &&  test '{C}'      = foo
 END
 
 $ACLOCAL
diff --git a/t/preproc-c-compile.sh b/t/preproc-c-compile.sh
index bb5110d..44cb00f 100755
--- a/t/preproc-c-compile.sh
+++ b/t/preproc-c-compile.sh
@@ -14,7 +14,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test pre-processing substitutions '&{CURDIR}&' and '&{CANON_CURDIR}&'
+# Test pre-processing substitutions '{CURDIR}' and '{CANON_CURDIR}'
 # with C compilation and subdir objects.
 
 require=cc
@@ -74,8 +74,8 @@ check-local: test
 END
 
 cat > local.mk << 'END'
-bin_PROGRAMS += &{CURDIR}&/mumble
-&{CANON_CURDIR}&_mumble_SOURCES = &{CURDIR}&/one.c
+bin_PROGRAMS += {CURDIR}/mumble
+{CANON_CURDIR}_mumble_SOURCES = {CURDIR}/one.c
 END
 
 echo 'int main (void) { return 0; }' > one.c
@@ -84,7 +84,7 @@ sed 's/mumble/mumble2/' local.mk > foo/local.mk
 cp local.mk foo/bar
 cp local.mk foo/foobar
 cp local.mk zot
-echo "include &{CURDIR}&/bar/local.mk" >> foo/local.mk
+echo "include {CURDIR}/bar/local.mk" >> foo/local.mk
 
 cp one.c foo
 cp one.c foo/bar
diff --git a/t/preproc-demo.sh b/t/preproc-demo.sh
index b4b16bd..8255c8a 100755
--- a/t/preproc-demo.sh
+++ b/t/preproc-demo.sh
@@ -14,8 +14,8 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Demo of a package using pre-processing substitutions '&{CURDIR}&' and
-# '&{CANON_CURDIR}&', and their respective shorthands '&{D}&' and '&{C}&'.
+# Demo of a package using pre-processing substitutions '{CURDIR}' and
+# '{CANON_CURDIR}', and their respective shorthands '{D}' and '{C}'.
 
 am_create_testdir=empty
 required=cc
@@ -65,15 +65,15 @@ END
 ## Src subdir.
 
 cat > src/progs.am <<'END'
-bin_PROGRAMS += &{CURDIR}&/hello
+bin_PROGRAMS += {CURDIR}/hello
 
-bin_PROGRAMS += &{D}&/goodbye
-&{CANON_CURDIR}&_goodbye_SOURCES = &{D}&/hello.c
-&{C}&_goodbye_CPPFLAGS = $(AM_CPPFLAGS) -DGREETINGS='"Goodbye"'
+bin_PROGRAMS += {D}/goodbye
+{CANON_CURDIR}_goodbye_SOURCES = {D}/hello.c
+{C}_goodbye_CPPFLAGS = $(AM_CPPFLAGS) -DGREETINGS='"Goodbye"'
 
 # The testsuite should have access to our built programs.
 AM_TESTS_ENVIRONMENT += \
-  PATH='$(abs_builddir)/&{CURDIR}&':$$PATH; \
+  PATH='$(abs_builddir)/{CURDIR}':$$PATH; \
   export PATH;
 END
 
@@ -97,17 +97,17 @@ END
 ## Lib subdir.
 
 cat > lib/gnulib.am << 'END'
-noinst_LIBRARIES += &{D}&/libgnu.a
+noinst_LIBRARIES += {D}/libgnu.a
 
-AM_CPPFLAGS += -I&{D}& -I$(top_srcdir)/&{D}&
+AM_CPPFLAGS += -I{D} -I$(top_srcdir)/{D}
 LDADD += $(noinst_LIBRARIES)
 
-&{C}&_libgnu_a_SOURCES = \
-  &{D}&/safe-print.c \
-  &{D}&/safe-print.h
+{C}_libgnu_a_SOURCES = \
+  {D}/safe-print.c \
+  {D}/safe-print.h
 
 if NATIVE_BUILD
-include &{D}&/tests/gnulib-check.am
+include {D}/tests/gnulib-check.am
 endif
 END
 
@@ -137,9 +137,9 @@ END
 ## Lib/Tests (sub)subdir.
 
 cat > lib/tests/gnulib-check.am <<'END'
-check_PROGRAMS += &{D}&/safe-print-test
+check_PROGRAMS += {D}/safe-print-test
 TESTS += $(check_PROGRAMS)
-XFAIL_TESTS += &{D}&/safe-print-test
+XFAIL_TESTS += {D}/safe-print-test
 END
 
 cat > lib/tests/safe-print-test.c <<'END'
@@ -161,17 +161,17 @@ cat > tests/check.am <<'END'
 TEST_EXTENSIONS = .sh
 SH_LOG_COMPILER = $(SHELL)
 
-TESTS += &{D}&/hello.sh
-EXTRA_DIST += &{D}&/hello.sh
+TESTS += {D}/hello.sh
+EXTRA_DIST += {D}/hello.sh
 
-TESTS += &{D}&/goodbye.sh
-CLEANFILES += &{D}&/goodbye.sh
-&{D}&/goodbye.sh: &{D}&/hello.sh
-       $(MKDIR_P) &{D}&
+TESTS += {D}/goodbye.sh
+CLEANFILES += {D}/goodbye.sh
+{D}/goodbye.sh: {D}/hello.sh
+       $(MKDIR_P) {D}
        rm -f $@ address@hidden
        sed -e 's/hello/goodbye/' \
            -e 's/Hello/Goodbye/' \
-          < $(srcdir)/&{D}&/hello.sh >address@hidden
+          < $(srcdir)/{D}/hello.sh >address@hidden
        chmod a-w,a+x address@hidden && mv -f address@hidden $@
 END
 
diff --git a/t/preproc-errmsg.sh b/t/preproc-errmsg.sh
index 9c57a5c..8edf5c6 100755
--- a/t/preproc-errmsg.sh
+++ b/t/preproc-errmsg.sh
@@ -14,8 +14,8 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Tests error messages when '&{CURDIR}&' and '&{CANON_CURDIR}&'
-# pre-processing is involved.
+# Tests error messages when '{CURDIR}' and '{CANON_CURDIR}' substitutions
+# (and their shorthands '{D}' and '{C}') are involved.
 
 . test-init.sh
 
@@ -30,19 +30,19 @@ END
 mkdir sub sub/sub2
 
 cat > Makefile.am <<'END'
-&{CANON_CURDIR}&_x1_SOURCES = bar.c
+{CANON_CURDIR}_x1_SOURCES = bar.c
 include sub/local.mk
 END
 
 cat > sub/local.mk <<'END'
 AUTOMAKE_OPTIONS = -Wno-extra-portability
-include &{D}&/sub2/more.mk
-noinst_LIBRARIES = &{CURDIR}&-one.a &{D}&-two.a
-&{C}&_x2_SOURCES = foo.c
+include {D}/sub2/more.mk
+noinst_LIBRARIES = {CURDIR}-one.a {D}-two.a
+{C}_x2_SOURCES = foo.c
 END
 
 cat > sub/sub2/more.mk <<'END'
-&{C}&_UNDEFINED +=
+{C}_UNDEFINED +=
 END
 
 $ACLOCAL
-- 
1.8.1.1.473.g9a6c84e




reply via email to

[Prev in Thread] Current Thread [Next in Thread]