On Fri, Mar 21, 2008 at 3:57 PM, Harlan Stenn <[EMAIL PROTECTED]> wrote:
> > 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: > > > > noinst_PROGRAMS = poll.spec > > poll_tmpl_SOURCES = poll.tmpl FORCE > > .tmpl.spec: > > ./logpoll.pl $< > > > > FORCE: > > You want BUILT_SOURCES = something. > > If logpoll.pl takes the .tmpl.spec file and spits out 'poll.spec' then > you want: > > BUILT_SOURCES = poll.spec > > poll.spec: .tmpl.spec logpoll.pl > ./logpoll.pl $< > > if logpoll.pl is a generated script. If it's part of the package you > want: > > poll.spec: .tmpl.spec > $srcdir/logpoll.pl $< > > H > > I tried but I got: Makefile.am:16: variable `BUILD_SOURCES' is defined but no program or Makefile.am:16: library has `BUILD' as canonic name (possible typo) cd . && /bin/sh ./config.status Makefile config.status: creating Makefile Makefile:671: warning: overriding commands for target `poll.spec' Makefile:256: warning: ignoring old commands for target `poll.spec' make all-recursive make[1]: Entering directory `/home/jlynch/threaded' Makefile:671: warning: overriding commands for target `poll.spec' Makefile:256: warning: ignoring old commands for target `poll.spec' Making all in src I think I did what you suggested, from my Makefile.am BUILD_SOURCES = poll.spec poll.spec: .tmpl.spec logpoll.pl ./logpoll.pl $< noinst_DATA = poll.spec logpoll.pl is a static script that simply reads the tmpl file, runs svnversion to get the version number and does a substitute and writes the spec file.