-
Notifications
You must be signed in to change notification settings - Fork 164
/
Makefile
117 lines (102 loc) · 3.92 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
SHELL=/bin/bash
export DESTDIR=/
export PREFIX=usr/local
PYTHON ?=python3
PYPATH =python
NPKPATH =lib
MLPATH =ocaml
TESTPATH = test
DPREFIX =$(PREFIX)
DOCMLPATH =../../doc/generated/ocaml
DOCPYPATH =../doc/generated/python
DOCGENPATH =doc/generated
MLLIBDIR=../../python/idabincat
IDAPATH ?= $(HOME)/ida-6.95
IDAUSR ?= $(HOME)/.idapro
C2NPK := ../ocaml/build/c2newspeak
all:
@echo "Compiling OCaml part................................................."
@make -C $(MLPATH) all DEBUG=$(DEBUG) STATIC=$(STATIC)
@echo "Building python part................................................."
@make -C $(PYPATH) all
@echo "Building headers......................................................"
@make -C $(NPKPATH) all C2NPK=$(C2NPK)
install: all
@echo "Installing Ocaml part................................................"
make -C $(MLPATH) install
@echo "Installing Python part..............................................."
make -C $(PYPATH) install
IDAuser:
@echo "Copying pybincat and idabincat inside IDA Python ...................."
rm -rf "${IDAUSR}/plugins/pybincat"
mkdir -p "${IDAUSR}/plugins"
cp -r python/pybincat "${IDAUSR}/plugins/pybincat"
rm -rf "${IDAUSR}/plugins/idabincat"
cp -r python/idabincat "${IDAUSR}/plugins/idabincat"
rm -f "${IDAUSR}/plugins/bcplugin.py"
cp python/idabincat/bcplugin.py "${IDAUSR}/plugins/bcplugin.py"
mkdir -p $(IDAUSR)/idabincat
cp -r "python/idabincat/conf" "${IDAUSR}/idabincat"
# .no file
cp -r lib "${IDAUSR}/idabincat"
test: all
make -C $(TESTPATH) test
doc: all
@mkdir -p doc/generated
@echo "Generating OCaml documentation......................................."
@make -C $(MLPATH) DOCPATH=$(DOCMLPATH) doc
@echo "Generating Python documentation......................................"
@make -C $(PYPATH) DOCPATH=$(DOCPYPATH) copydoc
clean:
@echo "Cleaning OCaml part.................................................."
@make -C $(MLPATH) clean || true
@echo "Cleaning lib........................................................."
@make -C $(NPKPATH) clean || true
@echo "Cleaning python part................................................."
@make -C $(PYPATH) clean || true
echo "Cleaning documentation................................................"
-rm -rf $(DOCGENPATH)
-rm -rf $(PYPATH)/tests/__pycache__
-rm -rf bincat-dist
-rm -f bincat.tar.gz
dist: clean
@echo "Making distribution.................................................."
mkdir bincat-dist
cp Makefile README.md CHANGELOG bincat-dist
cp -r python bincat-dist
cp -r ocaml bincat-dist
cp -r doc bincat-dist
tar -czf bincat.tar.gz bincat-dist
windist: all
ifneq ($(OS),Windows_NT)
$(error "windist only works on Windows.")
else
@echo "Making Windows binary release."
$(eval distdir := bincat-win-$(shell git describe --tags --dirty))
mkdir -p $(distdir)/bin
cp "$(shell ldd ocaml/build/bincat|perl -nle 'print $$1 if /.*=> (.*libgmp.*) \(.*\)/')" "$(distdir)/bin"
cp ocaml/build/bincat "$(distdir)/bin/bincat.exe"
cp ocaml/build/c2newspeak "$(distdir)/bin/c2newspeak.exe"
cp -r python/build/lib/ "$(distdir)/python"
cp -r python/idabincat/conf/ "$(distdir)/python/idabincat"
mkdir -p "$(distdir)"/python/idabincat/lib
cp -r lib/*.no "$(distdir)/python/idabincat/lib"
cp -r python/install_plugin.py README.md CHANGELOG doc "$(distdir)"
endif
lindist: STATIC=1
lindist: clean all
@echo "Making Linux binary release."
$(eval distdir := bincat-linux-$(shell git describe --tags --dirty))
mkdir -p "$(distdir)/bin"
cp ocaml/build/bincat "$(distdir)/bin/bincat"
cp ocaml/build/c2newspeak "$(distdir)/bin/c2newspeak"
cp -r python/build/lib* "$(distdir)/python"
cp -r python/idabincat/conf/ "$(distdir)/python/idabincat"
mkdir "$(distdir)/python/idabincat/lib"
cp -r lib/*.no "$(distdir)/python/idabincat/lib"
cp -r python/install_plugin.py README.md CHANGELOG doc "$(distdir)"
tar cvJf "$(distdir).tar.xz" "$(distdir)"
-rm -rf "$(distdir)"
tags:
otags -vi -r ocaml
.PHONY: install clean tags