[Tfug] How do I get automake to set build number?

Joe Blais joe.blais at pti-instruments.com
Tue Apr 17 18:52:30 MST 2007


> >
>
> What you need to do is to have your version.h depend on all the other
> source files, then have its make clause run the incrementor program.
>
> You will also need to make sure that any cvs commits after the build
> commit version.h last, otherwise the commit (assuming you have RCS
> keywords in your code) would indicate that the incrementor program should
> run again.
>
> --
> Mike Fitzgibbon

Mike -

That's just the problem.  If I make the makefile (I'd figure out the correct
syntax) and add something like:

myprog : version.h config.h
	cc myprog.cpp

version.h :
	versioninc ./version.h

Something like that - unfortunately the GNU makefile isn't so simple, it
starts out like this:

********************************** snip **************************
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# Makefile.  Generated from Makefile.in by configure.

# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005  Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.


srcdir = /home/joeb/Projects/versioninc
top_srcdir = /home/joeb/Projects/versioninc
VPATH = /home/joeb/Projects/versioninc
pkgdatadir = $(datadir)/versioninc
pkglibdir = $(libdir)/versioninc
pkgincludedir = $(includedir)/versioninc
top_builddir = .
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = /usr/bin/install -c
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)

********************************** snip **************************

and continues for 19k or so, and gets re-created automagically at certain
times - which I'm not sure of when all the times are.

I looked around the GNU site several times to figure if there were any
macros that would trigger the conditional action you talk about. What i
found there had to do with checking the versions of GNU itself.  I found
where the 'AM_INIT_AUTOMAKE( appname, 1.2.3.4)'  in configure.in, pushes the
'1.2.3.4' down to
*****************
/* Version number of package */
#define VERSION "1.5.4.6"
******************
in define.h.  However I haven't found any GNU macro, or where I could just
add 'versioninc ./version.h' to some special place in any one of the files
(config.guess, config.sub config.in, config.am, makefiel.in, makefile.am,
H4.^%$^%$ (explatives deleted)) that might trigger changing the '6' into a
'7' through all the magical ..stuff...

config.guess and config.sub look promising, but they make my head hurt.

thank you

joe

-- I just love ranting into a tv screen through a keyboard! --  at the end
of a frustrating day, it just feels better!





More information about the tfug mailing list