-
Notifications
You must be signed in to change notification settings - Fork 47
/
Makefile
134 lines (119 loc) · 2.7 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# This file is part of KASLD - https://github.com/bcoles/kasld
# ---
SHELL = /bin/sh
.SUFFIXES: .c .o
CC = cc
# Warning: Do not compile with -O
CFLAGS = -g -Wall -Wextra -pedantic
ALL_CFLAGS = -std=c99 $(CFLAGS)
LDFLAGS =
ALL_LDFLAGS = $(LDFLAGS)
ifndef _ARCH
_ARCH := $(shell $(CC) -dumpmachine)
export _ARCH
endif
BUILD_DIR := ./build
OBJ_DIR := $(BUILD_DIR)/$(_ARCH)
SRC_DIR := ./src
SRC_FILES := $(wildcard $(SRC_DIR)/*.c)
OBJ_FILES := $(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(SRC_FILES))
.PHONY: all
all : build
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
-$(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) $< -o $@
.PHONY: pre-build
pre-build :
@echo "Building $(OBJ_DIR) ..."
mkdir -p "$(OBJ_DIR)"
# check for pre-compile errors before building
$(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) $(SRC_DIR)/include/kasld.h
.PHONY: build
build : pre-build $(OBJ_FILES)
.PHONY: run
run : build
@echo "Running build ..."
@echo
# run default first
-$(OBJ_DIR)/default.o
@echo
-$(OBJ_DIR)/bcm_msg_head_struct.o
@echo
-$(OBJ_DIR)/boot-config.o
@echo
-$(OBJ_DIR)/proc-cmdline.o
@echo
-$(OBJ_DIR)/dmesg_android_ion_snapshot.o
@echo
-$(OBJ_DIR)/dmesg_backtrace.o
@echo
-$(OBJ_DIR)/dmesg_check_for_initrd.o
@echo
-$(OBJ_DIR)/dmesg_driver_component_ops.o
@echo
-$(OBJ_DIR)/dmesg_early_init_dt_add_memory_arch.o
@echo
-$(OBJ_DIR)/dmesg_ex_handler_msr.o
@echo
-$(OBJ_DIR)/dmesg_fake_numa_init.o
@echo
-$(OBJ_DIR)/dmesg_free_area_init_node.o
@echo
-$(OBJ_DIR)/dmesg_free_reserved_area.o
@echo
-$(OBJ_DIR)/dmesg_kaslr-disabled.o
@echo
-$(OBJ_DIR)/dmesg_mem_init_kernel_layout.o
@echo
-$(OBJ_DIR)/dmesg_mmu_idmap.o
@echo
-$(OBJ_DIR)/dmesg_riscv_relocation.o
@echo
-$(OBJ_DIR)/entrybleed.o
@echo
-$(OBJ_DIR)/mmap-brute-vmsplit.o
@echo
-$(OBJ_DIR)/perf_event_open.o
@echo
-$(OBJ_DIR)/proc-config.o
@echo
-$(OBJ_DIR)/pppd_kallsyms.o
@echo
-$(OBJ_DIR)/proc-kallsyms.o
@echo
-$(OBJ_DIR)/proc-modules.o
@echo
-$(OBJ_DIR)/proc-pid-syscall.o
@echo
-$(OBJ_DIR)/proc-stat-wchan.o
@echo
-$(OBJ_DIR)/sysfs_iscsi_transport_handle.o
@echo
-$(OBJ_DIR)/sysfs-kernel-notes-xen.o
@echo
-$(OBJ_DIR)/sysfs-module-sections.o
@echo
-$(OBJ_DIR)/sysfs_nf_conntrack.o
@echo
# slow - leave this one last
-$(OBJ_DIR)/mincore.o
@echo
.PHONY: clean
clean :
@echo "Cleaning $(BUILD_DIR) ..."
rm -rf "$(BUILD_DIR)"
.PHONY: help
help:
@echo
@echo " make [target] [OPTIONS]"
@echo
@echo " Targets:"
@echo " run Build and run"
@echo " all Build all from src directory"
@echo " clean Remove build directory"
@echo
@echo " Options:"
@echo " CC=compiler Compiler executable"
@echo " CFLAGS=flags Compiler flags"
@echo " LDFLAGS=flags Linker flags"
@echo