I have directory with:
lib_LIBRARIES = libjunk.a
libjunk_a_SOURCES = src/a/a.f \
src/b/b.c
run configure and gmake and get this:
$ gmake
source='src/b/b.c' object='b.o' libtool=no \
depfile='.deps/b.Po' tmpdepfile='.deps/b.TPo' \
depmode=gcc /bin/sh ../test/depcomp \
gcc -DPACKAGE=\"foo\" -DVERSION=\"bar\" -I. -I../test -g -O2 -c -o b.o `test -f
src/b/b.c || echo '../test/'`src/b/b.c
rm -f libjunk.a
ar cru libjunk.a a.o b.o
ar: Error: a.o cannot open
: libjunk.a
So the fortran source is just skipped. In the Makefile generated by
configure, the .c.o and .f.o are very different. The .c.o has all the
code for handling source directories, but .f.o is simple:
.f.o:
$(F77COMPILE) -c -o $@ $<
.c.o:
source='$<' object='$@' libtool=no \
depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \
$(CCDEPMODE) $(depcomp) \
$(COMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$<
Also, there is a b.o target, but no a.o target:
b.o: src/b/b.c
source='src/b/b.c' object='b.o' libtool=no \
depfile='$(DEPDIR)/b.Po' tmpdepfile='$(DEPDIR)/b.TPo' \
$(CCDEPMODE) $(depcomp) \
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjunk_a_CFLAGS)
$(CFLAGS) -c -o b.o `test -f src/b/b.c || echo '$(srcdir)/'`src/b/b.c
I added a C++ source and though much of the srcdir stuff was in the
resulting make file, I got this error:
$ gmake
source='src/c/c.cc' object='c.o' libtool=no \
depfile='.deps/c.Po' tmpdepfile='.deps/c.TPo' \
depmode=gcc /bin/sh ../test/depcomp \
g++ -DPACKAGE=\"foo\" -DVERSION=\"bar\" #ifdef\ __cplusplus #endif -I. -I../test
-g -O2 -c -o c.o `test -f src/c/c.cc || echo '../test/'`src/c/c.cc
g++: No input files
gmake: *** [c.o] Error 1
But, I can list the file:
$ ls `test -f src/c/c.cc || echo '../test/'`src/c/c.cc
../test/src/c/c.cc
Also, the C target now fails with the same error. This has to do with
the DEFS adding the code:
#ifdef\ __cplusplus #endif
to the command line. Removing this from DEFS, I get a successful
compile (excluding the fortran above):
$ gmake
source='src/b/b.c' object='b.o' libtool=no \
depfile='.deps/b.Po' tmpdepfile='.deps/b.TPo' \
depmode=gcc /bin/sh ../test/depcomp \
gcc -DPACKAGE=\"foo\" -DVERSION=\"bar\" -I. -I../test -g -O2 -c -o b.o `test -f
src/b/b.c || echo '../test/'`src/b/b.c
source='src/c/c.cc' object='c.o' libtool=no \
depfile='.deps/c.Po' tmpdepfile='.deps/c.TPo' \
depmode=gcc /bin/sh ../test/depcomp \
g++ -DPACKAGE=\"foo\" -DVERSION=\"bar\" -I. -I../test -g -O2 -c -o c.o `test -f
src/c/c.cc || echo '../test/'`src/c/c.cc
rm -f libjunk.a
ar cru libjunk.a a.o b.o c.o
ar: Error: a.o cannot open
: libjunk.a
Paul