Reputation: 2376
I have a intermediary source file foobar.c
which is automatically generated from foobar.c.in
via a sed script. The dist
target created via autotools includes foobar.c
in the generated tarballs. What do I do in Makefile.am
or in configure.ac
to exclude foobar.c
?
Upvotes: 3
Views: 691
Reputation: 3240
The solution is actually quite simple
nodist_foobar_SOURCES = foobar.c
BUILT_SOURCES = foobar.c
This way automake knows that foobar.c
is generated at build time, and since it's in nodist_
it won't be redistributed.
Although depending on what kind of string you're talking about a common way to solve it is to use a preprocessor macro and have it passed as CPPFLAGS
foobar_CPPFLAGS = "-DSOMESTRING=\"$(somevariable)\""
and then just use SOMESTRING
in the code and let the preprocessor handle it.
Upvotes: 3
Reputation: 2376
I solved my problem by changing from using a sed script to modify foobar.c.in
to having configure
determine the needed strings and stick them into config.h
, which is included by a non-intermediary version of foobar.c
. config.h
isn't included in the tarballs.
However, it still seems like there should be some method to tell autotools to exclude certain files from the dist tarballs.
Upvotes: 0