[Gambas-user] gbc3-gb_error.o compiling rev #5670

Tobias Boege taboege at ...626...
Sun May 26 11:13:11 CEST 2013


On Sat, 25 May 2013, Beno?t Minisini wrote:
> Le 25/05/2013 11:37, Tobias Boege a ?crit :
> > On Fri, 24 May 2013, Beno?t Minisini wrote:
> >> Le 23/05/2013 14:23, Tobias Boege a ?crit :
> >>>>
> >>>> Sorry, I prefer my way of defining TRUNK_VERSION: you should not modify
> >>>> the compilation flag for defining a constant. You'd rather use the
> >>>> 'config.h' mechanism (AC_DEFINE & AC_DEFINE_UNQUOTED).
> >>>>
> >>>
> >>> But when is this file regenerated? Only by configure, correct? This would
> >>> mean that I have to issue a ./configure everytime I want the new correct
> >>> version number from gbx3 which is less desirable, in my opinion, than
> >>> changing a compiler flag.
> >>>
> >>> Regards,
> >>> Tobi
> >>>
> >>
> >> You get a point there. But you must find a way to get the svn version
> >> only when it changes. For example, we can imagine adding a special
> >> makefile rule that computes the svn version and put it in its custom
> >> header file. This rule will depend on the modification time of the
> >> /trunk/.svn directory (if it is possible).
> >>
> >> What do you think?
> >>
> >
> > Good idea. Actually I thought about that, too, but rejected it because a
> > Makefile rule that depends on .svn will not work on non-repository sources,
> > like:
> >
> > make: *** No rule to make target `.svn', needed by `all'.  Stop.
> >
> > which is from a Makefile inside my home directory - not svn versioned.
> >
> > What I didn't think of was this workaround: have a .PHONY target that
> > compares timestamps of .svn to the header's instead of letting make do it.
> > We could catch the case that .svn doesn't exist:
> >
> > ---
> > trunk_version.h: TRUNK_VERSION = $(shell LC_ALL=C svn info 2>/dev/null | grep Revision | egrep -wo "[0-9]+")
> > trunk_version.h:
> > 	@if test -d .svn -a .svn -nt trunk_version.h ; then             \
> > 	echo -e "/* TRUNK version if available */\n#define TRUNK_VERSION\t$(TRUNK_VERSION)\n" >trunk_version.h; \
> > 	fi
> >
> > .PHONY: trunk_version.h
> > ---
> >
> > This worked in my home directory, i.e. did nothing but without complaint,
> > and in trunk/ it created the trunk_version.h. Maybe ".svn" above should be
> > prefixed with the path to the top-level Gambas directory?
> >
> > The lines are quite ugly. I couldn't find out how to use a here-document in
> > a Makefile. Alas, I don't have time today to make it better.
> >
> > Regards,
> > Tobi
> >
> 
> My solution is in r5677: I took yours and simplified it by removing what 
> I don't understand. :-)
> 
> It creates a void 'trunk_version.h' if there is no '.svn' directory.
> 
> All seems to work correctly, but I'm waiting for your opinion to be 
> sure! :-)
> 

One thing: trunk_version.h is always up to date since it's .PHONY. But gbx.c
and friends don't depend on trunk_version.h so these files won't be rebuilt
when the trunk version changes (if they are not rebuilt anyway). I added
this dependency in rev#5679.

This assumes, however, that you have run the Makefile in main/ before you
run the ones in gbc/ and gbx/. This sounds fair for me.

Regards,
Tobi




More information about the User mailing list