help-make
[Top][All Lists]
Advanced

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

Makefile for project and library


From: John Theal
Subject: Makefile for project and library
Date: Mon, 11 Feb 2008 11:40:58 +0100

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.




reply via email to

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