-
Notifications
You must be signed in to change notification settings - Fork 776
Expand file tree
/
Copy pathMakefile
More file actions
137 lines (100 loc) · 3.4 KB
/
Makefile
File metadata and controls
137 lines (100 loc) · 3.4 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
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
135
136
137
# c compiler and flags
CC = gcc
CFLAGS = -Wall -O2 -s
# cpp compiler and flags
CXX = g++
CXXFLAGS = -Wall -O2 -s
# preprocessor flags, common to c and cpp
CPPFLAGS = -MD
OBJS = $(patsubst %.c,%.o,$(wildcard *.c))
DEPS = $(patsubst %.o,%.d,$(OBJS))
MISSING_DEPS = $(filter-out $(wildcard $(DEPS)),$(DEPS))
MISSING_DEPS_SOURCES = $(wildcard $(patsubst %.d,%.c,$(MISSING_DEPS)))
TARGETS = \
arm_hello \
arm_hello_static \
arm_sleep_hello \
arm64_hello \
arm64_hello_static \
arm64_sleep_hello \
mips32el_hello \
mips32el_hello_static \
x86_hello \
x86_hello_static \
x86_hello_cpp \
x86_hello_cpp_static \
x8664_hello \
x8664_hello_static \
x8664_hello_cpp \
x8664_hello_cpp_static \
x8664_cloexec_test \
x8664_linux_onestraw \
patch_test.bin
.PHONY: all clean
all : $(TARGETS)
ARM_TARGETS: $(filter arm_%,$(TARGETS))
ARM64_TARGETS: $(filter arm64_%,$(TARGETS))
MIPS32EL_TARGETS: $(filter mips32el_%,$(TARGETS))
X86_TARGETS: $(filter x86_%,$(TARGETS))
X8664_TARGETS: $(filter x8664_%,$(TARGETS))
ifneq ($(MISSING_DEPS),)
$(MISSING_DEPS) :
@$(RM) $(patsubst %.d,%.o,$@)
endif
-include $(DEPS)
arm_hello: hello.c
arm-linux-gnueabihf-gcc $(CPPFLAGS) $(CFLAGS) -o $@ $<
arm_hello_static: hello.c
arm-linux-gnueabihf-gcc $(CPPFLAGS) $(CFLAGS) -static -o $@ $<
arm_sleep_hello: sleep_hello.c
arm-linux-gnueabihf-gcc $(CPPFLAGS) $(CFLAGS) -o $@ $<
arm64_hello: hello.c
aarch64-linux-gnu-gcc $(CPPFLAGS) $(CFLAGS) -o $@ $<
arm64_hello_static: hello.c
aarch64-linux-gnu-gcc $(CPPFLAGS) $(CFLAGS) -static -o $@ $<
arm64_sleep_hello: sleep_hello.c
aarch64-linux-gnu-gcc $(CPPFLAGS) $(CFLAGS) -o $@ $<
# not included in default targets because requires the Android NDK to be installed.
# add <NDK>/toolchains/llvm/prebuilt/linux-x86_64/bin/ to your path
arm64_android_hello: hello.c
aarch64-linux-android29-clang $(CPPFLAGS) $(CFLAGS) -o $@ $<
arm64_posix_syscall: posix_syscall.c
aarch64-linux-gnu-gcc $(CPPFLAGS) $(CFLAGS) -o $@ $<
mips32el_hello: hello.c
mipsel-linux-gnu-gcc $(CPPFLAGS) $(CFLAGS) -o $@ $<
mips32el_hello_static: hello.c
mipsel-linux-gnu-gcc $(CPPFLAGS) $(CFLAGS) -static -o $@ $<
mips32el_posix_syscall: posix_syscall.c
mipsel-linux-gnu-gcc $(CPPFLAGS) $(CFLAGS) -o $@ $<
x86_hello: hello.c
$(CC) $(CPPFLAGS) $(CFLAGS) -m32 -o $@ $<
x86_hello_static: hello.c
$(CC) $(CPPFLAGS) $(CFLAGS) -m32 -static -o $@ $<
x86_hello_cpp: hello.cpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -m32 -o $@ $<
x86_hello_cpp_static: hello.cpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -m32 -static -o $@ $<
x86_posix_syscall: posix_syscall.c
$(CC) $(CPPFLAGS) $(CFLAGS) -m32 -o $@ $<
x86_fetch_urandom: fetch_urandom.c
$(CC) $(CPPFLAGS) $(CFLAGS) -m32 -o $@ $<
x8664_hello: hello.c
$(CC) $(CFLAGS) -m64 -o $@ $<
x8664_hello_static: hello.c
$(CC) $(CPPFLAGS) $(CFLAGS) -m64 -static -o $@ $<
x8664_hello_cpp: hello.cpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -m64 -o $@ $<
x8664_hello_cpp_static: hello.cpp
$(CXX) $(CXXFLAGS) -m64 -static -o $@ $<
x8664_cloexec_test: cloexec_test.c
$(CC) $(CPPFLAGS) $(CFLAGS) -m64 -o $@ $<
libpatch_test.so: patch_test.so.h patch_test.so.c
$(CC) $(CPPFLAGS) -Wall -s -O0 -shared -fpic -o $@ patch_test.so.c
patch_test.bin: patch_test.bin.c libpatch_test.so
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^
x8664_onestraw_server: x8664_linux_onestraw.c
$(CC) $(CPPFLAGS) $(CFLAGS) -m64 -o $@ $<
$(OBJS):%.o:%.c
$(CC) $(CFLAGS) -c $< -o $@
clean:
$(RM) -f *.d *.s *.o *.so $(TARGETS)