[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Mixing BUILT_SOURCES, double quote include and separation of source
Gary V. Vaughan
Re: Mixing BUILT_SOURCES, double quote include and separation of source and binary directory
Wed, 30 Mar 2005 16:14:12 +0100
Mozilla Thunderbird 1.0 (Macintosh/20041206)
Simon Perreault wrote:
> 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.  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/Makefile.am contains something like this:
> BUILT_SOURCES = ../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?
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,gnu.org}
Research Scientist ( '/ http://tkd.kicks-ass.net
GNU Hacker / )= http://www.gnu.org/software/libtool
Technical Author `(_~)_ http://sources.redhat.com/autobook
Description: OpenPGP digital signature