Updated Makefile to new methodology
This commit is contained in:
parent
ca8437820c
commit
cf308423fe
1 changed files with 37 additions and 24 deletions
|
|
@ -17,14 +17,14 @@ PROG_NAME = gri_matrix
|
|||
# and from C/C++ separately
|
||||
OBJS = gri_matrix.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,39 +36,53 @@ FORT_LIBS = @FLIBS@
|
|||
# the C++ compiler
|
||||
CXX = @CXX@
|
||||
|
||||
# C++ compile flags
|
||||
ifeq ($(src_dir_tree), 1)
|
||||
CXX_FLAGS = -DSRCDIRTREE @CXXFLAGS@
|
||||
# the directory where Cantera include files may be found.
|
||||
ifeq ($(in_CanteraBuildTree),1)
|
||||
CANTERA_INCROOTDIR=@ctroot@/build/include
|
||||
else
|
||||
CXX_FLAGS = @CXXFLAGS@
|
||||
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
|
||||
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)
|
||||
|
|
@ -78,7 +92,7 @@ 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)
|
||||
|
|
@ -86,7 +100,6 @@ $(PROGRAM): $(OBJS) $(CANTERA_LIBDIR)/libctbase.a
|
|||
# Add an additional target for stability:
|
||||
$(OBJS): $(CANTERA_LIBDIR)/libctbase.a $(CANTERA_LIBDIR)/libthermo.a
|
||||
|
||||
|
||||
# depends target -> forces recalculation of dependencies
|
||||
depends:
|
||||
$(RM) *.d .depends
|
||||
|
|
@ -101,9 +114,9 @@ depends:
|
|||
test:
|
||||
ifeq ($(os_is_win), 1)
|
||||
else
|
||||
@MAKE@ $(PROGRAM)
|
||||
@ @MAKE@ -s $(PROGRAM)
|
||||
endif
|
||||
./runtest
|
||||
@ ./runtest
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJS) $(PROGRAM) $(DEPENDS) .depends
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue