Made the makefile.in usable from both the build and the install

directory trees.
This commit is contained in:
Harry Moffat 2008-01-06 19:30:15 +00:00
parent b322a0be28
commit 1fb1c4367d
2 changed files with 36 additions and 33 deletions

View file

@ -17,14 +17,14 @@ PROG_NAME = basopt_red1
# and from C/C++ separately
OBJS = basopt_red1.o
# Location of the current build. Will assume that tests are run
# in the source directory tree location
src_dir_tree = 0
# additional flags to be passed to the linker. If your program
# requires other external libraries, put them here
LINK_OPTIONS = @EXTRA_LINK@
# This variable determines whether we are making this example in the
# build tree environment or in the install tree environment.
in_CanteraBuildTree = 1
#############################################################################
# Check to see whether we are in the msvc++ environment
@ -36,42 +36,53 @@ FORT_LIBS = @FLIBS@
# the C++ compiler
CXX = @CXX@
# the directory where Cantera include files may be found.
ifeq ($(in_CanteraBuildTree),1)
CANTERA_INCROOTDIR=@ctroot@/build/include
else
CANTERA_INCROOTDIR=@ct_incroot@
endif
CANTERA_INCLUDES=-I$(CANTERA_INCROOTDIR) -I$(CANTERA_INCROOTDIR)/cantera
# LOCAL_DEFS = -DDEBUG_CHEMEQUIL
# LOCAL_DEFS = -DEBUG_BASISOPTIMIZE
#
# C++ compile flags
ifeq ($(src_dir_tree), 1)
CXX_FLAGS = -DSRCDIRTREE @CXXFLAGS@
else
CXX_FLAGS = @CXXFLAGS@
endif
CXX_FLAGS = @CXXFLAGS@ $(CANTERA_INCLUDES) $(LOCAL_DEFS)
# Ending C++ linking libraries
LCXX_END_LIBS = @LCXX_END_LIBS@
# the directory where the Cantera libraries are located
ifeq ($(in_CanteraBuildTree),1)
CANTERA_LIBDIR=@buildlib@
# required Cantera libraries
CANTERA_LIBS = @LOCAL_LIBS@ -lctcxx
# the directory where Cantera include files may be found.
ifeq ($(src_dir_tree), 1)
CANTERA_INCDIR=../../Cantera/src
else
CANTERA_INCDIR=@ctroot@/build/include/cantera
CANTERA_LIBDIR=@ct_libdir@
endif
# required Cantera libraries
CANTERA_LIBS = -L$(CANTERA_LIBDIR) @LOCAL_LIBS@ -lctcxx
ifeq ($(in_CanteraBuildTree),1)
CANTERA_LIBS_DEP = @LOCAL_LIBS_DEP@ $(CANTERA_LIBDIR)/libctcxx.a
else
CANTERA_LIBS_DEP = @INSTALL_LIBS_DEP@ $(CANTERA_LIBDIR)/libctcxx.a
endif
#
# Alternate form of dependencies: (uses a gnu make extensions)
ALT_LIBS_DEP := $(addprefix $(CANTER_LIBDIR), @RAW_LIBS_DEP@ libctcxx.a)
# flags passed to the C++ compiler/linker for the linking step
LCXX_FLAGS = -L$(CANTERA_LIBDIR) @LOCAL_LIB_DIRS@ @CXXFLAGS@
LCXX_FLAGS = @CXXFLAGS@
# How to compile C++ source files to object files
.@CXX_EXT@.@OBJ_EXT@:
$(CXX) -c $< -I$(CANTERA_INCDIR) $(CXX_FLAGS)
.cpp.o:
$(CXX) -c $< $(CXX_FLAGS)
# How to compile the dependency file
.cpp.d:
@CXX_DEPENDS@ -I$(CANTERA_INCDIR) $(CXX_FLAGS) $*.cpp > $*.d
@CXX_DEPENDS@ $(CXX_FLAGS) $*.cpp > $*.d
# List of dependency files to be created
DEPENDS=$(OBJS:.o=.d)
@ -81,12 +92,11 @@ PROGRAM = $(PROG_NAME)$(EXE_EXT)
all: $(PROGRAM)
$(PROGRAM): $(OBJS) $(CANTERA_LIBDIR)/libctbase.a
$(PROGRAM): $(OBJS) $(CANTERA_LIBS_DEP)
$(CXX) -o $(PROGRAM) $(OBJS) $(LCXX_FLAGS) $(LINK_OPTIONS) \
$(CANTERA_LIBS) @LIBS@ $(FORT_LIBS) \
$(LCXX_END_LIBS)
# Add an additional target for stability:
$(OBJS): $(CANTERA_LIBDIR)/libctbase.a $(CANTERA_LIBDIR)/libthermo.a

View file

@ -5,16 +5,9 @@
*
*/
#ifdef SRCDIRTREE
#include "ct_defs.h"
#include "ThermoPhase.h"
#include "IdealGasMix.h"
#include "equil.h"
#else
#include "Cantera.h"
#include "IdealGasMix.h"
#include "equilibrium.h"
#endif
#include "cantera/Cantera.h"
#include "cantera/IdealGasMix.h"
#include "cantera/equilibrium.h"
using namespace std;
using namespace Cantera;