List Info

Thread: Makefile for project and library




Makefile for project and library
country flaguser name
France
2008-02-11 04:40:58
I have a project (call it AMMPricer) that also includes a
(static)  
library (i.e. the project needs to be linked against the
static  
lib).  Obviously the library must be compiled first and
installed and  
then the project must be linked against the static library. 
The  
directory structure for the code is:

Project  (main dir)

(subdirs)
src
lib

(lib and src are subdirs of Project).  'src' contains the
source code  
for the project and 'lib' contains the code for the static
library.   
I know I must put Makefile.am in each of the subdirectories
and a  
Makefile in the Project directory.  Here's what I have so
far:

In the 'src' directory the Makefile.am is:

AMMPricerprgdir = ../
AMMPricer_PROGRAMS = AMMPricer
AMMPricer_SOURCES = main.cpp LatticeClass.cpp NodeClass.cpp 

SingleConstantBarrier.cpp TreeGraft.cpp
  TrinomialTree.cpp
AM_CXXFLAGS = $(INTI_CFLAGS)
AMMPricer_LDADD = $(INTI_LIBS)


In the project directory, the Makefile.am is currently
only:

SUBDIRS = src lib


The problem I am stuck on is that I have to build and
install the  
static library in 'lib' before building the project in
'src'.  I'm  
relatively new to Makefiles and so have no real idea how to
do this.   
Can anyone shed some light on this?  I'd like to package
both the  
library and the project together rather than as separate
projects.   
I'd like to use AutoTools on all this, but definitely need
some help.

Thanks for any input,

John.


_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make

Re: Makefile for project and library
user name
2008-02-12 08:48:54
On Mon, 2008-02-11 at 11:40 +0100, John Theal wrote:
> Project  (main dir)
> 
> (subdirs)
> src
> lib

This is really an automake question, not a GNU make
question.  You can
ask the automake folks by email automakegnu.org. 
The simple answer is
to just redefine SUBDIRS like this:

        SUBDIRS = lib src

so that lib is built first.  However, in normal make that
won't work if
you build in parallel, since some parts of src might be
built before all
of lib is complete.  I don't know enough about this aspect
of automake
to tell you whether it will work properly in parallel with
their
makefiles.

-- 
------------------------------------------------------------
-------------------
 Paul D. Smith <psmithgnu.org>          Find
some GNU make tips at:
 http://www.gnu.org        
             http://make.mad-scientis
t.us
 "Please remain calm...I may be mad, but I am a
professional." --Mad Scientist


_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )