automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I configure Makefile.am to run a program?


From: John Calcote
Subject: Re: How do I configure Makefile.am to run a program?
Date: Fri, 21 Mar 2008 13:28:55 -0600
User-agent: Thunderbird 2.0.0.12 (Windows/20080213)

Jim,

I like to include my subversion version number in my rpm spec file so I can
keep track of the source used to generate the binary.  I've been manually
changing it but since I forget to sometimes, I'd like for make to generate
the spec file for me.  I wrote a small perl program that reads a template
file (.tmpl) and writes out the .spec file after calling subversion . -n.  I
can't figure out how to force make from a Makefile.am to run the perl script
each time it builds.
I thought I could do it with SUFFIXES but when I tried it didn't work.  I
added the following to the top level Makefile.am:
Don't use make to do this - just use autoconf, and let your configure script 
deal with it:

configure.ac
------------
AC_INIT(...)
...
svnrev=`svnversion .`
AC_SUBST(svnrev)
...
AC_CONFIG_FILES([Makefile ... poll.spec)
AC_OUTPUT
------------

Now create a file called poll.spec.in that contains an exact copy of your 
existing poll.spec, but add the autoconf substitution variable, @svnrev@ where 
it make sense.

In a Makefile.am in the directory containing your poll.spec file, add
EXTRA_DIST = ... poll.spec

I use this trick all the time and it works great! In fact, I generate most of 
my rpm and debian build scripts this way.

Regards,
John





reply via email to

[Prev in Thread] Current Thread [Next in Thread]