-
Notifications
You must be signed in to change notification settings - Fork 90
/
Makefile
130 lines (102 loc) · 3.45 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
include config.mk
ifeq ($(shell uname),Darwin)
BIN=build/iaito.app/Contents/MacOS/iaito
else
BIN=build/iaito
endif
#QMAKE_FLAGS+=IAITO_ENABLE_PYTHON=false
QMAKE_FLAGS+=-config release
#install_name_tool -change /path/to/Qt/lib/QtCore.framework/Versions/4.0/QtCore
# @executable_path/../Frameworks/QtCore.framework/Versions/4.0/QtCore
# plugandpaint.app/Contents/plugins/libpnp_basictools.dylib
ifeq ($(WANT_PYTHON),1)
QMAKE_FLAGS+=IAITO_ENABLE_PYTHON=true
endif
ifeq ($(WANT_PYTHON_BINDINGS),1)
QMAKE_FLAGS+=IAITO_ENABLE_PYTHON_BINDINGS=true
endif
QMAKE_FLAGS+=PREFIX=$(PREFIX)
all: iaito
CXX?=g++
reset:
rm -rf ~/.config/radareorg/iaito.conf
QTLIBS=$(shell grep "^LIBS" build/Makefile | cut -d = -f 2-)
R2LIBS=$(shell pkg-config --cflags --libs r_core)
R2_LIBEXT=$(shell r2 -H R2_LIBEXT)
R2_USER_PLUGINS=$(shell r2 -H R2_USER_PLUGINS)
plugin core_plugin: iaito
SUBLIBS=true $(CXX) build/*.o src/CorePlugin.cpp -shared -fPIC $(QTLIBS) $(R2LIBS) -o build/CorePlugin.$(R2_LIBEXT)
mkdir -p $(R2_USER_PLUGINS)
rm -f $(R2_USER_PLUGINS)/IaitoPlugin.$(R2_LIBEXT)
cp -f build/CorePlugin.$(R2_LIBEXT) $(R2_USER_PLUGINS)/IaitoPlugin.$(R2_LIBEXT)
asan:
export CXXFLAGS=-fsanitize=address ; \
export CFLAGS=-fsanitize=address ; \
export LDFLAGS=-fsanitize=address ; \
$(MAKE) build && $(MAKE) -C build -j4
clean:
rm -rf build
dist:
ifeq ($(shell uname),Darwin)
$(MAKE) -C dist/macos
else
$(MAKE) -C dist/debian
endif
mrproper: clean
git clean -xdf
.PHONY: install run user-install dist macos clean mrproper install-translations
# force qt5 build when QtCreator is installed in user's home
ifeq ($(shell test -x ~/Qt/5.*/clang_64/bin/qmake || echo err),)
QMAKE=~/Qt/5.*/clang_64/bin/qmake
endif
iaito: build
$(MAKE) -C build
build:
mkdir -p build
cd build && $(QMAKE) ../src/Iaito.pro $(QMAKE_FLAGS)
install-man:
mkdir -p "${DESTDIR}${MANDIR}/man1"
for FILE in src/*.1 ; do ${INSTALL_MAN} "$$FILE" "${DESTDIR}${MANDIR}/man1" ; done
install: build
ifeq ($(shell uname),Darwin)
rm -rf $(DESTDIR)/Applications/iaito.app
mkdir -p $(DESTDIR)/Applications
cp -rf build/iaito.app $(DESTDIR)/Applications/iaito.app
mkdir -p $(DESTDIR)/$(PREFIX)/bin
ln -fs '/Applications/iaito.app/Contents/MacOS/iaito' $(DESTDIR)/$(PREFIX)'/bin/iaito'
else
$(MAKE) -C build install INSTALL_ROOT=$(DESTDIR)
endif
$(MAKE) install-man
uninstall:
ifeq ($(shell uname),Darwin)
rm -rf $(DESTDIR)/Applications/iaito.app
rm -rf "$(DESTDIR)/$(PREFIX)/bin/iaito"
else
rm -rf "$(DESTDIR)/$(PREFIX)/share/iaito"
rm -rf "$(DESTDIR)/$(PREFIX)/bin/iaito"
endif
rm -f "${DESTDIR}$(MANDIR)/man1/iaito.1"
user-install: build
ifeq ($(shell uname),Darwin)
rm -rf ${HOME}/Applications/iaito.app
mkdir -p ${HOME}/Applications
cp -rf build/iaito.app ${HOME}/Applications/iaito.app
else
$(MAKE) -C build install INSTALL_ROOT=/ PREFIX=${HOME}/.local
endif
$(MAKE) install-man DESTDIR=/ PREFIX=${HOME}/.local MANDIR=${HOME}/.local/share/man
user-uninstall:
$(MAKE) uninstall DESTDIR=/ PREFIX=${HOME}/.local MANDIR=${HOME}/.local/share/man
run:
rarun2 libpath=$(shell r2 -H R2_LIBDIR) program=$(BIN)
gdb:
gdb --args $(BIN)
src/translations/README.md:
git clone https://github.com/radareorg/iaito-translations.git src/translations
install-translations: src/translations/README.md
$(MAKE) -C src/translations install PREFIX="$(DESTDIR)/$(PREFIX)"
user-install-translations: src/translations/README.md
$(MAKE) -C src/translations user-install
indent:
clang-format -i $(shell find src -name '*.cpp' -o -name '*.h')