automake problems.
I have a autotooled project where the list of source files for one of the targets (we shall call it foo) are generated by some script code that runs when "configure" is invoked. How can I pass this list of files to foo_SOURCES in Makefile.am / Makefile.in?
I tried the following:
Makefile.am:
include $(srcdir)/sourcelist.txt
## sourcelist.txt is generated by script code inside configure
## that generates the list of files build and stored in the
## SOURCE_LIST variable
foo_SOURCES = $(SOURCE_LIST)
This doesn't work since automake expects sourcelist.txt to be available but it will only be created when "configure" is run.
I found an email someplace that essentially says that automake is stupid and can't handle conditionally compiling source files.
The work around suggested is this:
Essentially, compile all the source files, and then only include the ones that configure says should be. Stupid.
I can't believe there isn't a better way, I might keep looking.
The work around suggested is this:
Quote: An approach that works is the following:
libfoo_a_SOURCES=common.c
libfoo_a_LIBADD=@LIBFOOADD@
EXTRA_libfoo_a_SOURCES=opt1.c opt2.c opt3.c
Then, in the configure script, define LIBFOOADD to a subset of `opt1.o
opt2.o opt3.o` (note `.o`!)
Essentially, compile all the source files, and then only include the ones that configure says should be. Stupid.
I can't believe there isn't a better way, I might keep looking.
The Automake manual covers conditional compilation of sources, giving two different methods (the second one is easier, and the only one I've used).
Why the heck didnt that turn up on by google search. I literally used the terms "conditional compilation" Feh. whatever.
That first method is what I found originally, the second method is automake conditionals, which might look like less of a hack, but might be a bit inflexible...
That first method is what I found originally, the second method is automake conditionals, which might look like less of a hack, but might be a bit inflexible...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement