generated from AOrps/readme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (45 loc) · 1.17 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
#OBJS = losh.o
SHELL = /bin/sh
CC = gcc
# -Wno-format is needed because mismatched formats are a feature to get an alphanumeric character
CFLAGS = -g -Wall -pedantic -Og -Wno-format
# Hardening Flags Resources : https://github.com/ossf/wg-best-practices-os-developers/blob/main/docs/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C%2B%2B.md
CFLAGS_HARDEN = -Wall -Wextra -Wformat=2 -Wconversion -Wtrampolines -Werror -O1 -D_FORTIFY_SOURCE=3 -fstack-clash-protection -fstack-protector-strong -Wl,-z,noexecstack -fPIE -pie
OBJS = src/main.c src/logging.c src/sigs.c src/lockshell.h
PROGS = compile
all: $(PROGS)
compile: clean
$(CC) $(CFLAGS) -o losh $(OBJS)
run: compile
./losh
harden: clean
$(CC) $(CFLAGS_HARDEN) -o loshh $(OBJS)
test: compile
./losh&
@sleep 1.5
./kill-debug.sh
clean:
ifneq (,$(wildcard ./losh))
rm ./losh
endif
ifneq (,$(wildcard ./loshh))
rm ./loshh
endif
ifneq (,$(wildcard ./a.out))
rm ./a.out
endif
ifneq (,$(wildcard *.o))
rm *.o
endif
ifneq (,$(wildcard *~))
rm *~
endif
prune: clean
ifneq (,$(wildcard *.log))
rm *.log
endif
#[ -f {} ] && rm {} && echo 'rm *.log'
clean-all: clean
ifneq (,$(wildcard ./*.log))
rm ./*.log
endif