forked from astianax18/AFDU
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (54 loc) · 1.82 KB
/
Makefile
File metadata and controls
61 lines (54 loc) · 1.82 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
TARGET = afdu
SRC_DIR = .
BUILD_DIR = .
SRC = $(SRC_DIR)/afdu.cpp
OBJ = $(BUILD_DIR)/afdu.o
#------------------------------------------------------------------------------
CC = g++
#------------------------------------------------------------------------------
CFLAGS = \
-O1 \
-Wall \
-Wextra \
-std=c++20 \
-Wconversion \
-Wpedantic \
-Wnull-dereference \
-fanalyzer\
-fstack-protector-strong \
-fstack-clash-protection \
-fPIE \
-fcf-protection=full \
-Wformat=2 \
# Otional things
# CFLAGS += -D_FORTIFY_SOURCE=2
#CFLAGS:
# -O1 - optimisation level
# -Wall - output all warnings
# -Wextra - strengthening code auditing during compilation
# -Werror - COMMENTARIED. the option what turnes all warmings to errors
# -std=c17 - choosen clang standard
# -Wconversion - warnings about implicit type conversions with possible data loss
# -Wpedantic - strict adherence to the standard
# -Wnull-dereference - null pointer dereference detection
# -fanalyzer - enabling static analysis
# -D_FORTIFY_SOURCE=2 - replacing system memory functions with safer analogs
# -fstack-protector-strong - stack canaries. protection of callback to the function return address
# -fstack-clash-protection - protecting program execution during stack overflow
# -fPIE - independence from the memory address of the binary file execution
# -z,relro - changing the operating mode of dynamic linkage tables of standard libc functions
# -fcf-protection=full - hardware support for a second program stack with return addresses
# -Wformat=2 - security check of scanf family functions
LDFLAGS = \
-pie \
-Wl,-z,relro \
-Wl,-z,now \
-lext2fs \
#------------------------------------------------------------------------------
all: $(TARGET)
$(TARGET): $(OBJ)
$(CC) $(OBJ) -o $(TARGET) $(LDFLAGS)
$(OBJ): $(SRC)
$(CC) $(CFLAGS) -c $(SRC) -o $(OBJ)
clean:
rm -f $(OBJ) $(TARGET)