[Top][All Lists]

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

Re: builddir vs. srcdir

From: Stepan Kasal
Subject: Re: builddir vs. srcdir
Date: Wed, 9 Mar 2005 11:34:38 +0100
User-agent: Mutt/1.4.1i


On Tue, Mar 08, 2005 at 11:56:56PM +0200, Paul Pogonyshev wrote:
> because the generated sources are placed into the build directory,
> while `make' looks for them in the source directory.

generally, make should look for them in both places.

Let me point out several problems:

> BUILT_SOURCES =               \
>       foo.c           \
>       foo.h

You probably need only the foo.h file here.

> foo.c foo.h : $(srcdir)/foo.list $(PARSE_LIST)
>       $(PARSE_LIST) $(srcdir)/foo.list foo.h foo.c    \
>         || (rm -f foo.c foo.h ; exit 1)

This rule can break with parallel make.

For details about these two issues, see

You can solve the second issue by adding the dependency:
foo.c: foo.h

Yet it might be more readable if you change your generator so that it
would generate .c and .h in separate runs.

And I'd like to suggest that you use SUFFIXES to handle the .list
source.  Please look at the following example:


libgoffice_utils_la_SOURCES =   \
        go-marshalers.list      \

CLEANFILES =                    \
        go-marshalers.h         \

# A hint is needed to build the header first:
BUILT_SOURCES = go-marshalers.h

SUFFIXES = .list

        $(GENMARSHAL_COMMAND) --header $< >$@

        (echo '/* This file has been automatically generated.  Do not edit. */' 
&& \
        echo '#include "$*.h"' && \
        $(GENMARSHAL_COMMAND) --body $< ) >$@

This works with current Automake 1.9.5 (which I recommend),
as well as an ancient 1.7.x version.

        Stepan Kasal

reply via email to

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