From 2a9afa5a61ae327daf73c196bf1d209f9037bbed Mon Sep 17 00:00:00 2001 From: "Victor A. P. Magri" Date: Fri, 29 Mar 2024 22:27:51 -0400 Subject: [PATCH] Update Makefiles --- examples_C++/Makefile | 20 ++++++++++++++++++-- mole_C++/Makefile | 7 ++++++- tests_C++/Makefile | 8 ++++++-- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/examples_C++/Makefile b/examples_C++/Makefile index 60c0b22..026492e 100644 --- a/examples_C++/Makefile +++ b/examples_C++/Makefile @@ -2,18 +2,34 @@ MOLE = ../mole_C++ CXX ?= g++ -CXXFLAGS = -O3 -fopenmp -DARMA_DONT_USE_WRAPPER +ifeq ($(DEBUG),1) +CXXFLAGS = -O0 -g +else +CXXFLAGS = -O3 +endif +CXXFLAGS += -fopenmp -DARMA_DONT_USE_WRAPPER INCPATH = -I. $(if $(ARMA), -I$(ARMA)/include) -I$(MOLE) -LIBS = -L$(MOLE) -lmole $(if $(ARMA), -L$(ARMA)) -larmadillo -lopenblas +#LIBS = -L$(MOLE) -lmole $(if $(ARMA),-L$(ARMA)/lib -Wl,-rpath,$(ARMA)/lib) -larmadillo -lopenblas +LIBS = -L$(MOLE) -lmole + +ifdef ARMA +LIBS += -L$(ARMA)/lib -Wl,-rpath,$(ARMA)/lib -larmadillo -lopenblas +else +$(error ARMA is not defined. Please define ARMA with the path to the Armadillo library.) +endif ifdef EIGEN CXXFLAGS += -DEIGEN INCPATH += -I$(EIGEN) else +ifdef SUPERLU +LIBS += -L$(SUPERLU)/lib -Wl,-rpath,$(SUPERLU)/lib -lsuperlu +else LIBS += -lsuperlu endif +endif all: transport1D schrodinger1D elliptic1D elliptic2D diff --git a/mole_C++/Makefile b/mole_C++/Makefile index e257269..ceababc 100644 --- a/mole_C++/Makefile +++ b/mole_C++/Makefile @@ -1,6 +1,11 @@ CXX ?= g++ -CXXFLAGS = -O3 -fopenmp +ifeq ($(DEBUG),1) +CXXFLAGS = -O0 -g +else +CXXFLAGS = -O3 +endif +CXXFLAGS += -fopenmp INCPATH = -I. $(if $(ARMA), -I$(ARMA)/include) diff --git a/tests_C++/Makefile b/tests_C++/Makefile index 68c786e..e792f61 100644 --- a/tests_C++/Makefile +++ b/tests_C++/Makefile @@ -4,9 +4,13 @@ CXX ?= g++ CXXFLAGS = -O3 -fopenmp -DARMA_DONT_USE_WRAPPER -INCPATH = -I. $(if $(ARMA), -I$(ARMA)/include) -I$(MOLE) +ifdef ARMA +INCPATH = -I. -I$(ARMA)/include -I$(MOLE) +else +$(error ARMA is not defined. Please define ARMA with the path to the Armadillo library.) +endif -LIBS = -L$(MOLE) -lmole $(if $(ARMA), -L$(ARMA)) -larmadillo -lopenblas +LIBS = -L$(MOLE) -lmole -lopenblas all: test1 test2 test3 test4 run