-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
122 lines (98 loc) · 4.17 KB
/
Makefile
File metadata and controls
122 lines (98 loc) · 4.17 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
## Makefile for C++ project using Boost
#
# @author Cedric "levif" Le Dillau
# @modified Aroli Marcellinus
#
# Some notes:
# - Using ':=' instead of '=' assign the value at Makefile parsing time,
# others are evaluated at usage time. This discards
# - Use ':set list' in Vi/Vim to show tabs (Ctrl-v-i force tab insertion)
#
# List to '.PHONY' all fake targets, those that are neither files nor folders.
# "all" and "clean" are good candidates.
.PHONY: all, clean
LIBCML_DIR = ../libCML/
LIBCML_INC_DIR = ../libCML/src
LIBCML_LIB_DIR = ../libCML/build
LIBCML_EXTERNAL_LIB_DIR = ../libCML/libs
# Define the final program name
BASE_PROGNAME := drugsim
# Pre-processor flags to be used for includes (-I) and defines (-D)
CPPFLAGS := -I./ -I$(LIBCML_INC_DIR) -I$(LIBCML_EXTERNAL_LIB_DIR)/sundials-5.7.0/include
# CXX to set the compiler
CXX := mpicxx
# CC to set the compiler
CC := mpicc
# Uncomment this part for the licensed version
#CXXFLAGS += -DLICENSED
# CXXFLAGS is used for C++ compilation options.
#CXXFLAGS += -Wall -O0 -fpermissive -std=c++11
#CXXFLAGS += -Wall -O2 -fno-alias -fpermissive
#CXXFLAGS += -Wall -Wunused-variable
CXXFLAGS += -Wall -Wunused-variable -std=c++11
# Uncomment this part for the compilation of postprocessing binaries
#CXXFLAGS += -DPOSTPROCESSING
# Uncomment this part for enabling some files for debugging
#CXXFLAGS += -DCMLDEBUG
# The program name wiil depend on the set value above
# Make sure ONLY ONE MACRO IS USED!!!
ifeq ($(findstring -DTOR_ORD_LAND,$(CXXFLAGS)), -DTOR_ORD_LAND)
PROGNAME := $(BASE_PROGNAME)_ToR-ORd_Land
else ifeq ($(findstring -DCIPAORDV1_LAND,$(CXXFLAGS)), -DCIPAORDV1_LAND)
PROGNAME := $(BASE_PROGNAME)_CiPAORdv1.0_Land
else ifeq ($(findstring -DORD_STATIC_LAND,$(CXXFLAGS)), -DORD_STATIC_LAND)
PROGNAME := $(BASE_PROGNAME)_ORd-static_Land
else ifeq ($(findstring -DCIPAORDV1,$(CXXFLAGS)), -DCIPAORDV1)
PROGNAME := $(BASE_PROGNAME)_CiPAORdv1.0
else ifeq ($(findstring -DTOR_ORD_DYNCL,$(CXXFLAGS)), -DTOR_ORD_DYNCL)
PROGNAME := $(BASE_PROGNAME)_ToR-ORd-dynCl
else ifeq ($(findstring -DTOR_ORD,$(CXXFLAGS)), -DTOR_ORD)
PROGNAME := $(BASE_PROGNAME)_ToR-ORd
else ifeq ($(findstring -DGRANDI,$(CXXFLAGS)), -DGRANDI)
PROGNAME := $(BASE_PROGNAME)_Grandi
else
PROGNAME := $(BASE_PROGNAME)_ORd-static
endif
ifeq ($(findstring -DPOSTPROCESSING,$(CXXFLAGS)), -DPOSTPROCESSING)
PROGNAME := $(PROGNAME)_postprocessing
endif
# LDFLAGS is used for linker (-g enables debug symbols)
LDFLAGS += -g $(LIBCML_LIB_DIR)/libcml.a $(LIBCML_EXTERNAL_LIB_DIR)/sundials-5.7.0/lib64/libsundials_cvode.a $(LIBCML_EXTERNAL_LIB_DIR)/sundials-5.7.0/lib64/libsundials_nvecserial.a -L/usr/lib64 -lcurl -ljson-c
# List the project' sources to compile or let the Makefile recognize
# them for you using 'wildcard' function.
#
SOURCES = $(wildcard **/*.cpp) $(wildcard **/*.c) main.cpp
# List the project' headers or let the Makefile recognize
# them for you using 'wildcard' function.
#
HEADERS = $(wildcard **/*.hpp) $(wildcard **/*.h)
# Construct the list of object files based on source files using
# simple extension substitution.
OBJECTS := $(SOURCES:%.cpp=%.o)
#
# Now declare the dependencies rules and targets
#
# Starting with 'all' make it becomes the default target when none
# is specified on 'make' command line.
all : $(PROGNAME)
# Declare that the final program depends on all objects and the Makfile
$(PROGNAME) : $(OBJECTS) Makefile
$(CXX) -o bin/$@ $(OBJECTS) $(LDFLAGS)
# Now the choice of using implicit rules or not (my choice)...
#
# Choice 1: use implicit rules and then we only need to add some dependencies
# to each object.
#
## Tells make that each object file depends on all headers and this Makefile.
#$(OBJECTS) : $(HEADERS) Makefile
#
# Choice 2: don't use implicit rules and specify our will
%.o: %.cpp $(HEADERS) Makefile
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(OUTPUT_OPTION) $<
# Simple clean-up target
# notes:
# - the '@' before 'echo' informs make to hide command invocation.
# - the '-' before 'rm' command to informs make to ignore errors.
clean :
@echo "Clean."
-rm -rf *.o **/*.o bin/$(PROGNAME)