2016-10-11 08:50:51 +00:00
|
|
|
# Makefile for Cstool of Capstone Disassembly Engine
|
2016-10-10 07:16:56 +00:00
|
|
|
|
2016-10-10 14:54:16 +00:00
|
|
|
include ../functions.mk
|
|
|
|
|
2016-10-14 09:29:56 +00:00
|
|
|
.PHONY: clean all
|
2016-10-10 14:54:16 +00:00
|
|
|
|
2016-10-10 15:25:21 +00:00
|
|
|
LIBNAME = capstone
|
|
|
|
|
2017-08-29 00:23:03 +00:00
|
|
|
CFLAGS += -I../include -I.
|
|
|
|
LDFLAGS += -O3 -Wall -L.. -l$(LIBNAME)
|
2016-10-10 15:07:39 +00:00
|
|
|
|
2016-10-14 09:29:56 +00:00
|
|
|
TARGET = cstool
|
|
|
|
SOURCES := $(wildcard *.c)
|
|
|
|
OBJECTS := $(SOURCES:.c=.o)
|
|
|
|
|
2017-06-02 13:49:10 +00:00
|
|
|
LIBCAPSTONE = libcapstone.a
|
2017-05-25 15:10:19 +00:00
|
|
|
|
|
|
|
IS_CYGWIN := $(shell $(CC) -dumpmachine 2>/dev/null | grep -i cygwin | wc -l)
|
|
|
|
ifeq ($(IS_CYGWIN),1)
|
2017-06-02 13:49:10 +00:00
|
|
|
LIBCAPSTONE = capstone.lib
|
2017-05-25 15:10:19 +00:00
|
|
|
else
|
2018-12-20 07:09:27 +00:00
|
|
|
IS_MINGW := $(shell $(CC) --version 2>/dev/null | grep -i "\(mingw\|MSYS\)" | wc -l)
|
2017-05-25 15:10:19 +00:00
|
|
|
ifeq ($(IS_MINGW),1)
|
2017-06-02 13:49:10 +00:00
|
|
|
LIBCAPSTONE = capstone.lib
|
2017-05-25 15:10:19 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2016-10-14 09:29:56 +00:00
|
|
|
all: $(TARGET)
|
|
|
|
|
2017-06-02 13:49:10 +00:00
|
|
|
$(TARGET): ../$(LIBCAPSTONE) $(OBJECTS)
|
2019-02-03 06:34:20 +00:00
|
|
|
ifeq ($(V), 0)
|
2016-10-10 14:54:16 +00:00
|
|
|
$(call log,LINK,$@)
|
2016-10-14 09:29:56 +00:00
|
|
|
@${CC} $(OBJECTS) $(LDFLAGS) -o $@
|
2016-10-10 14:54:16 +00:00
|
|
|
else
|
2016-10-14 09:29:56 +00:00
|
|
|
${CC} $(OBJECTS) $(LDFLAGS) -o $@
|
2016-10-10 14:54:16 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
clean:
|
2016-11-08 02:56:18 +00:00
|
|
|
${RM} -rf *.o $(TARGET)
|
2019-07-29 06:15:05 +00:00
|
|
|
${RM} -f *.d
|
2016-10-10 07:16:56 +00:00
|
|
|
|
|
|
|
%.o: %.c
|
2019-02-03 06:34:20 +00:00
|
|
|
ifeq ($(V), 0)
|
2016-10-10 14:54:16 +00:00
|
|
|
$(call log,CC,$@)
|
2016-10-10 15:07:39 +00:00
|
|
|
@${CC} $(CFLAGS) -c $< -o $@
|
2016-10-10 14:54:16 +00:00
|
|
|
else
|
2016-10-10 15:07:39 +00:00
|
|
|
${CC} $(CFLAGS) -c $< -o $@
|
2016-10-10 14:54:16 +00:00
|
|
|
endif
|