[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Adding BUILT_SOURCES to a multi-directory, non-recursive project
From: |
Alexandre Duret-Lutz |
Subject: |
Re: Adding BUILT_SOURCES to a multi-directory, non-recursive project |
Date: |
Sat, 04 Mar 2006 07:56:07 +0100 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux) |
>>> "DG" == Duncan Gibson <address@hidden> writes:
[...]
DG> # autotools object to --libs, FLTK_LIBRARIES & FLTK_LDFLAGS :-(
DG> # FLTK_CXXFLAGS = `fltk-config --cxxflags`
DG> # FLTK_LIBRARYS = `fltk-config --libs`
DG> # FLTK_LDSFLAGS = `fltk-config --ldstaticflags`
You could AC_SUBST these variables from configure.ac (after
ensuring that fltk-config exists). It's better anyway: this way you
don't run `fltk-config --cxxflags` for each compilation.
[...]
DG> AM_CPPFLAGS = -I$(srcdir)/src $(FLTK_CXXFLAGS)
DG> .fl.h:
DG> fluid -c $<
DG> .fl.cxx:
DG> fluid -c $<
DG> BUILT_SOURCES += src/foo.h
DG> src_libfoo_a_SOURCES = src/foo.fl
DG> src_foo_test_LDADD = src/libfoo.a $(FLTK_LIBRARYS)
DG> src_foo_test_LDFLAGS = $(FLTK_LDSFLAGS)
DG> src_foo_test_SOURCES = src/foo_test.cxx
DG> My problem is that if I create a separate build directory, and run
DG> sh ../configure and make in there, the make fails with
DG> find g++: src/foo.cxx: No such file or directory
("find g++"? I'll assume it's a typo.)
[...]
DG> If I run 'fluid -c foo.fl' manually in the src directory, then I can
DG> run make successfully
Yeah, but your Makefile does not run fluid from the src/ directory, it
runs it from the top-level directory.
I guess fluid builds foo.cxx and foo.h in the current directory,
doesn't it? I hope fluid has some options to help you specify that
the files should be output in src/ (if you do not plan distributing them)
or $(srcdir)/src/ (if you plan to) rather than in the current directory.
Otherwise you'll have to move them (if it wasn't a suffix rule you could
also cd in the right directory before running fluid).
DG> Once I've solved this basic problem, I have another issue to address.
DG> I need to be able to tweak foo.h once it has been created by fluid.
DG> In a standard makefile I could use:
DG> foo.h foo.cxx: foo.fl
DG> fluid -c foo.fl
DG> mv foo.h foo.h.tmp
DG> sed 's/old/new/' foo.h.tmp > foo.h
DG> Can I still do that here?
Sure. But
1) you should try not to create foo.h before the rule finishes (if it's
possible to have fluid create foo.h.tmp directly, that's better)
2) you will want to find a way to mix this with the
idiom described in the Automake FAQ under "Handling Tools that
Produce Many Outputs".
Probably something along the lines of
.fl.cxx:
fluid -c $< + options to get src/$*.{cxx,h.tmp}
sed whatever $*.h.tmp > $*.h
src/foo.h: src/foo.cxx
@if test ! -f \$@; then \
rm -f src/foo.cxx; \
$(MAKE) $(AM_MAKEFLAGS) src/foo.cxx; \
else :; fi
DG> Should I even be using the .fl.cxx suffix
DG> rules as I am doing at the moment, or should I be using SUFFIXES?
SUFFIXES is something you use in addition to suffix rules to support
weird extensions (not starting with one dot, or with more than one).
Not your case.
--
Alexandre Duret-Lutz
Shared books are happy books. http://www.bookcrossing.com/friend/gadl