unicorn/samples/Makefile

78 lines
1.5 KiB
Makefile
Raw Normal View History

2015-08-21 09:04:50 +02:00
# Unicorn Engine
# By Nguyen Anh Quynh <aquynh@gmail.com>, 2015
include ../config.mk
UNAME_S := $(shell uname -s)
2015-08-21 09:04:50 +02:00
# Find GLIB
ifndef GLIB
2015-09-04 13:56:35 +02:00
GLIB = $(shell pkg-config --libs glib-2.0)
2015-08-21 09:04:50 +02:00
endif
# Verbose output?
V ?= 0
2016-10-29 01:31:52 +02:00
CFLAGS += -Wall -Werror -I../include
LDFLAGS += -L..
LDLIBS += -lpthread -lunicorn -lm $(GLIB)
2015-08-21 09:04:50 +02:00
2016-10-29 01:31:52 +02:00
ifneq ($(CROSS),)
2015-08-21 09:04:50 +02:00
CC = $(CROSS)gcc
endif
ifeq ($(UNICORN_ASAN),yes)
2016-10-29 01:31:52 +02:00
CC = clang
CXX = clang++
AR = llvm-ar
2016-10-29 01:31:52 +02:00
CFLAGS += -fsanitize=address -fno-omit-frame-pointer
endif
2015-08-21 09:04:50 +02:00
# Cygwin?
ifneq ($(filter CYGWIN%,$(UNAME_S)),)
2015-08-21 09:04:50 +02:00
CFLAGS := $(CFLAGS:-fPIC=)
2016-10-29 01:31:52 +02:00
LDLIBS += -lssp
2015-08-21 09:04:50 +02:00
# mingw?
else ifneq ($(filter MINGW%,$(UNAME_S)),)
2015-08-21 09:04:50 +02:00
CFLAGS := $(CFLAGS:-fPIC=)
endif
2016-10-29 01:31:52 +02:00
.PHONY: all clean
2015-08-21 09:04:50 +02:00
UNICORN_ARCHS := $(shell if [ -e ../config.log ]; then cat ../config.log;\
2015-08-21 09:04:50 +02:00
else printf "$(UNICORN_ARCHS)"; fi)
SOURCES =
ifneq (,$(findstring arm,$(UNICORN_ARCHS)))
SOURCES += sample_arm.c
endif
ifneq (,$(findstring aarch64,$(UNICORN_ARCHS)))
SOURCES += sample_arm64.c
endif
ifneq (,$(findstring mips,$(UNICORN_ARCHS)))
SOURCES += sample_mips.c
endif
2016-10-29 01:31:52 +02:00
#ifneq (,$(findstring ppc,$(UNICORN_ARCHS)))
2015-08-21 09:04:50 +02:00
#SOURCES += sample_ppc.c
2016-10-29 01:31:52 +02:00
#endif
2015-08-21 09:04:50 +02:00
ifneq (,$(findstring sparc,$(UNICORN_ARCHS)))
SOURCES += sample_sparc.c
endif
ifneq (,$(findstring x86,$(UNICORN_ARCHS)))
SOURCES += sample_x86.c
SOURCES += shellcode.c
SOURCES += mem_apis.c
2016-03-24 16:56:13 +01:00
SOURCES += sample_x86_32_gdt_and_seg_regs.c
2016-04-05 05:52:26 +02:00
SOURCES += sample_batch_reg.c
2015-08-21 09:04:50 +02:00
endif
ifneq (,$(findstring m68k,$(UNICORN_ARCHS)))
SOURCES += sample_m68k.c
endif
2016-10-29 01:31:52 +02:00
BINS = $(SOURCES:.c=)
2015-08-21 09:04:50 +02:00
2016-10-29 01:31:52 +02:00
all: $(BINS)
2015-08-21 09:04:50 +02:00
2016-10-29 01:31:52 +02:00
clean:
rm -rf *.o $(BINS)