-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
88 lines (58 loc) · 2.18 KB
/
Makefile
File metadata and controls
88 lines (58 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
OOQP=./OOQP-0.99.26
OOQPINCLUDEDIR=$(OOQP)/include
OOQPLIBDIR=$(OOQP)/lib
GFORTRANLIB=/usr/local/gfortran/lib
CFLAGS = $(shell gsl-config --cflags)
CFLAGS += -O3 -I include -I /include
CFLAGS += -I$(OOQPINCLUDEDIR)
#DIRECTORY TO SEARCH FOR LIBS
LDFLAGS =-L$(OOQPLIBDIR) -L$(GFORTRANLIB)
MA27LIB = -L$(OOQP)/
#For MAC users, specify directories for quadmath, stdc++, libm, and gfortran--not needed!
#GCCLIB = /usr/local/gfortran/lib/gcc/x86_64-apple-darwin14/4.9.2
#GFLIB = /usr/local/gfortran/lib
#For LINUX users, specify directories for blas (or g2c), stdc++, libm, and gfortran. The numbered versions here will need to be updated.
LINGCC = /usr/lib/gcc/x86_x64-redhat-linux/4.1.2
GFLIB =
BLAS =
#Replace -lblas with lg2c if necessary
FLIBSLIN = -L$(LINGCC) -L$(BLAS) -L$(GFLIB) -lgfortran -lm -lstdc++ -lblas -lg2c
FLIBSMAC = -L/opt/local/lib/gcc10/gcc/x86_64-apple-darwin18/10.1.0 -L/opt/local/lib/gcc10/gcc/x86_64-apple-darwin18/10.1.0/../../.. -lgfortran -lquadmath -lm -lstdc++ -framework accelerate
#-lgfortran -lquadmath -lm -lstdc++ -framework accelerate
LIBS = $(shell gsl-config --libs)
LIBS += $(MA27LIB)
LIBS2 = -looqpgensparse -looqpsparse -looqpgondzio -looqpbase -lma27 $(LIBS)
CC = g++
BDIR = bin
ODIR = obj
SDIR = subroutines
EDIR = EXES
OS := $(shell uname)
ifeq ($(OS),Linux)
_OBJS = $(shell ls $(SDIR)/*.cpp | xargs -n 1 basename | sed -r 's/(\.cc|.cpp)/.o/')
LIBS +=$(FLIBSLIN)
else
_OBJS = $(shell ls $(SDIR)/*.cpp | xargs -n 1 basename | sed -E 's/(\.cc|.cpp)/.o/')
LIBS +=$(FLIBSMAC)
endif
_EXECUTABLES = stoich_balance_knockdowns.exe \
## stoich_balance.exe \
##look to find all subroutines
OBJS = $(patsubst %,$(ODIR)/%,$(_OBJS))
EXECUTABLES = $(patsubst %,$(BDIR)/%,$(_EXECUTABLES))
_SOURCES = ${_EXECUTABLES:=.cpp}
SOURCES = $(patsubst %,$(EDIR)/%,$(_SOURCES))
all: dirs $(EXECUTABLES)
$(ODIR)/%.o: $(SDIR)/%.cpp
@echo "Compiling $<"
$(CC) $(CFLAGS) -c $< -o $@
@echo "------------"
$(EXECUTABLES): $(OBJS)
@echo "Compiling $(EDIR)/$(@F:.exe=.cpp)"
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(EDIR)/$(@F:.exe=.cpp) $(OBJS) $(LIBS2)
@echo "------------"
dirs:
mkdir -p bin
mkdir -p obj
clean:
rm -f $(ODIR)/*.o $(EXECUTABLES)