[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Generating sources

From: Roger Leigh
Subject: Generating sources
Date: Mon, 26 Jan 2004 22:59:50 +0000
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux)

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

foo.ccg ->
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 $@ $^ %.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


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.h \

If I touch foo.ccg, 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 Leigh

                Printing on GNU/Linux?
                GPG Public Key: 0x25BFB848.  Please sign and encrypt your mail.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]