/
Makefile
84 lines (70 loc) · 2.73 KB
/
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
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
CC = gcc
CFLAGS:= -std=c99 \
-Wall \
-Wextra \
-pedantic
.PHONY: test
all: test
test:
@mkdir --parents build_aux
$(CC) $(DEV_CFLAGS) -I./modules/log.c/src -DLOG_USE_COLOR -c ./modules/log.c/src/log.c -o build_aux/log.o
$(CC) $(DEV_CFLAGS) -I./modules/Unity/src -DUNITY_INCLUDE_DOUBLE -c ./modules/Unity/src/unity.c -o build_aux/unity.o
$(CC) $(DEV_CFLAGS) -I./modules/num.c/include -c ./modules/num.c/src/new.c -o build_aux/new.o
$(CC) $(DEV_CFLAGS) -I./modules/num.c/include -c ./modules/num.c/src/num.c -o build_aux/num.o
$(CC) $(DEV_CFLAGS) -I./modules/num.c/include -I./modules/log.c/src -c $(DEV_INCDIR) -I./src/include -DM_PI=3.14159265359 -c ./src/qsimp.c -o build_aux/qsimp.o
$(CC) $(DEV_CFLAGS) -I./modules/num.c/include -I./modules/log.c/src -c $(DEV_INCDIR) -I./src/include -DM_PI=3.14159265359 -c ./src/qtanhsinh.c -o build_aux/qtanhsin.o
$(CC) $(DEV_CFLAGS) -I./include -I./modules/num.c/include -I./modules/log.c/src -c $(DEV_INCDIR) -I./src/include -DM_PI=3.14159265359 -c ./src/integration.c -o build_aux/integration.o
$(CC) $(DEV_CFLAGS) $(DEV_INCDIR) \
-I./modules/log.c/src \
-I./modules/Unity/src \
-I./modules/num.c/include \
-I./src -I./test -I./include \
$(DEV_INCDIR) \
-DLOGLEVEL=$(LOGLEVEL) -DUNITY_INCLUDE_DOUBLE -c ./test/test.c -o build_aux/test.o
$(CC) $$(ls build_aux/*.o) -o test.out -lm -larb -lflint -lgsl -lgslcblas
@valgrind \
--leak-check=full \
--show-leak-kinds=all \
--track-origins=yes \
--verbose \
--log-file=valgrind-out.txt \
./test.out
# For logging
# LOGGING_CFLAGS = -DLOG_USE_COLOR
# LOGGING_SRCS=./logging/src/log.c
# LOGGING_INCDIR=./logging/src
# # For Unity
# UNITY_CFLAGS = -DUNITY_INCLUDE_DOUBLE
# UNITY_SRCS=./unity/src/unity.c
# UNITY_INCDIR=./unity/src/
# # For numeric
# NUMERIC_CFLAGS = -DM_PI=3.14159265358979323846 -D_TOLERANCE=1e-7
# NUMERIC_SRCS=$(shell find ./numeric/src/ -type f -name '*.c')
# NUMERIC_INCDIR=./numeric/src/
# NUMERIC_LDFLAGS = -lm
# # For integration
# INTEGRATION_CFLAGS =
# INTEGRATION_SRCS=$(shell find ./src/ -type f -name '*.c')
# INTEGRATION_INCDIR=./src/
# INCDIR = $(LOGGING_INCDIR) $(UNITY_INCDIR) $(NUMERIC_INCDIR) $(INTEGRATION_INCDIR)
# INCFLAGS=$(foreach d,$(INCDIR),-I$d)
# CFLAGS+=$(LOGGING_CFLAGS) $(UNITY_CFLAGS) $(NUMERIC_CFLAGS) $(INTEGRATION_CFLAGS)
# LDFLAGS+=$(NUMERIC_LDFLAGS)
#all: test.out
# SRCS := $(LOGGING_SRCS) $(UNITY_SRCS) $(NUMERIC_SRCS) $(INTEGRATION_SRCS) ./test/test.c
# OBJS := $(SRCS:%.c=%.o)
# .PHONY: test
# test: test.out
# ./test.out
# test.out: $(OBJS)
# $(CC) $^ -o $@ $(LDFLAGS)
# %.o: %.c
# $(CC) $(INCFLAGS) $(CFLAGS) -c $^ -o $@
.PHONY: doc
doc: Doxyfile
doxygen
.PHONY: clean
clean:
find . -iname "*.o" -type f -delete
clean-all: clean
find . -iname "*.out" -type f -delete