Rename them like this: * {CURDIR} => {RELDIR} * {CANON_CURDIR} => {CANON_RELDIR}
The name "CURDIR" was a little ambiguous and potentially confusing, because it could get mixed up with the concept of "current directory" for the executing recipes (which will generally not be the same as the '{CURDIR}' expansion, of course), as well as with the GNU make predefined variable '$(CURDIR)'. In addition, the '{RELDIR}' name seems more faithful to the intended semantics of the substitution. * 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. * t/preproc-errmsg.sh: Likewise. * NEWS: Likewise. Signed-off-by: Stefano Lattarini <stefano.lattar...@gmail.com> --- NEWS | 8 ++++---- automake.in | 10 +++++----- doc/automake.texi | 18 +++++++++--------- t/preproc-basics.sh | 28 ++++++++++++++-------------- t/preproc-c-compile.sh | 8 ++++---- t/preproc-demo.sh | 10 +++++----- t/preproc-errmsg.sh | 6 +++--- 7 files changed, 44 insertions(+), 44 deletions(-) diff --git a/NEWS b/NEWS index 928aea5..938fac8 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 {RELDIR} and + {CANON_RELDIR} (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 += {RELDIR}/foo + {CANON_RELDIR}_foo_SOURCES = {RELDIR}/bar.c ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/automake.in b/automake.in index 32a7407..5bfc0d1 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" + # "{RELDIR}/foo" and "{CANON_RELDIR}_foo" into plain "foo" # when $curdir is '.'. - $_ =~ s,\{(D|CURDIR)\}/,,g; - $_ =~ s,\{(C|CANON_CURDIR)\}_,,g; + $_ =~ s,\{(D|RELDIR)\}/,,g; + $_ =~ s,\{(C|CANON_RELDIR)\}_,,g; } - $_ =~ s/\{(D|CURDIR)\}/${curdir}/g; - $_ =~ s/\{(C|CANON_CURDIR)\}/${cur_dir}/g; + $_ =~ s/\{(D|RELDIR)\}/${curdir}/g; + $_ =~ s/\{(C|CANON_RELDIR)\}/${cur_dir}/g; if (/$IGNORE_PATTERN/o) { diff --git a/doc/automake.texi b/doc/automake.texi index 38b9795..3304cfc 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{@{CURDIR@}} is replaced with the +Inside a fragment, the construct @code{@{RELDIR@}} is replaced with the directory of the fragment relative to the base @file{Makefile.am}. -Similarly, @code{@{CANON_CURDIR@}} is replaced with the canonicalized -(@pxref{Canonicalization}) form of @code{@{CURDIR@}}. As a convenience, -@code{@{D@}} is a synonym for @code{@{CURDIR@}}, and @code{@{C@}} -is a synonym for @code{@{CANON_CURDIR@}}. +Similarly, @code{@{CANON_RELDIR@}} is replaced with the canonicalized +(@pxref{Canonicalization}) form of @code{@{RELDIR@}}. As a convenience, +@code{@{D@}} is a synonym for @code{@{RELDIR@}}, and @code{@{C@}} +is a synonym for @code{@{CANON_RELDIR@}}. A special feature is that if the fragment is in the same directory as -the base @file{Makefile.am} (i.e., @code{@{CURDIR@}} is @code{.}), then -@code{@{CURDIR@}} and @code{@{CANON_CURDIR@}} will expand to the empty +the base @file{Makefile.am} (i.e., @code{@{RELDIR@}} is @code{.}), then +@code{@{RELDIR@}} and @code{@{CANON_RELDIR@}} 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 += @{CURDIR@}/mumble -@{CANON_CURDIR@}_mumble_SOURCES = @{CURDIR@}/one.c +bin_PROGRAMS += @{RELDIR@}/mumble +@{CANON_RELDIR@}_mumble_SOURCES = @{RELDIR@}/one.c @end example @node Conditionals diff --git a/t/preproc-basics.sh b/t/preproc-basics.sh index e7ef1af..dc30a10 100755 --- a/t/preproc-basics.sh +++ b/t/preproc-basics.sh @@ -15,8 +15,8 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # Basic tests for '{...}' preprocessing in included Makefile fragments: -# {CURDIR} a.k.a. {D} -# {CANON_CURDIR} a.k.a. {C} +# {RELDIR} a.k.a. {D} +# {CANON_RELDIR} a.k.a. {C} . test-init.sh @@ -36,23 +36,23 @@ END cat > zot/Makefile.am << 'END' include $(top_srcdir)/zot/local.mk -## Check that '{CANON_CURDIR}' doesn't remain overridden +## Check that '{CANON_RELDIR}' doesn't remain overridden ## by the previous include. -{CANON_CURDIR}_zot_whoami: - echo "I am {CURDIR}/Makefile.am" >$@ +{CANON_RELDIR}_zot_whoami: + echo "I am {RELDIR}/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_RELDIR}_whoami: + echo "I am {RELDIR}/local.mk" >$@ END cat > top.mk << 'END' -{CANON_CURDIR}_top_whoami: - echo "I am {CURDIR}/top.mk" >$@ +{CANON_RELDIR}_top_whoami: + echo "I am {RELDIR}/top.mk" >$@ END cat > reltop.mk << 'END' @@ -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 {RELDIR}/bar/local.mk +## Check that '{CANON_RELDIR}' 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-{RELDIR}: + test '{RELDIR}' = foo && test '{RELDIR}' = foo test '{D}' = foo && test '{D}' = foo - test '{CANON_CURDIR}' = foo && test '{C}' = foo + test '{CANON_RELDIR}' = foo && test '{C}' = foo END $ACLOCAL diff --git a/t/preproc-c-compile.sh b/t/preproc-c-compile.sh index 44cb00f..378e3cd 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 '{RELDIR}' and '{CANON_RELDIR}' # 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 += {RELDIR}/mumble +{CANON_RELDIR}_mumble_SOURCES = {RELDIR}/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 {RELDIR}/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 8255c8a..1acac8d 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 '{RELDIR}' and +# '{CANON_RELDIR}', 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 += {RELDIR}/hello bin_PROGRAMS += {D}/goodbye -{CANON_CURDIR}_goodbye_SOURCES = {D}/hello.c +{CANON_RELDIR}_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)/{RELDIR}':$$PATH; \ export PATH; END diff --git a/t/preproc-errmsg.sh b/t/preproc-errmsg.sh index 8edf5c6..e967073 100755 --- a/t/preproc-errmsg.sh +++ b/t/preproc-errmsg.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/>. -# Tests error messages when '{CURDIR}' and '{CANON_CURDIR}' substitutions +# Tests error messages when '{RELDIR}' and '{CANON_RELDIR}' substitutions # (and their shorthands '{D}' and '{C}') are involved. . test-init.sh @@ -30,14 +30,14 @@ END mkdir sub sub/sub2 cat > Makefile.am <<'END' -{CANON_CURDIR}_x1_SOURCES = bar.c +{CANON_RELDIR}_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 +noinst_LIBRARIES = {RELDIR}-one.a {D}-two.a {C}_x2_SOURCES = foo.c END -- 1.8.1.1.473.g9a6c84e