File: Makefile

package info (click to toggle)
unicorn-engine 2.1.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 23,912 kB
  • sloc: ansic: 379,830; python: 9,213; sh: 9,011; java: 8,609; ruby: 4,241; pascal: 1,805; haskell: 1,379; xml: 490; cs: 424; makefile: 348; cpp: 298; asm: 64
file content (46 lines) | stat: -rw-r--r-- 1,182 bytes parent folder | download | duplicates (2)
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
# Makefile for the native JNI library. Automatically called by Maven.

JAVA_HOME ?= $(shell java -XshowSettings:properties -version 2>&1 | sed -n 's/ *java.home = //p')

ifeq ($(JAVA_HOME),)
  $(error JAVA_HOME could not be determined; please set it manually (make JAVA_HOME=...))
endif

JAVA_INC := $(JAVA_HOME)/include
JAVA_PLATFORM_INC := $(shell dirname `find $(JAVA_INC) -name jni_md.h`)
UNICORN_INC := ../../include

OS := $(shell uname)
ifeq ($(OS),Darwin)
   LIB_EXT=.dylib
else ifeq ($(OS),Linux)
   LIB_EXT=.so
else
   LIB_EXT=.dll
endif

all: libunicorn_java$(LIB_EXT)

CC=gcc
CFLAGS=-fPIC
LDFLAGS=-shared -fPIC
# May also use -lunicorn to dynamically link against the installed unicorn
LIBS=../../build/libunicorn.a
INCS=-I target/headers -I$(JAVA_INC) -I$(JAVA_PLATFORM_INC) -I$(UNICORN_INC)

OBJS=unicorn_Unicorn.o

unicorn_Unicorn.o: unicorn_Unicorn.c target/headers/unicorn_Unicorn.h
	$(CC) -O2 -Wall -Wextra -Wno-unused-parameter -c $(CFLAGS) $(INCS) $< -o $@

libunicorn_java$(LIB_EXT): $(OBJS)
	$(CC) -o $@ $(LDFLAGS) $(OBJS) $(LIBS)

gen_const:
	cd .. && python3 const_generator.py java

clean:
	rm -f libunicorn_java$(LIB_EXT)
	rm -f $(OBJS)

.PHONY: all clean