-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathMakefile
More file actions
84 lines (70 loc) · 1.64 KB
/
Makefile
File metadata and controls
84 lines (70 loc) · 1.64 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
TARGET := ../env/exp/exploit
LINKSCRIPT := linkscript.lds
CC := gcc
CFLAGS := -fno-asynchronous-unwind-tables -fno-ident -fno-stack-protector \
-no-pie -s -Os -nostdlib -static -Wl,-T$(LINKSCRIPT) -lgcc -Wall
MAIN_C := src/main.c
SOURCES := \
consts/log.h \
consts/prog_regions.h \
consts/stack.h \
consts/paging.h \
consts/msg.h \
src/nodes_master_and_use.h \
src/node_free.c \
src/nodes_decl.h \
src/nodes_master_and_free.h \
src/nodes_master_free_use.h \
src/main.c \
src/nodes_free_and_use.h \
src/node_master.c \
src/node_use.c \
sys/uio.h \
sys/msg.h \
sysutil/clone.h \
sysutil/mbarrier.h \
sysutil/pin_cpu.h \
utils/string.h
ECHO := echo -e '\t'
TEE := tee
GREP := grep -oha
RM := rm -f
CFMT := clang-format
CFMTFIX := $(CFMT) -i
CFMTCHK := $(CFMT) -n --Werror
KVM ?= -enable-kvm
QEMU := qemu-system-x86_64
QFLAGS := \
-m 3G -smp 2 $(KVM) \
-kernel ../env/bzImage_upstream_6.1.25 \
-initrd ../env/initramfs.cpio.gz \
-append "init=/init console=ttyS0 panic_on_warn=1" \
-virtfs local,path=../env/exp,mount_tag=exp,security_model=none \
-nographic -no-reboot
OUT := ../env/run.out
FLAG := 'flag{[a-zA-Z0-9_-]*}'
.PHONY:
all: $(TARGET)
$(TARGET): $(SOURCES) $(LINKSCRIPT)
@$(ECHO) CC $(TARGET)
@$(CC) -o $(TARGET) $(MAIN_C) $(CFLAGS)
.PHONY:
clean:
@$(ECHO) RM $(TARGET)
@$(RM) $(TARGET)
@$(ECHO) RM $(OUT)
@$(RM) $(OUT)
.PHONY:
fmt:
@$(ECHO) FMT $(SOURCES)
@$(CFMTFIX) $(SOURCES)
.PHONY:
check:
@$(ECHO) CHECK $(SOURCES)
@$(CFMTCHK) $(SOURCES)
.PHONY:
run: $(TARGET)
@$(ECHO) QEMU $(TARGET)
@$(QEMU) $(QFLAGS) | $(TEE) $(OUT)
@$(ECHO) SEARCH FLAG
@$(GREP) $(FLAG) $(OUT)