-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
73 lines (59 loc) · 1.95 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
PROJECT = photo-worker
CXX = g++
CXXFLAGS = -g -Wall -pedantic --std=c++2a
CXXFLAGS += -DPROJECT_NAME=\"$(PROJECT)\"
CXXLINKFLAGS = -ltbb -lraw_r -lturbojpeg
SRC = src
BIN = bin
TEST = test
.PHONY: build
build: CXXFLAGS += -Werror
build: $(BIN)/$(PROJECT)
.PHONY: release
release: CXXFLAGS += -O3 -DVERSION=\"$(shell git describe)\"
release: $(BIN)/$(PROJECT)
.PHONY: run
run: $(BIN)/$(PROJECT)
$(BIN)/$(PROJECT) convert -s $(TEST) -t 4
.PHONY: debug
debug: $(BIN)/$(PROJECT)
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose $(BIN)/$(PROJECT) -s $(TEST)
.PHONY: clean
clean:
rm -rf $(BIN)
rm -rf $(TEST)/jpg
.PHONY: tidy
tidy:
clang-tidy -p . `find . -name '*.cpp'`
.PHONY: clang-check
clang-check:
clang -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded -fsyntax-only `find . -name '*.cpp'`
.PHONY: bear
bear:
make clean
bear -- make build -j
.PHONY: format
format:
clang-format -i `find . -name '*.cpp' \
-o -name '*.c' \
-o -name '*.cc' \
-o -name '*.cxx' \
-o -name '*.hpp' \
-o -name '*.h' \
-o -name '*.hh' \
-o -name '*.hxx'`
# $^ all rules for dependency (after :)
# $< first parametr of dependency (before :)
# $@ target of rule (before :)
$(BIN)/$(PROJECT): $(BIN)/main.o $(BIN)/argument_parse.o $(BIN)/convertor.o $(BIN)/pictures.o $(BIN)/pictureData.o $(BIN)/worker.o
@mkdir -p $(BIN)
$(CXX) $(CXXLINKFLAGS) $^ -o $@
$(BIN)/%.o: $(SRC)/%.cpp
@mkdir -p $(BIN)
$(CXX) $(CXXFLAGS) -c $< -o $@
$(BIN)/main.o: $(SRC)/main.cpp $(SRC)/argument_parse.hpp $(SRC)/convertor.hpp $(SRC)/worker.hpp $(SRC)/pictures.hpp
$(BIN)/argument_parse.o: $(SRC)/argument_parse.cpp $(SRC)/argument_parse.hpp
$(BIN)/convertor.o: $(SRC)/convertor.cpp $(SRC)/convertor.hpp $(SRC)/pictures.hpp $(SRC)/pictureData.hpp
$(BIN)/pictures.o: $(SRC)/pictures.cpp $(SRC)/pictures.hpp $(SRC)/pictureData.hpp
$(BIN)/pictureData.o: $(SRC)/pictureData.cpp $(SRC)/pictureData.hpp
$(BIN)/worker.o: $(SRC)/worker.cpp $(SRC)/worker.hpp