[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Adding BUILT_SOURCES to a multi-directory, non-recursive project
From: |
Duncan Gibson |
Subject: |
Adding BUILT_SOURCES to a multi-directory, non-recursive project |
Date: |
Fri, 03 Mar 2006 10:07:39 +0100 |
I was given help two weeks ago in the thread "Autoconfisticating a
multi-directory, non-recursive, GNU-make specific project"
(see http://lists.gnu.org/archive/html/automake/2006-02/msg00036.html)
Three years ago on this list, I was helped with BUILT_SOURCES in the
thread "How to specify 2 stage build in Makefile.am"
(see http://sources.redhat.com/ml/automake/2002-10/msg00066.html)
Now I want to put them both together, but am having problems. I've
simplified my project down to a single source directory to show what
I want to do, and how far I have got. What I want to happen is:
foo.fl is processed by 'fluid' to give foo.cxx and foo.h
foo.cxx is then compiled and archived in libfoo.a
foo_test.cxx is compiled and linked against libfoo.a
My configure.ac looks like:
AC_PREREQ(2.59)
AC_INIT([foo], [0.0.1], address@hidden)
AM_INIT_AUTOMAKE([1.9 foreign subdir-objects])
AC_CONFIG_SRCDIR([src/foo_test.cxx])
AC_CONFIG_HEADER([config.h])
# Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_RANLIB
# Checks for libraries.
# Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
My Makefile.am looks like:
bin_PROGRAMS =
check_PROGRAMS =
lib_LIBRARIES =
noinst_LIBRARIES =
BUILT_SOURCES =
# autotools object to --libs, FLTK_LIBRARIES & FLTK_LDFLAGS :-(
# FLTK_CXXFLAGS = `fltk-config --cxxflags`
# FLTK_LIBRARYS = `fltk-config --libs`
# FLTK_LDSFLAGS = `fltk-config --ldstaticflags`
FLTK_CXXFLAGS = -O2 -march=i686 -I/usr/X11R6/include
FLTK_LIBRARYS = /usr/lib/libfltk.a
FLTK_LDSFLAGS = -L/usr/X11R6/lib -s /usr/lib/libfltk.a -lm -lXext -lX11
include src/Makefile.am
and my src/Makefile.am looks like:
check_PROGRAMS += src/foo_test
noinst_LIBRARIES += src/libfoo.a
AM_CPPFLAGS = -I$(srcdir)/src $(FLTK_CXXFLAGS)
.fl.h:
fluid -c $<
.fl.cxx:
fluid -c $<
BUILT_SOURCES += src/foo.h
src_libfoo_a_SOURCES = src/foo.fl
src_foo_test_LDADD = src/libfoo.a $(FLTK_LIBRARYS)
src_foo_test_LDFLAGS = $(FLTK_LDSFLAGS)
src_foo_test_SOURCES = src/foo_test.cxx
My problem is that if I create a separate build directory, and run
sh ../configure and make in there, the make fails with
find g++: src/foo.cxx: No such file or directory
I've tried putting explicit dependencies instead of the suffix rules,
and all sorts of variations of src/foo.h, src/foo.cxx and src/foo.fl
in BUILT_SOURCES, src_libfoo_a_SOURCES and nodist_src_libfoo_a_SOURCES
but to no avail. I haven't found the magic combination yet.
If I run 'fluid -c foo.fl' manually in the src directory, then I can
run make successfully in the separate build directory, but that's not
really what I want. I assume that I have some mismatch between the
build directory and $(srcdir) but I can't see how to correct it.
Once I've solved this basic problem, I have another issue to address.
I need to be able to tweak foo.h once it has been created by fluid.
In a standard makefile I could use:
foo.h foo.cxx: foo.fl
fluid -c foo.fl
mv foo.h foo.h.tmp
sed 's/old/new/' foo.h.tmp > foo.h
Can I still do that here? Should I even be using the .fl.cxx suffix
rules as I am doing at the moment, or should I be using SUFFIXES?
Cheers
Duncan
- Adding BUILT_SOURCES to a multi-directory, non-recursive project,
Duncan Gibson <=