[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How do I configure Makefile.am to run a program?
From: |
David Fang |
Subject: |
Re: How do I configure Makefile.am to run a program? |
Date: |
Wed, 2 Apr 2008 20:21:19 -0400 (EDT) |
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.
Thanks, but the problem with this solution is that I would have to rerun the
.configure step each time. Forgetting to do that is as as easy as
forgetting to edit the spec file.
Hi,
Doesn't AC_CONFIG_FILES automatically add regenerations rules to
the Makefile? usually resembles something like:
# somewhere in Makefile.in
config-generated-file: [config-generated-file.in]
cd $(top-srcdir) && ./config.status config-generated-file
If the command run to generate it is some script (which is used by
config.status), you should be able to append a dependency:
# to Makefile.am
config-generated-file: generating-script
Anytime config.status or your generating script changes, it should
automatically be regenerated. (And if only your generating script changes
(not configure.ac), it won't re-run all of configure, just
that output phase, config.status.)
And if you want the target to always be up-to-date,
add it to BUILT_SOURCES=, or all-local:, as others suggested.
I let 'make' take care of any dependencies, basically.
HTH,
Fang
David Fang
Computer Systems Laboratory
Electrical & Computer Engineering
Cornell University
http://www.csl.cornell.edu/~fang/
-- (2400 baud? Netscape 3.0?? lynx??? No problem!)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: How do I configure Makefile.am to run a program?,
David Fang <=