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

Mike Fitzgibbon mikef at lpl.arizona.edu
Tue Apr 17 17:35:31 MST 2007


On Tue, 17 Apr 2007, Joe Blais wrote:

>
>
> >
> > I use a small program from the subversion developers that checks the
> > revision of all files in a folder and then uses the highest revision found
> > for the #define value. So although revision numbers are per file I use it
> > essentially per release. Unfortunately I'm required to develop
> > using Windows
> > so the program I use is for Windows. But maybe there is something similar
> > for linux? I would be suprised if there wasn't.
> >
> > Andy
> >
>
> I was just starting to port over the small program I made for VisualStudio
> to Linux, every time i hit make, it gets called. The program increments the
> build number in my version.h file.  The problem is,how can I automatically
> trigger that program from within the makefile - seeing as how gnu makes the
> makefile from the makefile.am and a host of other files that look real
> scarry on the inside.  The makefile.am seems to have been put under CVS
> control by KDevelop, so I could put something in there, but when looking
> through the list of macro's from GNU, I didn't see anything that would cause
> some conditional program execution.  makefile.am contains the list of files
> to build, anmd Kdevelop edits that file through it's automakemanager (and I
> can manually) but all it has is a list of files in some MACROs
>
> I guess I should just make scripts that call the incrementor program, and
> then call make.  I'ts just that I like automagic - and then cuss when it
> does what I don't expect! And then, worst of all, I have to remember to do
> something, which I won't do the ONE time I really need to.
>
> joe
>
>

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





More information about the tfug mailing list