automake
[Top][All Lists]
Advanced

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

Re: Extending automake


From: Jan Kratochvil
Subject: Re: Extending automake
Date: Mon, 2 Aug 2004 09:19:54 +0200
User-agent: Mutt/1.4.1i

Hi,

On Sun, 01 Aug 2004 21:47:36 +0200, Chris Lee wrote:
...
> Even removing the ability to provide the foo_METASOURCES = AUTO would be
> fine with me if I could at least do 'foo_METASOURCES = foo.moc bar.moc'
> but at the moment I still don't quite grok how to do that.

In such case you can use:

bin_PROGRAMS=foo
foo_SOURCES= \
        foo.c \
        foo.h

.c.moc:
        moc $< -o $@

.h.moc:
        moc $< -o $@

BUILT_SOURCES = $(shell cat $(foo_SOURCES) | sed -n 
's/^\#.*include.*"\(.*[.]moc\)".*$$/\1/p')


Although there is a GNU make dependency on $(shell ...). I hope the
cross-make(1) compatible way is:


bin_PROGRAMS=foo
foo_SOURCES= \
        foo.c \
        foo.h

.c.moc:
        moc $< -o $@

.h.moc:
        moc $< -o $@

BUILT_SOURCES = built_sources
.PHONY: built_sources

./$(DEPDIR)/.moc_deps: $(foo_SOURCES)
        cat $(foo_SOURCES) | sed -n 
's/^\#.*include.*"\(.*[.]moc\)".*$$/built_sources: \1/p' >$@

include ./$(DEPDIR)/.moc_deps


There is a GNU make(1) warning message
        Makefile:1170: .deps/.moc_deps: No such file or directory

, I hope some non-GNU make(1)s do not bail out on this; AFAIK automake(1) also
uses this approach.


Regards,
Lace

P.S.: It is not fair to reply offlist mails not intended for the list to the
      list.

-- 
Jan Kratochvil; Captive: free r/w NTFS Filesystem; http://www.jankratochvil.net/




reply via email to

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