[Top][All Lists]

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

amhello with generated version

From: Peter Johansson
Subject: amhello with generated version
Date: Wed, 06 Jan 2010 21:14:35 -0500
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv: Gecko/20091204 Thunderbird/3.0


It has been discussed recently that the way the VERSION is set with automake is suboptimal when the VERSION is changing frequently [1]. The problem is basically that autoconf has to be re-run every time the VERSION is updated, which is not convenient if the VERSION is updated, e.g., at every commit to the RVS.

I've played around with a work-around inspired by the git-version-gen script in gnulib [2]. Please find a revised version of amhello using the idea attached. The idea is, as suggested by by Ralf Wildenhues, to keep the version information in a separate file `.version' [3]. Other files/targets can then depend on `.version' and propagate the version information as appropriate. `.version' is updated from the output of a script `gen-version'; here only a wrapper around `date' but could in principle be anything from `git describe', `svnversion' to home brewed scripts extracting the version from, e.g., ChangeLog. When building from a tarball, there exists a file `.tarball-version' and when this file is present `.version' will not be updated from the `gen-version' script. That is because it is desired that the version is set when the maintainer issues `make distcheck' and not at a later point when some user builds the package, and also in many situations `gen-version' is impossible to run outside the RVS environment, e.g., when the version is set by `svnversion'.

Here, the version is propagated to two places: 1) To the hello program, which is done by generating a short source file `version.c'. This implies when the version changes, only `version.o' needs to be re-compiled and version information can be linked into the programs. 2) The version is also propagated into the Makefile and in particular so the $(distdir) is set accurately. This is done by overriding the $(VERSION) variable, and this is done in a file `' that is included into the Makefile. The file `' in turn is generated from `.version' and since $(VERSION) is set in a separate file it can be updated without re-generating the entire Makefile via config.status.

I chose to have rules for `.version' and `' in all Makefiles and since they are the same everywhere, I located them in a file `' that is included at automake time. The attached tarball is obviously not created with `make dist' but what a developer would check out from a RVS.

Thoughts or any feedback are very welcome.



Attachment: amhello.tar.gz
Description: GNU Zip compressed data

reply via email to

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