Search code examples
c++autotoolslibtool

automake dependency tracking for nonstandard C++ suffix


how can i force automake to generate dependency tracking for nonstandard C++ suffix files? in particular I mean generating .deps directory file content. I am using libtool as well.

Thanks


Solution

  • Take a look at this section in the automake manual regarading default _SOURCES. It looks like saying:

    bin_PROGRAMS = target
    AM_DEFAULT_SOURCE_EXT = .foo
    

    will get you past the first step. So, now automake knows where to look for the first dependency (target.foo), and it will ask GCC to compute the dependencies of target.foo based upon the header file names that are included in that file. GCC spits out the inferred object names, transforming the included stem.h -> stem.o. And here's where I hit a wall. To have your automake script be completely portable, you cannot use the % patterns. You must use the suffix stacking, as wallyk demonstrated in his answer.

    Depending upon your portability requirements, you could just ignore that and define the implicit rule in Makefile.in to be something like:

    %.o : %.foo
        $(CXX) -o $@ -c $(CPPFLAGS) $(CXXFLAGS) $<
    

    If portability is a strict requirement I'm afraid you're out of luck without a lot of hacking.