3.0 testing priorities

Cristian Ionescu-Idbohrn cristian.ionescu-idbohrn at axis.com
Mon Feb 25 03:19:03 PST 2013


On Mon, 25 Feb 2013, Jef Driesen wrote:
> On 2013-02-24 23:56, Dirk Hohndel wrote:
> > On Feb 24, 2013, at 2:46 PM, Linus Torvalds wrote:
> > > On Sun, Feb 24, 2013 at 2:42 PM, Jan Schubert <Jan.Schubert at gmx.li> wrote:
> > > > On 24.02.2013 23:20, Dirk Hohndel wrote:
> > > > > After git pull; make clean; make.   ?
> > > >
> > > > Oh, clean? After cleaning I get -25, before -16!?
> > >
> > > The version string is compiled in. And we do not have a dependency on
> > > it changing.
> >
> > So for the shell and Makefile magicians out there… how hard would it
> > be to have a rule that says "if the content of this file is different
> > from that file, copy this file to that file and recompile gtk-gui.o"?
> > Then we could start by always running the version script redirected
> > into a file, do the comparison with the backup and automagically do
> > the right thing. Only I have no idea how to do that :-)
>
> I (with some help from the automake devs) implemented something like that for
> libdivecomputer. Look in the src/Makefile.am file.
>
> The "version" (which in libdivecomputer is just the git sha1 for HEAD, but you
> can of course change that as you wish) is stored in the revision file. When
> you compile, the version is written to a temporary file, and compared with the
> revision file. Only when it's different the revision file is updated. From the
> revision file a revision.h header file defining a simple macro is generated,
> which can be included in the source. Works very well for me.
>
> The revision file is also shipped in tarballs, so it also works if you are not
> using git.

This is another way you could do it, and a bit more generic:

--- [ Makefile example ]
# this is a make function
# if arg1 and arg2 differ, copy arg1 to arg2 and return arg2
recompile-gtk-gui = $(shell \
	if ! cmp -s $(1) $(2); then \
		cp -f $(1) $(2); \
		printf $(2); \
	fi)

gtk-gui.o: gtk-gui.c $(call recompile-gtk-gui,this-file,that-file)
---

`that-file' will appear on the list of prequisites, only when
`this-file' overwrites `that-file'.


Cheers,

-- 
Cristian


More information about the subsurface mailing list