[Top][All Lists]

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

Re: Mixing BUILT_SOURCES, double quote include and separation of source

From: Gary V. Vaughan
Subject: Re: Mixing BUILT_SOURCES, double quote include and separation of source and binary directory
Date: Wed, 30 Mar 2005 16:14:12 +0100
User-agent: Mozilla Thunderbird 1.0 (Macintosh/20041206)

Simon Perreault wrote:
> Hi,
> I have a problem which I figure must be fairly common, although I found no
> reference to it anywhere. I think it must be common because the SCons manual
> says they fixed it. [1] Anyway...
> Let's say I have two directories, "src" and "include". I place main.c in src
> and inc.h in include. main.c includes inc.h this way:
> #include "../include/inc.h"
> and inc.h includes built.h this way:
> #include "built.h"
> Now, my src/ contains something like this:
> BUILT_SOURCES = ../include/built.h
> ../include/built.h:
>       mkdir -p $(@D)
>       touch $@
> Everything works fine as long as I am building in the source directory. If I
> make a build directory and invoke configure and make from that directory,
> inc.h can't find built.h. And that's normal, since built.h is in
> build/include instead of include. Because it is not in the same directory as
> inc.h, including it using double quotes can't work.
> The quick fix is to add the location of inc.h, prefixed with $(top_builddir).
> However, in my real project I have hundreds of such files with hundreds of
> such locations. I would quickly hit the limit on command-line arguments.
> How should I fix this problem?

In src/

  AM_CPPFLAGS = -I$(srcdir)/../include -I../include

Or if include and src are immediate children of the directory containing

  AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include

Gary V. Vaughan      ())_.  address@hidden,}
Research Scientist   ( '/
GNU Hacker           / )=
Technical Author   `(_~)_

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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