automake
[Top][All Lists]
Advanced

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

Re: RFE: allow for computed version number


From: Bruno Haible
Subject: Re: RFE: allow for computed version number
Date: Fri, 12 Jun 2009 00:23:44 +0200
User-agent: KMail/1.9.9

Hello Ralf,

The proposed patch was meant as a prototype, not a proposed patch for
Automake. Forget about the code, and just note that it can be done with
  - a new macro through which the user declares how to compute the version,
  - some modifications in init.m4 and distdir.am.

> > - with a lazily computed version number (this is for projects where the 
> > version
> >   changes several times a day):
> > 
> >     AM_INIT_VERSION([$$version], [version=`sh $(top_srcdir)/gen-version`])
> 
> These kind of quoting hacks are incredibly ugly and error-prone

OK, please propose a better way to specify the version?

Maybe    AM_INIT_VERSION([`sh $(top_srcdir)/gen-version`])     ?

> > "make dist" computes the version number once, then computes the 'distdir'
> > variable from it, and passes it to a sub-make invocation, from where it
> > and the 'top_distdir' variable will be propagated to subdirectories.
> 
> This, too, is quite error-prone, as non-GNU make don't propagate
> overridden variables to sub makes.

The 'distdir' and 'top_distdir' variables are already being propagated to
sub-makes. Nothing needs to change for this part of distdir.am.

> > + libversion_a_CPPFLAGS = $(AM_CPPFLAGS) address@hidden@echo 
> > -DVERSION=\"$(VERSION)\"`
> 
> Ugh.  This would at least require hiding in some macro or so.

I agree. This can be made prettier.

> > + libversion_a-version.$(OBJEXT) : $(top_srcdir)/gen-version
> 
> Ugh.  Likewise, this should be hidden somehow, or computed by automake
> from the AM_INIT_VERSION arguments.  Having to specify `gen-version'
> here and (far away) in configure.ac is error-prone.

You are right that there is a semantic link between the AM_INIT_VERSION
argument and the dependency here. On the other hand, it's the user who needs
to place these dependencies, because he knows (and automake does not know)
which compilation units and documentation files will contain the version
number and which won't.

How to solve this? Should the arguments to AM_INIT_VERSION be
  1. the expression that computes the version,
  2. a dependency?

Bruno




reply via email to

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