Thanks, that's so much better.
I'm not too fluent with autotools (having written only one project with them), but I didn't have to specify a bin_PROGRAM when compiling some source files to be later linked into the executable. What I had to do, however, was to specify a lib_LIBRARIES variable containing the name of the
static library I was gonna use thereon.
This is my Makefile.am for that small library (just a parser for a 3D mesh specification text file):
Code:
GRAMMAR_PREFIX=mfile_
SUBDIRS=m_files
noinst_PROGRAMS=parseTest
lib_LIBRARIES=libmfile.a
## Had to add the autogenerated lexer and parser to LDADD... O_o
AM_YFLAGS=-d -p $(GRAMMAR_PREFIX)
AM_CFLAGS=-Im_files/ -I..
libmfile_a_SOURCES=m_files/m_lexer.l m_files/m_parser.y m_parsing_util.c m_print_visitor.c m_stats_visitor.c m_toMeshDescriptor.c ../meshUtil.c libmfile_wrapper.c
parseTest_LDADD=libmfile.a
parseTest_SOURCES=test_m_parsing.c
You can safely ignore those AM_YFLAGS (automake flags for yacc) and things regarding parseTest, as it just was a test program to see if the parsing went smooth with some example files.
To use the code compiled as a static library, you'll add to modify your top level binary LDADD flags, eg:
Code:
bin_PROGRAMS=foo
foo_LDADD=dir/libbar.a
Hope this is helpful.