This repository has been archived by the owner on Jan 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
64 lines (50 loc) · 1.83 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
###############################################################################
#
# IPKCP Makefile
# @author Onegen Something <xonege99@vutbr.cz>
#
###############################################################################
TARGET = ipkcpc
ZIPNAME = xonege99.zip
CPP = g++
CPPFLAGS = -std=c++20
EXTRA_CPPFLAGS = -Wall -Wextra -Werror -pedantic \
-fdata-sections -ffunction-sections
RELEASE_CPPFLAGS = -DNDEBUG -O2 -march=native
DEBUG_CPPFLAGS = -g -Og -fsanitize=undefined
LINT_FLAGS = --format-style=file \
-checks="bugprone-*,google-*,performance-*,readability-*,hicpp-*,clang-analyzer-*"
RM = rm -f
SRCS = main.cpp client.cpp
###############################################################################
.PHONY: all release debug help clean zip lint format
all: release
release: EXTRA_CPPFLAGS += ${RELEASE_CPPFLAGS}
release: ${TARGET}
debug: EXTRA_CPPFLAGS += ${DEBUG_CPPFLAGS}
debug: ${TARGET}
${TARGET}: ${SRCS}
${CPP} ${CPPFLAGS} ${EXTRA_CPPFLAGS} ${SRCS} -o ${TARGET}
@echo "ipkcpc compiled!"
@echo "Run with: ./ipkcpc -h <host> -p <port> -m <mode>"
help:
@echo "IPKCP-Client Makefile"
@echo "@author Onegen Something <xonege99@vutbr.cz>"
@echo ""
@echo "Usage: make [TARGET]"
@echo "TARGETs:"
@echo " all compile and link the project (default)"
@echo " debug compile and link the project with debug flags"
@echo " clean clean objects and executables"
@echo " format run formatter"
@echo " lint run linter"
@echo " zip create a .zip archive with the source files"
@echo " help print this message"
clean:
${RM} ${TARGET}
zip:
zip -v -r ${ZIPNAME} .* *
format:
clang-format -i *.cpp *.hpp
lint:
clang-tidy *.cpp *.hpp ${LINT_FLAGS} -- ${CPPFLAGS}