summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Lamoureux <andrew@vector35.com>2017-03-15 18:13:07 -0400
committerAndrew Lamoureux <andrew@vector35.com>2017-03-15 18:13:07 -0400
commit1f7523ce2b1edac1014d781fc771d5b82568e2f1 (patch)
treee9595f3a8683461bc0c1e452788183fd7462c4a8
parent84357311117be3002bc3dd0e402ca32eb81d4cf0 (diff)
build explanation, windows make files
-rw-r--r--Makefile.win23
-rw-r--r--README.md13
-rw-r--r--examples/bin-info/Makefile.win9
-rw-r--r--examples/breakpoint/Makefile.win16
-rw-r--r--examples/print_syscalls/Makefile.win9
5 files changed, 70 insertions, 0 deletions
diff --git a/Makefile.win b/Makefile.win
new file mode 100644
index 00000000..ea95ba7b
--- /dev/null
+++ b/Makefile.win
@@ -0,0 +1,23 @@
+CFLAGS = /EHsc /DWIN32
+
+TARGETDIR = bin
+TARGETNAME = libbinaryninjaapi.lib
+TARGET = .\$(TARGETDIR)\$(TARGETNAME)
+
+OBJS = architecture.obj backgroundtask.obj basicblock.obj binaryninjaapi.obj binaryreader.obj binaryview.obj binaryviewtype.obj binarywriter.obj callingconvention.obj databuffer.obj demangle.obj fileaccessor.obj filemetadata.obj function.obj functiongraph.obj functiongraphblock.obj functionrecognizer.obj interaction.obj log.obj lowlevelil.obj mainthread.obj platform.obj plugin.obj scriptingprovider.obj tempfile.obj transform.obj type.obj update.obj jsoncpp.obj
+
+$(TARGET): $(OBJS)
+ if not exist $(TARGETDIR) mkdir $(TARGETDIR)
+ lib $(OBJS) /OUT:$(TARGET)
+
+jsoncpp.obj: json\jsoncpp.cpp
+ cl $(CFLAGS) /I. /c json\jsoncpp.cpp
+
+# nmake "inference rules" are gnu make "pattern rules"
+.cpp.obj:
+ cl $(CFLAGS) /c $<
+
+clean:
+ if exist *.obj del *.obj
+ if exist $(TARGETDIR) del /Q /S $(TARGETDIR)
+
diff --git a/README.md b/README.md
index 0bb4ee9b..be6c0b47 100644
--- a/README.md
+++ b/README.md
@@ -12,3 +12,16 @@ If interested in contributing, first please read and sign the [Contribution Lice
The issue tracker for this repository tracks not only issues with the source code contained here but also the broader Binary Ninja product.
+## Building
+
+Starting mid March 2017, the C++ portion of this API can be built into a static library (.a, .lib) that binary plugins can link against. Use Makefile on MacOS, Linux, and Windows mingw environments, and Makefile.win (nmake file) for Windows Visual Studio environment (nmake -f).
+
+The compiled API contains names and functions you can use from your plugins, but most of the implementation is missing until you link up against libbinaryninjacore.dylib or libbinaryninjacore.dll (via import file libbinaryninjacore.lib). See the ./examples.
+
+Since BinaryNinja is a 64-bit only product, ensure that you are using a 64-bit compiling and linking environment. Errors on windows like LNK1107 might indicate that your bits don't match.
+
+## Examples
+
+* bin-info is a standalone executable that prints some information about a given binary to stdout
+* breakpoint is a plugin that allows you to select a region within an x86 binary and use the context menu to fill it with breakpoint bytes
+* print_syscalls is a standalone executable that prints the syscalls used in a given binary
diff --git a/examples/bin-info/Makefile.win b/examples/bin-info/Makefile.win
new file mode 100644
index 00000000..b65bfb86
--- /dev/null
+++ b/examples/bin-info/Makefile.win
@@ -0,0 +1,9 @@
+BINJA_API_INC_PATH = ..\..\
+BINJA_API_LIB = ..\..\bin\libbinaryninjaapi.lib
+BINJA_CORE_LIB = "c:\Program Files\Vector35\BinaryNinja\binaryninjacore.lib"
+
+FLAGS = /DWIN32 /D__WIN32__ /EHsc /I$(BINJA_API_INC_PATH) /link $(BINJA_API_LIB) $(BINJA_CORE_LIB)
+
+bininfo: ./src/bin-info.cpp
+ if not exist bin mkdir bin
+ cl ./src/bin-info.cpp $(FLAGS) /Fe:.\bin\bininfo
diff --git a/examples/breakpoint/Makefile.win b/examples/breakpoint/Makefile.win
new file mode 100644
index 00000000..00cbbfa1
--- /dev/null
+++ b/examples/breakpoint/Makefile.win
@@ -0,0 +1,16 @@
+BINJA_API_INC_PATH = ..\..\
+BINJA_API_LIB = ..\..\bin\libbinaryninjaapi.lib
+BINJA_CORE_LIB = "c:\Program Files\Vector35\BinaryNinja\binaryninjacore.lib"
+
+FLAGS = /DWIN32 /D__WIN32__ /EHsc /I$(BINJA_API_INC_PATH) /link $(BINJA_API_LIB) $(BINJA_CORE_LIB)
+
+bininfo.dll: ./src/breakpoint.cpp
+ if not exist bin mkdir bin
+ cl ./src/breakpoint.cpp /LD $(FLAGS) /OUT:.\bin\breakpoint.dll
+
+clean:
+ if exist *.obj del *.obj
+ if exist *.exp del *.exp
+ if exist *.lib del *.lib
+ if exist *.dll del *.dll
+ if exist .\bin del /S /Q bin
diff --git a/examples/print_syscalls/Makefile.win b/examples/print_syscalls/Makefile.win
new file mode 100644
index 00000000..afc0cbd8
--- /dev/null
+++ b/examples/print_syscalls/Makefile.win
@@ -0,0 +1,9 @@
+BINJA_API_INC_PATH = ..\..\
+BINJA_API_LIB = ..\..\bin\libbinaryninjaapi.lib
+BINJA_CORE_LIB = "c:\Program Files\Vector35\BinaryNinja\binaryninjacore.lib"
+
+FLAGS = /DWIN32 /D__WIN32__ /EHsc /I$(BINJA_API_INC_PATH) /link $(BINJA_API_LIB) $(BINJA_CORE_LIB)
+
+print_syscalls: ./src/arm-syscall.cpp
+ if not exist bin mkdir bin
+ cl ./src/arm-syscall.cpp $(FLAGS) /Fe:.\bin\print_syscalls