automake
[Top][All Lists]
Advanced

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

Re: builddir vs. srcdir


From: Paul Pogonyshev
Subject: Re: builddir vs. srcdir
Date: Wed, 9 Mar 2005 23:21:35 +0200
User-agent: KMail/1.4.3

Stepan Kasal wrote:
> Hello,
>
> 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.

Yes, and it does look in both places, but the dependencies make `foo.o'
depend on `$(srcdir)/foo.c', so `make' tells it has no rule to build the
latter.  How do I make dependencies tell `foo.o' depends on
`$(builddir)/foo.c' instead?

> Let me point out several problems:
> > BUILT_SOURCES =             \
> >     foo.c           \
> >     foo.h
>
> You probably need only the foo.h file here.

Right.

> > 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
> http://sources.redhat.com/automake/automake.html#Built-sources-example
>
> 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.

I'd hate to hack the generator for such a goal.  I'll better stick with
the `foo.c: foo.h' solution.  Maybe generating two files at once is non-
standard, but it seems natural, since they are so closely related and
are built from one source file, and that's the way it works already.

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

Well, my generator is even more non-standard, since I need to pass an
additional command-line parameter sometimes.  So, `SUFFIXES' are not an
option, although I agree it would have been nicer to use them.

Paul





reply via email to

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