-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
101 lines (72 loc) · 2.01 KB
/
Makefile
File metadata and controls
101 lines (72 loc) · 2.01 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
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
CXX=g++
CFLAGS=-Wall -Wextra -Werror -std=c++17
TEST_FLAGS=--coverage
TEST=Test/s21_test
TARGET=CppSmartCalc
README := README.md
SRC := $(shell find . -name '*.cc' )
SRCH := $(shell find . -name '*.h' )
SRC_DIRS := ./model
SRCS := $(shell find $(SRC_DIRS) -name '*.cc' )
SRCSH := $(shell find $(SRC_DIRS) -name '*.h' )
OBJS = $(addsuffix .o,$(basename $(SRCS)))
OS :=$(shell uname -s)
BLUE:=\033[96m
A := $(shell find $(SRC_DIRS) -name 'a.out')
ifeq ($(OS), Darwin)
CFLAGS =-lstdc++ -std=c++17 -Wall -Wextra -Werror
else
CFLAGS =-lstdc++ -std=c++17 -Wall -Wextra -Werror -lrt -lm -lpthread
endif
all: $(TARGET).a
$(TARGET).a: $(OBJS)
@ar rc $@ $(OBJS)
%.o: %.cc
$(CXX) $(CFLAGS) -c -o $@ $<
install:
qmake6 -o Executables/Makefile $(TARGET).pro
cd Executables && make -j6
start: install
cd Executables/$(TARGET).app/Contents/MacOS && ./$(TARGET)
uninstall: clean
rm -rf Executables
dvi:
open $(README)
dist: install
cd .. && tar -czf $(TARGET).tgz src
test: clean $(TARGET).a
$(CXX) $(CFLAGS) $(TARGET).a $(TEST).cc -o s21_test -lgtest
./s21_test
clean:
rm -rf $(OBJS) $(TARGET).a RESULT.log $(A) */*.g* s21_test
find . -name ".DS_Store" -type f -delete
$(RM) gcov *.info *.gcda *.gcno Tests/*.gcda Tests/*.gcno g$(TARGET).a
rm -rf report
clean_import:
rm -rf Import
mkdir Import
install_lcov:
brew install lcov
style:
cp ../materials/linters/.clang-format .clang-format
clang-format -n $(SRC)
clang-format -n $(SRCH)
rm -rf .clang-format
format_style:
cp ../materials/linters/.clang-format .clang-format
clang-format -i $(SRC)
clang-format -i $(SRCH)
rm -rf .clang-format
valgrind: $(OBJS)
@CK_FORK=no valgrind --trace-children=yes --track-fds=yes --track-origins=yes --leak-check=full --show-leak-kinds=all --verbose --log-file=RESULT.log ./s21_test >/dev/null;
cat RESULT.log
leaks: test
CK_FORK=no leaks -atExit -- ./s21_test
a: clean $(TARGET).a
rm -rf a.out
$(CXX) $(CFLAGS) $(TARGET).a main.cpp -o a.out -g
./a.out
push: clean
git add .
git commit -m '$m'
git push origin $o