renamed CAPSTONE_NO_ATT to CAPSTONE_X86_ATT_DISABLE, added options to makefile, cmake, compile.txt

This commit is contained in:
baguette 2014-08-17 20:59:05 +02:00
parent 4f412c4483
commit 86e845056d
6 changed files with 20 additions and 3 deletions

View File

@ -22,6 +22,7 @@ option(SYSZ_SUPPORT "SystemZ support" ON)
option(XCORE_SUPPORT "XCore support" ON)
option(X86_SUPPORT "x86 support" ON)
option(X86_REDUCE "x86 with reduce instruction sets to minimize library" OFF)
option(X86_ATT_DISABLE, "Disable x86 AT&T syntax" OFF)
if (BUILD_DIET)
add_definitions(-DCAPSTONE_DIET)
@ -35,6 +36,10 @@ if (X86_REDUCE)
add_definitions(-DCAPSTONE_X86_REDUCE)
endif ()
if (X86_ATT_DISABLE)
add_definitions(-DCAPSTONE_X86_ATT_DISABLE)
endif ()
## sources
set(SOURCES
cs.c

View File

@ -21,12 +21,13 @@ Capstone requires no prerequisite packages, so it is easy to compile & install.
The other way of customize Capstone without having to edit config.mk is to
pass the desired options on the commandline to ./make.sh. Currently,
Capstone supports 4 options, as followings.
Capstone supports 5 options, as followings.
- CAPSTONE_ARCHS: specify list of architectures to compiled in.
- CAPSTONE_USE_SYS_DYN_MEM: change this if you have your own dynamic memory management.
- CAPSTONE_DIET: use this to make the output binaries more compact.
- CAPSTONE_X86_REDUCE: another option to make X86 binary smaller.
- CAPSTONE_X86_ATT_DISABLE: disables AT&T syntax on x86
By default, Capstone use system dynamic memory management, and both DIET and X86_REDUCE
modes are disable.

View File

@ -33,6 +33,10 @@ else
CFLAGS ?= -O3
endif
ifneq (,$(findstring yes,$(CAPSTONE_X86_ATT_DISABLE)))
CFLAGS += -DCAPSTONE_X86_ATT_DISABLE
endif
CFLAGS += -fPIC -Wall -Iinclude
ifeq ($(CAPSTONE_USE_SYS_DYN_MEM),yes)
@ -201,7 +205,9 @@ ifneq (,$(findstring x86,$(CAPSTONE_ARCHS)))
LIBOBJ_X86 += $(OBJDIR)/arch/X86/X86IntelInstPrinter.o
# assembly syntax is irrelevant in Diet mode, when this info is suppressed
ifeq (,$(findstring yes,$(CAPSTONE_DIET)))
ifeq (,$(findstring yes,$(CAPSTONE_X86_ATT_DISABLE)))
LIBOBJ_X86 += $(OBJDIR)/arch/X86/X86ATTInstPrinter.o
endif
endif
LIBOBJ_X86 += $(OBJDIR)/arch/X86/X86Mapping.o
LIBOBJ_X86 += $(OBJDIR)/arch/X86/X86Module.o

View File

@ -16,7 +16,7 @@
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2014 */
// this code is only relevant when DIET mode is disable
#if defined(CAPSTONE_HAS_X86) && !defined(CAPSTONE_DIET) && !defined(CAPSTONE_NO_ATT)
#if defined(CAPSTONE_HAS_X86) && !defined(CAPSTONE_DIET) && !defined(CAPSTONE_X86_ATT_DISABLE)
#include <ctype.h>
#include <inttypes.h>

View File

@ -44,7 +44,7 @@ static cs_err option(cs_struct *handle, cs_opt_type type, size_t value)
break;
case CS_OPT_SYNTAX_ATT:
#if !defined(CAPSTONE_DIET) && !defined(CAPSTONE_NO_ATT)
#if !defined(CAPSTONE_DIET) && !defined(CAPSTONE_X86_ATT_DISABLE)
handle->printer = X86_ATT_printInst;
handle->syntax = CS_OPT_SYNTAX_ATT;
break;

View File

@ -55,6 +55,11 @@ CAPSTONE_DIET ?= no
CAPSTONE_X86_REDUCE ?= no
################################################################################
# Change 'CAPSTONE_X86_ATT_DISABLE = no' to 'CAPSTONE_X86_ATT_DISABLE = yes' to
# disable AT&T syntax on x86 to reduce library size.
CAPSTONE_X86_ATT_DISABLE ?= no
################################################################################
# Change 'CAPSTONE_STATIC = yes' to 'CAPSTONE_STATIC = no' to avoid building