-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
80 lines (67 loc) · 3.05 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
74
75
76
77
78
79
80
################################################################
# Project: IMAP client with TLS support
# File: Makefile
# Author: Adam Ližičiar xlizic00@stud.fit.vutbr.cz
################################################################
COMPILER = g++
COMPILER_FLAGS = -std=c++20 -Wall -Wextra -Werror
COMPILER_AFTER_FLAGS = -lssl -lcrypto
DEBUG_FLAGS = -DDEBUG
PROGRAM_NAME = imapcl
PROGRAM_PARAMS = imap.stud.fit.vutbr.cz -a config/auth.txt -o maildir
DOC=manual
OBJ_DIR = obj
DOC_DIR = doc
.PHONY: make run doc test benchmark valgrind clean pack
make: src/main.cpp
$(COMPILER) $(COMPILER_FLAGS) src/main.cpp -o $(PROGRAM_NAME) $(COMPILER_AFTER_FLAGS)
run: make
./$(PROGRAM_NAME) $(PROGRAM_PARAMS)
debug:
$(COMPILER) $(COMPILER_FLAGS) $(DEBUG_FLAGS) src/main.cpp -o $(PROGRAM_NAME)_debug $(COMPILER_AFTER_FLAGS)
./$(PROGRAM_NAME)_debug $(PROGRAM_PARAMS)
$(OBJ_DIR):
mkdir $(OBJ_DIR)
doc: $(OBJ_DIR) $(DOC_DIR)/$(DOC).tex
cd $(DOC_DIR) && pdflatex $(DOC).tex
make bibtex
cd $(DOC_DIR) && pdflatex $(DOC).tex
cd $(DOC_DIR) && pdflatex $(DOC).tex
cd $(DOC_DIR) && pdflatex $(DOC).tex
cd ../
if [ -e $(DOC_DIR)/$(DOC).aux ]; then mv $(DOC_DIR)/$(DOC).aux $(OBJ_DIR)/$(DOC).aux; fi
if [ -e $(DOC_DIR)/$(DOC).dvi ]; then mv $(DOC_DIR)/$(DOC).dvi $(OBJ_DIR)/$(DOC).dvi; fi
if [ -e $(DOC_DIR)/$(DOC).xdv ]; then mv $(DOC_DIR)/$(DOC).xdv $(OBJ_DIR)/$(DOC).xdv; fi
if [ -e $(DOC_DIR)/$(DOC).log ]; then mv $(DOC_DIR)/$(DOC).log $(OBJ_DIR)/$(DOC).log; fi
if [ -e $(DOC_DIR)/$(DOC).ps ]; then mv $(DOC_DIR)/$(DOC).ps $(OBJ_DIR)/$(DOC).ps; fi
if [ -e $(DOC_DIR)/$(DOC).synctex.gz ]; then mv $(DOC_DIR)/$(DOC).synctex.gz $(OBJ_DIR)/$(DOC).synctex.gz; fi
if [ -e $(DOC_DIR)/$(DOC).fls ]; then mv $(DOC_DIR)/$(DOC).fls $(OBJ_DIR)/$(DOC).fls; fi
if [ -e $(DOC_DIR)/$(DOC).fdb_latexmk ]; then mv $(DOC_DIR)/$(DOC).fdb_latexmk $(OBJ_DIR)/$(DOC).fdb_latexmk; fi
if [ -e $(DOC_DIR)/$(DOC).bbl ]; then mv $(DOC_DIR)/$(DOC).bbl $(OBJ_DIR)/$(DOC).bbl; fi
if [ -e $(DOC_DIR)/$(DOC).blg ]; then mv $(DOC_DIR)/$(DOC).blg $(OBJ_DIR)/$(DOC).blg; fi
if [ -e $(DOC_DIR)/$(DOC).out ]; then mv $(DOC_DIR)/$(DOC).out $(OBJ_DIR)/$(DOC).out; fi
if [ -e $(DOC_DIR)/$(DOC).toc ]; then mv $(DOC_DIR)/$(DOC).toc $(OBJ_DIR)/$(DOC).toc; fi
if [ -e $(DOC_DIR)/$(DOC).pdf.filepart ]; then mv $(DOC_DIR)/$(DOC).pdf.filepart $(OBJ_DIR)/$(DOC).pdf.filepart; fi
if [ -e $(DOC_DIR)/$(DOC).pdf ]; then mv $(DOC_DIR)/$(DOC).pdf $(DOC).pdf; fi
bibtex: $(DOC_DIR)/bib/$(DOC).bib
cd $(DOC_DIR) && bibtex $(DOC)
test: make
g++ test/unit/__init__.cpp -o test/unit/run -lgtest -lgtest_main -lssl -lcrypto
./test/unit/run
benchmark: make
g++ -std=c++11 -O3 test/benchmark/__init__.cpp -lbenchmark
valgrind:
valgrind --leak-check=full \
--suppressions=test/valgrind/suppressions.valgrind \
--show-leak-kinds=all \
--track-origins=yes \
--verbose \
--log-file=log/valgrind-log-$(shell date +%Y%m%d-%H%M%S).txt \
./$(PROGRAM_NAME) $(PROGRAM_PARAMS)
clean:
rm -f tests/run
rm -f *.exe *.out *.core *.tar
rm -f $(PROGRAM_NAME)
rm -f $(PROGRAM_NAME)_debug
pack:
tar -cvf xlizic00.tar *