capstone/cstool/Makefile

48 lines
885 B
Makefile
Raw Normal View History

2016-10-11 08:50:51 +00:00
# Makefile for Cstool of Capstone Disassembly Engine
include ../functions.mk
2016-10-14 09:29:56 +00:00
.PHONY: clean all
2016-10-10 15:25:21 +00:00
LIBNAME = capstone
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)
LIBCAPSTONE = libcapstone.a
IS_CYGWIN := $(shell $(CC) -dumpmachine 2>/dev/null | grep -i cygwin | wc -l)
ifeq ($(IS_CYGWIN),1)
LIBCAPSTONE = capstone.lib
else
IS_MINGW := $(shell $(CC) --version 2>/dev/null | grep -i "\(mingw\|MSYS\)" | wc -l)
ifeq ($(IS_MINGW),1)
LIBCAPSTONE = capstone.lib
endif
endif
2016-10-14 09:29:56 +00:00
all: $(TARGET)
$(TARGET): ../$(LIBCAPSTONE) $(OBJECTS)
ifeq ($(V), 0)
$(call log,LINK,$@)
2016-10-14 09:29:56 +00:00
@${CC} $(OBJECTS) $(LDFLAGS) -o $@
else
2016-10-14 09:29:56 +00:00
${CC} $(OBJECTS) $(LDFLAGS) -o $@
endif
clean:
2016-11-08 02:56:18 +00:00
${RM} -rf *.o $(TARGET)
%.o: %.c
ifeq ($(V), 0)
$(call log,CC,$@)
2016-10-10 15:07:39 +00:00
@${CC} $(CFLAGS) -c $< -o $@
else
2016-10-10 15:07:39 +00:00
${CC} $(CFLAGS) -c $< -o $@
endif