So I’m currently attempting to write an mpd decoder that uses Blargg’s game music emulation libraries. Originally I was coding it in C++, but it seems in their latest svn they have stopped supporting the C++ interface and now only support the C interface. Sigh…
So I converted all my code to use the C interface, thankfully it took less time than I expected. Most of mpd’s codebase uses plain C anyway, so maybe it will be for the better when I submit my patch.
After I changed the file extension from .cxx to .c, it was time to change the autotools configuration files so that wily bunch knows this is c and not c++. So pewpewpew get rid of the check for the C++ compiler for my file and change some more extensions. After an autoreconf -i to regenerate the configure script and Makefile.in I attempt to compile, and I get this:
make[1]: *** No rule to make target `src/decoder/gme_decoder_plugin.cxx', needed by `src/decoder/src_mpd-gme_decoder_plugin.o'. Stop.
wat
But there is no gme_decoder_plugin.cxx anymore!
I furiously type make clean and autoreconf -i over and over but no cigar. Still get the same error. Hmm maybe I need to run some other programs that begin with auto*.
So I try automake. This output catches my eye:
automake-1.11: Sources ending in .c become .o automake-1.11: Sources ending in .c become .obj automake-1.11: reading /usr/share/automake-1.11/am/lang-compile.am automake-1.11: Sources ending in .cxx become .o automake-1.11: Sources ending in .cxx become .obj
Perhaps this could be a problem for tracking dependencies, since both .c and .cxx will end up with the same extension when compiled into object files?
Then I noticed another automake option:
Dependency tracking:
-i, --ignore-deps disable dependency tracking code
--include-deps enable dependency tracking code
I tried automake with the -i option, and blingblong everything is gravy. So as far as I can tell, the dependency tracking decided the gme_decoder_plugin.o file’s dependency was still gme_decoder_plugin.cxx when it tried to generate the Makefile.in from Makefile.am.
However, I ran ‘make clean’ several times before to try to solve the problem, therefore deleting the .o file. How exactly does automake track dependencies then?