I have almost the same situation as a post many years ago. The solution didn't
seem to apply, however,
http://www.opensubscriber.com/message/[email protected]/3498366.html
I am using subdir-objects and I have a single, top-level Makefile.am:
#*snip*
BUILT_SOURCES =
lib_LTLIBRARIES = libfoo.la
libfoo_la_SOURCES =
#*snip*
If HAVE_PYTHON
BUILT_SOURCES += foo/bar/wapi.c
foo/bar/wapi.c: foo/bar/papi.h $(top_srcdir)/build-aux/wapi.py
-rm -f foo/bar/wapi.c && \
$(PYTHON) $(top_srcdir)/build-aux/wapi.py $< > foo/bar/wapi.c
libfoo_la_SOURCES += foo/bar/wapi.c
endif
#*snip*
It turns out that $(PYTHON) is located by configure such that HAVE_PYTHON is
true. When I configure and build from a subdirectory within my source tree
e.g. "mkdir bld; cd bld; ../configure" the build fails because make is looking
for the target "../foo/bar/wapi.c" which doesn't exist, and never will, since
it is located in the build tree instead of the source tree (it is a
BUILT_SOURCE, after all, and belongs in the build tree). Further, I require
that the built source be placed in the appropriate subdirectory within my build
tree just like subdir-objects would do (I am using subdir-objects so this makes
sense). I use this strategy for building headers, and then adding
-I$(top_build_prefix)foo to my CPPFLAGS. But this is the only built source
file (*.c) and it fails as I've mentioned:
Make: *** No rule to make target `../foo/bar/wapi.c', needed by
'foo/bar/wapi.lo'. Stop.
What am I doing wrong? Thanks.
__________________________________________________
Jeff Daily
Scientist
Pacific Northwest National Laboratory