In a project, I am preprocessing the C++ source and headers.  That is:

foo.ccg -> foo.cc
foo.hg -> foo.h

Some custom m4 I wrote processes the files with some simple rules:

$(top_builddir)/build/classgen.m4f: $(top_srcdir)/build/classgen.m4
        $(M4) -P -F $@ $^

%.cc: %.ccg $(top_builddir)/build/classgen.m4f
        $(M4) -P -R $(top_builddir)/build/classgen.m4f $< > $@

%.h: %.hg $(top_builddir)/build/classgen.m4f
        $(M4) -P -R $(top_builddir)/build/classgen.m4f $< > $@


Now the complex part ;-)

If I have, in my Makefile.am:

lib_LTLIBRARIES = libfoo.la

libfoo_la_pre_sources = \
        foo.ccg \
        foo.hg \
 
libfoo_la_post_sources = \
        $(addsuffix .cc,$(basename $(filter %.ccg,$(libfoo_la_pre_sources)))) \
        $(addsuffix .h,$(basename $(filter %.hg,$(libfoo_la_pre_sources))))
 
libfoo_la_SOURCES = \
        $(libfoo_la_pre_sources) \
        $(libfoo_la_post_sources) \
        bar.cc \
        bar.h \

If I touch foo.ccg, foo.cc is regenerated and foo.lo rebuilt.
However, if I touch foo.hg, foo.h is not rebuilt, which is causing
problems (I need to do a manual "make foo.h" every time I alter
foo.hg).  How should I make this automatic?  I thought the above rules
would be sufficient, but it does not appear so.


Many thanks,
Roger

-- 
Roger Leigh

                Printing on GNU/Linux?  http://gimp-print.sourceforge.net/
                GPG Public Key: 0x25BFB848.  Please sign and encrypt your mail.


Reply via email to