-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
54 lines (43 loc) · 1.3 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
# Path to prebuilt libbinaryninjaapi.a
BINJA_API_A := ../../bin/libbinaryninjaapi.a
# Path to binaryninjaapi.h and json
INC := -I../../
UNAME_S := $(shell uname -s)
#ifeq ($(UNAME_S),Linux)
# Path to binaryninja install
BINJAPATH := $(HOME)/binaryninja/
CC := g++
#else
# BINJAPATH := /Applications/Binary\ Ninja.app/Contents/MacOS
# CC := $(shell xcrun -f clang++)
#endif
SRCDIR := src
BUILDDIR := build
TARGETDIR := bin
TARGETNAME := parser
TARGET := $(TARGETDIR)/$(TARGETNAME)
SRCEXT := cpp
SOURCES := $(shell find $(SRCDIR) -type f -name *.$(SRCEXT))
OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o))
LIBS := -L $(BINJAPATH) -lbinaryninjacore
CFLAGS := -c -std=gnu++11 -O2 -Wall -W -fPIC -pipe -ggdb
#ifeq ($(UNAME_S),Darwin)
# CFLAGS += -arch x86_64 -pipe -stdlib=libc++
#endif
all: $(TARGET)
#ifeq ($(UNAME_S),Linux)
$(TARGET): $(OBJECTS)
@mkdir -p $(TARGETDIR)
$(CC) $^ $(BINJA_API_A) $(LIBS) -Wl,-rpath=$(BINJAPATH) -ldl -o $@
#else
#$(TARGET): $(OBJECTS)
# @mkdir -p $(TARGETDIR)
# $(CC) $^ $(BINJA_API_A) $(LIBS) -o $@
# install_name_tool -change @rpath/libbinaryninjacore.dylib $(BINJAPATH)/libbinaryninjacore.dylib $@
#endif
$(BUILDDIR)/%.o: $(SRCDIR)/%.$(SRCEXT)
@mkdir -p $(BUILDDIR)
$(CC) $(CFLAGS) $(INC) -c -o $@ $<
clean:
$(RM) -r $(BUILDDIR) $(TARGETDIR)
.PHONY: clean