[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

non-recursive automake advice?

From: tom fogal
Subject: non-recursive automake advice?
Date: Mon, 29 Aug 2005 18:56:10 -0400

So I've been convinced that the effort involved in changing a build
system to not use recursive make is worth it, and I was wondering if
anyone had some good advice as to how I should go about doing this,
since my way seems to be having issues =).

I have a directory setup like the following:


with in the /, and a in the root that just
recurses into /src/ and /tests/ (okay, so its not \emph{completely}
non-recursive...).  Each subdirectory off of /src/ is essentially its
own self-contained module, or at least thats the hope/plan.

Basically I'd like each module to build their own libtool convenience
library, and then have /src/ link all of those modules'
convenience libraries into one that is the union of all of them.
Without recursive make this is a little strange, but I've devised a
scheme to make each module 'feel' like it has its own, local, by playing with includes.

Each module gets its own ''.  In /src/, I setup
noinst_LTLIBRARIES, noinst_HEADERS, and BUILT_SOURCES.  Then I include
every modules' '':

#### /src/ ####
AM_CFLAGS=-I$(srcdir)/input/ -I$(srcdir)/share/ -I$(srcdir)/models/

# set variables before the includes, so include can append to the
# existing setup and not get overwritten later.
noinst_HEADERS=jf_read.h jf_data.h bfield.h jf_bfield.h cmd_line.h

include $(srcdir)/models/
include $(srcdir)/share/
include $(srcdir)/input/

libCur_la_SOURCES = cmd_line.c consts.c bfield.c jf_bfield.c jf_read.c\

libAll_la_LIBADD = \
        $(srcdir)/models/ \
        $(srcdir)/share/ \
        $(srcdir)/input/ \


gcpt_LDADD = \ \
        -ly -lfl
#### /src/ ####

In all of the modules' '' files, I do some sort of
'' (note the plus-equals, not just
equals).  This appears to work, insofar as 'autoreconf' doesn't yell at
me for doing something dumb.

Unfortunately in the '' files I need to remember to qualify every
filename with not just '$(srcdir)', but
'$(srcdir)/modules_directory_name/'.  This is only a minor annoyance
and definitely worth the trouble, but perhaps I am missing something?

Anyway my real issue is that I just can't get the build system to find
the module-archives correctly.  If I do (for example):

#### /src/models/ ####
noinst_LTLIBRARIES += $(srcdir)/models/

libModels_la_SOURCES = ...
#### /src/models/ ####

Then automake complains that I made a typo.  It sounds like its not
recognizing that 'libModels_la_SOURCES' is associated with

src/models/ variable `libModels_la_SOURCES' is defined but no program 
src/models/ library has `libModels_la' as canonic name (possible typo)
src/   `src/models/' included from here

However if I do NOT qualify with '$(srcdir)/models/',
then autoreconf completes fine.  Then when I go to 'make', make
complains that it doesn't know how to build

make[2]: Entering directory `/home/tfogal/tracer/src'
make[2]: *** No rule to make target `models/', needed by
`'.  Stop.
make[2]: Leaving directory `/home/tfogal/tracer/src'

Which is true according to the generated 'Makefile' -- it knows how to
generate '', not 'models/'.

Am I going about this completely the wrong way?  Is there some software
I can look at for an example of a 'correct' way to do this?

Thanks for any help / advice you can offer.  I also appreciate any
stylistic / readability / other advice beyond just "what'll make it


reply via email to

[Prev in Thread] Current Thread [Next in Thread]