-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
43 lines (32 loc) · 869 Bytes
/
Makefile
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
## ------ language="Make" file="Makefile"
# allow spaces for indenting
.RECIPEPREFIX +=
# find sources
build_dir = ./build
cc_files = $(shell find ./src -name *.cc)
obj_files = $(cc_files:%.cc=$(build_dir)/%.o)
dep_files = $(obj_files:%.o=%.d)
# set compiler
compile = g++
link = g++
# libfmt
fmtlib_lflags = -lfmt
# eigen3
eigen_lflags = $(shell pkg-config --libs eigen3)
eigen_cflags = $(shell pkg-config --cflags eigen3)
# compile and link flags
compile_flags = -g -O3 -std=c++17 -Wall -Werror $(eigen_cflags) -I./include
link_flags = $(fmt_lflags) $(eigen_lflags)
# rules
.PHONY: clean build
build: parareal
clean:
rm -rf $(build_dir)
-include $(dep_files)
$(build_dir)/%.o: %.cc Makefile
@mkdir -p $(@D)
$(compile) $(compile_flags) -MMD -c $< -o $@
parareal: $(obj_files)
@mkdir -p $(@D)
$(link) $^ $(link_flags) -o $@
## ------ end