2013-11-27 04:11:31 +00:00
|
|
|
# Capstone Disassembler Engine
|
|
|
|
# By Nguyen Anh Quynh <aquynh@gmail.com>, 2013>
|
|
|
|
|
|
|
|
INCDIR = ../include
|
|
|
|
LIBDIR = ..
|
|
|
|
|
2014-01-16 13:07:59 +00:00
|
|
|
ifeq ($(CROSS),)
|
|
|
|
CC ?= cc
|
|
|
|
else
|
|
|
|
CC = $(CROSS)gcc
|
|
|
|
endif
|
|
|
|
|
2014-01-16 11:08:49 +00:00
|
|
|
|
2013-11-27 04:11:31 +00:00
|
|
|
CFLAGS += -fPIC -O3 -Wall -I$(INCDIR) -L$(LIBDIR)
|
|
|
|
|
|
|
|
LIBNAME = capstone
|
|
|
|
|
2013-11-28 18:22:50 +00:00
|
|
|
BIN_EXT =
|
2014-01-09 07:49:44 +00:00
|
|
|
AR_EXT = a
|
2013-11-28 18:22:50 +00:00
|
|
|
|
|
|
|
# Cygwin?
|
|
|
|
IS_CYGWIN := $(shell $(CC) -dumpmachine | grep -i cygwin | wc -l)
|
|
|
|
ifeq ($(IS_CYGWIN),1)
|
|
|
|
CFLAGS := $(CFLAGS:-fPIC=)
|
|
|
|
BIN_EXT = .exe
|
2014-01-09 07:49:44 +00:00
|
|
|
AR_EXT = dll.a
|
2013-11-28 18:22:50 +00:00
|
|
|
else
|
|
|
|
# mingw?
|
|
|
|
IS_MINGW := $(shell $(CC) --version | grep -i mingw | wc -l)
|
|
|
|
ifeq ($(IS_MINGW),1)
|
|
|
|
CFLAGS := $(CFLAGS:-fPIC=)
|
|
|
|
BIN_EXT = .exe
|
2014-01-09 07:49:44 +00:00
|
|
|
AR_EXT = dll.a
|
2013-11-28 18:22:50 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: all clean
|
2013-11-27 04:11:31 +00:00
|
|
|
|
2014-01-04 16:00:05 +00:00
|
|
|
SOURCES = test.c test_detail.c test_x86.c test_arm64.c test_arm.c test_mips.c test_ppc.c
|
2013-11-28 08:46:15 +00:00
|
|
|
OBJS = $(SOURCES:.c=.o)
|
2013-11-28 18:22:50 +00:00
|
|
|
BINARY = $(SOURCES:.c=$(BIN_EXT))
|
2013-11-28 03:57:51 +00:00
|
|
|
|
2013-11-28 18:22:50 +00:00
|
|
|
all: $(BINARY)
|
2013-11-27 04:11:31 +00:00
|
|
|
|
|
|
|
clean:
|
2014-01-09 07:49:44 +00:00
|
|
|
rm -rf $(OBJS) $(SOURCES:.c=) *.exe *.static lib$(LIBNAME).*
|
2013-11-28 08:46:15 +00:00
|
|
|
|
2013-11-28 18:22:50 +00:00
|
|
|
$(BINARY): $(OBJS)
|
2013-11-28 08:46:15 +00:00
|
|
|
|
2013-11-28 18:22:50 +00:00
|
|
|
%$(BIN_EXT): %.o
|
2014-01-03 04:13:48 +00:00
|
|
|
${CC} $(CFLAGS) $(LDFLAGS) $< -O3 -Wall -l$(LIBNAME) -o $@
|
2014-01-09 07:49:44 +00:00
|
|
|
${CC} $(CFLAGS) $(LDFLAGS) $< -O3 -Wall ../lib$(LIBNAME).$(AR_EXT) -o $(subst $(BIN_EXT),,$@).static$(BIN_EXT)
|
2013-11-27 04:11:31 +00:00
|
|
|
|
2013-11-28 18:22:50 +00:00
|
|
|
%.o: %.c
|
2013-11-27 04:11:31 +00:00
|
|
|
${CC} ${CFLAGS} -c $< -o $@
|