summaryrefslogtreecommitdiff
path: root/Makefile.am
diff options
context:
space:
mode:
authorRon <ron@debian.org>2013-05-11 02:05:24 +0930
committerRon <ron@debian.org>2013-05-11 02:05:24 +0930
commit2f2f9d63b84d0eacdf66c03b683b932b367b017e (patch)
tree7d2a13bfd7813ca729133b6d8e354423b7fca3cb /Makefile.am
parent80c4834c4822a9be4cb26ca2a11697a6a5b44485 (diff)
downloadopus-2f2f9d63b84d0eacdf66c03b683b932b367b017e.tar.gz
Fully automate version updating
This one meets or exceeds the following requirements: - Version is checked/updated for every build action when in the git repo. Does not require the user to re- ./configure to get the correct version. - Version is not updated automatically when using exported tarball source. Avoids accidentally getting a wrong version from some other git repo in a parent directory of the source, and allows setting the correct version for distro package exports. - Automatic updating can be manually suppressed. For developers doing lots of change/rebuild cycles they don't plan to release, when they don't want a full rebuild triggered for every commit, and again for every change made immediately after a commit. The version will still always be updated if they do a `make dist`. - Does not require any manual updating of versions in the mainline git repo for each release aside from normal tagging. The version is recorded in one file only, that is automatically generated and will never need to be committed. - Does not require gnu-make features for the autoconf builds. It does not currently: - Keep a checksum of every source file in tarball releases to mangle the version if people modify the tarball source. Responsible people can manually update the version easily though in such cases. The version.mk file is now only used by the VC project files. Once they are updated to use the package_version file too, then it can be deleted from the repository.
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am33
1 files changed, 33 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index cca953b5..e22abfa5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -150,4 +150,37 @@ uninstall-local:
( cd doc && $(MAKE) $(AM_MAKEFLAGS) uninstall )
+# We check this every time make is run, with configure.ac being touched to
+# trigger an update of the build system files if update_version changes the
+# current PACKAGE_VERSION (or if package_version was modified manually by a
+# user with either AUTO_UPDATE=no or no update_version script present - the
+# latter being the normal case for tarball releases).
+#
+# We can't just add the package_version file to CONFIGURE_DEPENDENCIES since
+# simply running autoconf will not actually regenerate configure for us when
+# the content of that file changes (due to autoconf dependency checking not
+# knowing about that without us creating yet another file for it to include).
+#
+# The MAKECMDGOALS check is a gnu-make'ism, but will degrade 'gracefully' for
+# makes that don't support it. The only loss of functionality is not forcing
+# an update of package_version for `make dist` if AUTO_UPDATE=no, but that is
+# unlikely to be a real problem for any real user.
+$(top_srcdir)/configure.ac: force
+ @case "$(MAKECMDGOALS)" in \
+ dist-hook) exit 0 ;; \
+ dist-* | dist | distcheck | distclean) _arg=release ;; \
+ esac; \
+ if ! $(top_srcdir)/update_version $$_arg 2> /dev/null; then \
+ . $(top_srcdir)/package_version || exit 1; \
+ [ "$(PACKAGE_VERSION)" != "$$PACKAGE_VERSION" ] || exit 0; \
+ fi; \
+ touch $@
+
+force:
+
+# Create a minimal package_version file when make dist is run.
+dist-hook:
+ echo 'PACKAGE_VERSION="$(PACKAGE_VERSION)"' > $(top_distdir)/package_version
+
+
.PHONY: opus check-opus install-opus docs install-docs