|
From: sfeam (E. Merritt) <eam...@gm...> - 2013-08-09 07:00:36
|
On Wednesday, 07 August 2013, Hans-Bernhard Bröker wrote:
> On 07.08.2013 19:49, sfeam (Ethan Merritt) wrote:
>
> > How about changing version.c to something like
> >
> > #ifndef LAST_MODIFIED
> > #define LAST_MODIFIED "2012-06-19"
> > #endif
> > const char gnuplot_date[] = LAST_MODIFIED;
> >
> > And then using some autotools magic that I would have to hunt for
> > do something along the lines of
>
> It would have to be different magic, I'm afraid. Autotools isn't run at
> the point in time that counts: a simple re-make of an already configured
> source tree.
>
> > LAST_MODIFIED = <some magic involving awk or grep>
> > DEFS = $DEFS -DLAST_MODIFIED=${LAST_MODIFIED}
>
> > That should reproduce the current behavior without modifying
> > any source files.
>
> Not quite. Changes to non-source files (like the Makefile) don't
> trigger re-builds of version.o. There has to be some artificial
> dependence of version.o on ChangeLog added to the generated Makefile.
The attached patch does the trick for me, but it probably fails
for those same out-of-tree builds that were failing already.
It replaces the stuff currently in src/Makefile.maint with the following:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
version.o: modification_date
modification_date: ../ChangeLog
@echo Making $@
echo "#undef LAST_MODIFIED" >> ../config.h
echo "#define LAST_MODIFIED \"${last_change}\"" >> ../config.h
echo "#define LAST_MODIFIED \"${last_change}\"" > modification_date
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
modification_date is declared a BUILT_FILE in Makefile.am so it gets
created before anything else.
The main problem with this from my perspective is that if you touch
the ChangeLog at all, it triggers a rebuild of everything, not just version.o,
because it appends the date to config.h and everything depends on that.
I imagine there is a way to generate a new file at the top level that,
like config.h, is considered OK to modify. But I don't know how to do that.
If the people who don't like the current mechanism are happier with
this one, please help clean up the out-of-tree builds.
Is it just a matter of adding $(top_srcdir) etc throughout Makefile.maint?
Ethan
|