-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmakefile
More file actions
36 lines (25 loc) · 902 Bytes
/
makefile
File metadata and controls
36 lines (25 loc) · 902 Bytes
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
CXX = g++
CXXFLAGS = -std=c++17 -Wall -Werror -Wno-format-security
LDFLAGS = -pthread
SOURCES = $(filter-out src/main.cpp, $(wildcard src/*.cpp))
OBJECTS = $(SOURCES:.cpp=.o)
TEST_OUTPUT = neocortex_test
OUTPUT = neocortex
.PHONY: clean debug release
.DEFAULT_GOAL := release
debug: CXXFLAGS+=-g
debug: clean $(OUTPUT)
test: CXXFLAGS+=-g --coverage -fprofile-arcs -ftest-coverage -fno-inline -fno-inline-small-functions -fno-default-inline -fkeep-inline-functions -O0
test: LDFLAGS+=-lgtest -lgcov
test: clean $(TEST_OUTPUT)
release: CXXFLAGS+=-DNDEBUG -O3
release: clean $(OUTPUT)
all: release
$(OUTPUT): $(OBJECTS) src/main.o
$(CXX) $^ $(LDFLAGS) -o $@
$(TEST_OUTPUT): $(OBJECTS) test/test.o
$(CXX) $^ $(LDFLAGS) -o $@
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
clean:
rm -f $(OUTPUT) $(TEST_OUTPUT) src/*.o test/*.o src/*.gcda src/*.gcno src/*.gcov test/*.gcda test/*.gcno test/*.gcov