automake
[Top][All Lists]
Advanced

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

Re: nodist_BUILT_SOURCES?


From: John Calcote
Subject: Re: nodist_BUILT_SOURCES?
Date: Thu, 10 Jun 2010 12:06:23 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.10) Gecko/20100512 Thunderbird/3.0.5

Hi Monty,

On 6/10/2010 11:42 AM, Monty Taylor wrote:
> Hey all,
>
> Potentially odd question...
>
> How would I accomplish something like what's in the subject? I have a
> source file that wants to be built before other files - so including it
> in BUILT_SOURCES does the right thing, but I do _not_ want to have it
> included in the dist tarball.
>
>   

Files listed in BUILT_SOURCES are not taken into account wrt
distribution. The distribution list is built from other primary-like
constructs, such as *_SOURCES. The example in the autoconf manual shows
how you would do what you want:

...
nodist_foo_SOURCES = bindir.h
BUILT_SOURCES = bindir.h
...

In this example, BUILT_SOURCES is used only to get bindir.h built up
front. The actual SOURCES variable used to list its use by a particular
product carries the nodist prefix, which keeps it from being distributed.
I tried removing it from BUILT_SOURCES and adding in a rule that looks like:

> %.cc: drizzled/configmake.h
>
> But that didn't work.
>
> Any thoughts?
>
> While we're at it - this whole thing is to get expanded values of
> autoconf directories into a header file where I can consume them...
> which because they contain nested variables
> (localstatedir=${prefix}/var}) I seemingly have to do at make time. The
> dist problem above could be solved if anybody knows a decent trick to
> fully expand those variables at configure time... I've tried many
> combinations of eval and quoting - but nothing seems to do what I'm
> trying to do.
>   

You can't (or rather shouldn't) fully expand these variables at
configure time because they may be modified at make time by the user on
the make command line (e.g., make prefix=xxx). There are two
widely-practiced options:

1. Replace such variables on the compiler command line for all or some
sources:

mylib_la_CPPFLAGS =\
 -DSYSCONFDIR=\"$(sysconfdir)\"\
 -DSYSLOGDIR=\"$(syslogdir)\" ...

This works well for situations where you only have a few variables to
replace.

2. Add some custom rules to your Makefile.am scripts that build your
source files using variable replacement techniques like those used by
Autoconf:

EXTRA_DIST = myprog.cfg.in

edit = sed \
   -e 's|@address@hidden|$(sysconfdir)|g' \
   -e 's|@address@hidden|$(sysrundir)|g' \
   -e 's|@address@hidden|$(syslogdir)|g' \
   -e 's|@address@hidden|$(libexecdir)|g' \
   -e 's|@address@hidden|$(sbindir)|g'\
   -e 's|@address@hidden|$(prefix)|g'

all: myprog.cfg

# Build executable scripts
myprog.cfg : Makefile
        $(edit) '$(srcdir)/address@hidden' > $@

Then just format your input templates just like autoconf input templates
with @variable@ where ever you want variable replacement to occur at
make time.

Regards,
John




reply via email to

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