-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
49 lines (33 loc) · 1.2 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
CXX = clang++
INCLUDES =
# CXXFLAGS = -std=c++20 -Wall -O0 -fsanitize=address -fno-omit-frame-pointer -pedantic-errors -g ${INCLUDES}
# CXXFLAGS = -std=c++20 -Wall -pedantic-errors -g ${INCLUDES}
CXXFLAGS = -std=c++20 -O3 -Wall -pedantic-errors -g -fno-permissive ${INCLUDES}
# CXXFLAGS = -std=c++20 -O3 -fprofile-generate -Wall -pedantic-errors -g ${INCLUDES}
# CXXFLAGS = -std=c++20 -O3 -fprofile-use=default.profdata -Wall -pedantic-errors -g ${INCLUDES}
TEST_SRCS = ${wildcard *_test.cpp}
TEST_OBJS = $(addprefix bin/, $(TEST_SRCS:.cpp=.o))
TEST_MAINS = $(addprefix bin/, $(TEST_SRCS:.cpp=))
HEADERS = ${wildcard *.h} fixed.h
SRCS = orderbook.cpp exchange.cpp
OBJS = $(addprefix bin/, $(SRCS:.cpp=.o))
LIB = bin/orderbook.a
fixed.h:
curl -o fixed.h https://raw.githubusercontent.com/robaho/cpp_fixed/main/fixed.h
.PRECIOUS: bin/%.o
all: $(TEST_MAINS) ${LIB}
@echo compile finished
test: ${TEST_MAINS}
run_tests: ${TEST_MAINS}
for main in $^ ; do \
$$main; \
done
${LIB}: ${OBJS}
ar r ${LIB} ${OBJS}
bin/%_test: bin/%_test.o ${LIB}
${CXX} ${LDFLAGS} ${CXXFLAGS} [email protected] ${LIB} -o $@
bin/%.o: %.cpp ${HEADERS}
@ mkdir -p bin
${CXX} ${CXXFLAGS} -c $(notdir $(basename $@).cpp) -o $@
clean:
rm -rf bin *~.