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/Makefile.am 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/Makefile.am: AM_CPPFLAGS = -I$(srcdir)/../include -I../include Or if include and src are immediate children of the directory containing configure.ac: AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include HTH, Gary. -- Gary V. Vaughan ())_. [EMAIL PROTECTED],gnu.org} Research Scientist ( '/ http://tkd.kicks-ass.net GNU Hacker / )= http://www.gnu.org/software/libtool Technical Author `(_~)_ http://sources.redhat.com/autobook
signature.asc
Description: OpenPGP digital signature