-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
45 lines (30 loc) · 1.04 KB
/
Makefile
File metadata and controls
45 lines (30 loc) · 1.04 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
CXX = clang++
# CXXFLAGS = -std=c++20 -Wall -fsanitize=address -fno-omit-frame-pointer -pedantic-errors -g -I include
# CXXFLAGS = -std=c++20 -Wall -pedantic-errors -g -I include
CXXFLAGS = -std=c++20 -O3 -Wall -pedantic-errors -g -I include
# CXXFLAGS = -std=c++20 -O3 -fprofile-generate -Wall -pedantic-errors -g -I include
# CXXFLAGS = -std=c++20 -O3 -fprofile-use=default.profdata -Wall -pedantic-errors -g -I include
TEST_SRCS = ${wildcard *_test.cpp}
TEST_OBJS = $(addprefix bin/, $(TEST_SRCS:.cpp=.o))
TEST_MAINS = $(addprefix bin/, $(TEST_SRCS:.cpp=))
HEADERS = ${wildcard *.h}
SRCS = fixed.cpp
OBJS = $(addprefix bin/, $(SRCS:.cpp=.o))
LIB =
.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} $@.o ${LIB} -o $@
bin/%.o: %.cpp ${HEADERS}
@ mkdir -p bin
${CXX} ${CXXFLAGS} -c $(notdir $(basename $@).cpp) -o $@
clean:
rm -rf bin *~.