-
Notifications
You must be signed in to change notification settings - Fork 29
/
Makefile
103 lines (87 loc) · 1.91 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
UNAME := $(shell uname)
CFLAGS := \
-std=gnu11 -Wall -pthread -O2 \
-I$(shell pwd)/src/include
LDLIBS := -ldl -lpthread
CPPFLAGS :=
CXXFLAGS := \
-std=c++11 -Wall -pthread -O2 \
-I$(shell pwd)/src/include
# TODO(ww): https://github.com/rust-lang/rust-bindgen/issues/1651
# RUSTFLAGS := -D warnings
RUST_BINDGEN_CLANG_ARGS := \
-I$(shell pwd)/src/include
ifeq ($(UNAME), Darwin)
SO_SUFFIX := dylib
else
SO_SUFFIX := so
# Linux needs -lrt for the POSIX shm(3) family calls.
LDLIBS := $(LDLIBS) -lrt
endif
export UNAME
export CFLAGS
export LDLIBS
export CPPFLAGS
export CXXFLAGS
export RUST_BINDGEN_CLANG_ARGS
export SO_SUFFIX
ALL_SRCS := $(shell \
find . -type f \
\( \
-path '*/capstone/capstone/*' -o \
-path '*/vendor/*' -o \
-path '*/dynamorio/dynamorio/*' -o \
-path '*/dynamorio/obj/*' -o \
-path '*/fadec/fadec/*' -o \
-path '*/udis86/udis86/*' -o \
-path '*/xed/xed/*' -o \
-path '*/xed/mbuild/*' -o \
-path '*/zydis/zydis/*' -o \
-path '*/bddisasm/bddisasm/*' -o \
-path '*/ghidra/sleighMishegos*' -o \
-path '*/ghidra/ghidra/*' -o \
-path '*/ghidra/build/*' -o \
-path '*/ghidra/sleigh-cmake/*' \
\) \
-prune \
-o \( \
-name 'sleighMishegos*' -o \
-name '*.c' -o \
-name '*.cc' -o \
-name '*.h' -o \
-name '*.hh' \
\) \
-print \
)
.PHONY: all
all: mishegos worker mish2jsonl
.PHONY: debug
debug: CPPFLAGS += -DDEBUG
debug: CFLAGS += -g
debug: all
.PHONY: mishegos
mishegos:
$(MAKE) -C src/mishegos
.PHONY: worker
worker:
$(MAKE) -C src/worker $(WORKERS)
.PHONY: mish2jsonl
mish2jsonl:
$(MAKE) -C src/mish2jsonl
.PHONY: fmt
fmt:
clang-format -i -style=file $(ALL_SRCS)
.PHONY: lint
lint:
cppcheck --error-exitcode=1 $(ALL_SRCS)
.PHONY: edit
edit:
$(EDITOR) $(ALL_SRCS)
.PHONY: clean
clean:
$(MAKE) -C src/worker clean
$(MAKE) -C src/mishegos clean
$(MAKE) -C src/mish2jsonl clean
.PHONY: update-submodules
update-submodules:
git submodule foreach git pull origin master