[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 11/16] build: define RELEASE_YEAR with AC_SUBST
From: |
Stefano Lattarini |
Subject: |
[PATCH 11/16] build: define RELEASE_YEAR with AC_SUBST |
Date: |
Sun, 5 May 2013 23:29:08 +0200 |
Rather than reading it dynamically from the ChangeLog -- that,
remember, is only a dummy in a Git checkout! To avoid risking
the definition to get out-of-sync, let's enhance the maintainer
target 'update-copyright' to update it automatically (the same
way it's done in the Automake build system).
Signed-off-by: Stefano Lattarini <address@hidden>
---
bin/local.mk | 6 +-----
cfg.mk | 12 ++++++++++++
configure.ac | 5 +++++
lib/Makefile.am | 6 +-----
4 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/bin/local.mk b/bin/local.mk
index 57983f8..ff7b2cf 100644
--- a/bin/local.mk
+++ b/bin/local.mk
@@ -38,10 +38,6 @@ EXTRA_DIST += \
# Files that should be removed, but which Automake does not know.
MOSTLYCLEANFILES += $(bin_SCRIPTS) bin/autoconf.in bin/*.tmp
-# Get the release year from ChangeLog.
-RELEASE_YEAR = \
- `sed 's/^\([0-9][0-9][0-9][0-9]\).*/\1/;q' $(top_srcdir)/ChangeLog`
-
## ------------- ##
## The scripts. ##
## ------------- ##
@@ -60,7 +56,7 @@ edit = sed \
-e 's|@address@hidden|$(M4_DEBUGFILE)|g' \
-e 's|@address@hidden|$(M4_GNU)|g' \
-e 's|@address@hidden|$(AWK)|g' \
- -e 's|@address@hidden|'$(RELEASE_YEAR)'|g' \
+ -e 's|@address@hidden|$(RELEASE_YEAR)|g' \
-e 's|@address@hidden|$(VERSION)|g' \
-e 's|@address@hidden|$(PACKAGE_NAME)|g' \
-e 's|@address@hidden|Generated from address@hidden; do not edit by
hand.|g'
diff --git a/cfg.mk b/cfg.mk
index a57196e..980eab9 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -123,6 +123,18 @@ update-copyright-env = \
UPDATE_COPYRIGHT_USE_INTERVALS=1 \
UPDATE_COPYRIGHT_MAX_LINE_LENGTH=72
+update-copyright: update-release-year
+update-release-year:
+ $(AM_V_GEN):; \
+ if test -n "$$UPDATE_COPYRIGHT_YEAR"; then \
+ current_year=$$UPDATE_COPYRIGHT_YEAR; \
+ else \
+ current_year=`date +%Y` && test -n "$$current_year" \
+ || { echo "$@: cannot get current year" >&2; exit 1; }; \
+ fi; \
+ sed -i "/^RELEASE_YEAR=/s/=.*$$/=$$current_year/" configure.ac
+.PHONY: update-release-year
+
# Prevent incorrect NEWS edits.
old_NEWS_hash = 8532b4ed4fb456eb71071a5cf8c258d4
diff --git a/configure.ac b/configure.ac
index b3f3fa9..91f6a74 100644
--- a/configure.ac
+++ b/configure.ac
@@ -27,6 +27,11 @@ AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([1.11 dist-xz readme-alpha no-texinfo.tex std-options])
+# Keep this on a line of its own, since it must be found and processed
+# by the 'update-release-year' rule in our Makefile.
+RELEASE_YEAR=2013
+AC_SUBST([RELEASE_YEAR])
+
AB_INIT
# We use '/bin/sh -n script' to check that there are no syntax errors
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 1004622..2b4c494 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -162,10 +162,6 @@ nodist_m4sugarlib_DATA = \
CLEANFILES += $(nodist_m4sugarlib_DATA)
-# Get the release year from ../ChangeLog.
-RELEASE_YEAR = \
- `sed 's/^\([0-9][0-9][0-9][0-9]\).*/\1/;q' $(top_srcdir)/ChangeLog`
-
# The ':;' in the second line of the recipe works around a redirected
# compound command bash exit status bug.
m4sugar/version.m4: Makefile
@@ -182,7 +178,7 @@ m4sugar/version.m4: Makefile
echo 'm4_define([m4_PACKAGE_STRING], [$(PACKAGE_STRING)])' && \
echo 'm4_define([m4_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])' && \
echo 'm4_define([m4_PACKAGE_URL], [$(PACKAGE_URL)])' && \
- echo 'm4_define([m4_PACKAGE_YEAR], ['$(RELEASE_YEAR)'])'; \
+ echo 'm4_define([m4_PACKAGE_YEAR], [$(RELEASE_YEAR)])'; \
} > address@hidden
mv address@hidden $@
--
1.8.3.rc0.19.g7e6a0cc
- [PATCH 02/16] build: don't distribute lib/freeze.mk explicitly, (continued)
- [PATCH 02/16] build: don't distribute lib/freeze.mk explicitly, Stefano Lattarini, 2013/05/05
- [PATCH 03/16] build: no more make recursion for 'doc' subdir, Stefano Lattarini, 2013/05/05
- [PATCH 01/16] sync: some files from upstream, Stefano Lattarini, 2013/05/05
- [PATCH 05/16] build: no more recursion for lib/emacs subdir, Stefano Lattarini, 2013/05/05
- [PATCH 04/16] build: no more make recursion for 'bin' subdir, Stefano Lattarini, 2013/05/05
- [PATCH 06/16] build: no more recursion for lib/autoscan subdir, Stefano Lattarini, 2013/05/05
- [PATCH 07/16] build: no more recursion for lib/autotest subdir, Stefano Lattarini, 2013/05/05
- [PATCH 08/16] build: no more recursion for lib/m4sugar subdir, Stefano Lattarini, 2013/05/05
- [PATCH 09/16] build: no more recursion for lib/autoconf subdir, Stefano Lattarini, 2013/05/05
- [PATCH 10/16] build: no more recursion for lib/Autom4te subdir, Stefano Lattarini, 2013/05/05
- [PATCH 11/16] build: define RELEASE_YEAR with AC_SUBST,
Stefano Lattarini <=
- [PATCH 13/16] build: avoid repeating the same etags args several times, Stefano Lattarini, 2013/05/05
- [PATCH 14/16] build: fixup: don't define ETAGS_ARGS multiple times, Stefano Lattarini, 2013/05/05
- [PATCH 12/16] build: no more recursion for lib subdir, Stefano Lattarini, 2013/05/05
- [PATCH 16/16] build: remove last make recursion (for subdir 'man'), Stefano Lattarini, 2013/05/05
- [PATCH 15/16] build: no more recursion for tests subdir, Stefano Lattarini, 2013/05/05
- Re: [RFC] Convert the Autoconf build system to non-recursive make, Paul Eggert, 2013/05/05