Either all arch or only one of them
diff --git a/Makefile b/Makefile
index a79d3df..8deefb8 100644
--- a/Makefile
+++ b/Makefile
@@ -23,22 +23,35 @@
LIBOBJ =
LIBOBJ += cs.o utils.o SStream.o MCInstrDesc.o MCRegisterInfo.o
-ifneq (,$(findstring arm,$(CAPSTONE_ARCHS)))
+ifneq (,$(filter $(CAPSTONE_ARCH), arm all))
LIBOBJ += arch/ARM/ARMDisassembler.o arch/ARM/ARMInstPrinter.o arch/ARM/mapping.o
CFLAGS += -DCS_SUPPORT_ARM
+ifeq ($(CAPSTONE_ARCH), arm)
+ LIBNAME = capstone-arm
endif
-ifneq (,$(findstring x86,$(CAPSTONE_ARCHS)))
+endif
+ifneq (, $(filter $(CAPSTONE_ARCH), x86 all))
LIBOBJ += arch/X86/X86DisassemblerDecoder.o arch/X86/X86Disassembler.o arch/X86/X86IntelInstPrinter.o arch/X86/X86ATTInstPrinter.o arch/X86/mapping.o
CFLAGS += -DCS_SUPPORT_X86
+ifeq ($(CAPSTONE_ARCH), x86)
+ LIBNAME = capstone-x86
endif
-ifneq (,$(findstring mips,$(CAPSTONE_ARCHS)))
+endif
+ifneq (, $(filter $(CAPSTONE_ARCH), mips all))
LIBOBJ += arch/Mips/MipsDisassembler.o arch/Mips/MipsInstPrinter.o arch/Mips/mapping.o
- CFLAGS += -DCS_SUPPORT_AARCH64
-endif
-ifneq (,$(findstring aarch64,$(CAPSTONE_ARCHS)))
- LIBOBJ += arch/AArch64/AArch64BaseInfo.o arch/AArch64/AArch64Disassembler.o arch/AArch64/AArch64InstPrinter.o arch/AArch64/mapping.o
CFLAGS += -DCS_SUPPORT_MIPS
+ifeq ($(CAPSTONE_ARCH), mips)
+ LIBNAME = capstone-mips
endif
+endif
+ifneq (, $(filter $(CAPSTONE_ARCH), arm64 all))
+ LIBOBJ += arch/AArch64/AArch64BaseInfo.o arch/AArch64/AArch64Disassembler.o arch/AArch64/AArch64InstPrinter.o arch/AArch64/mapping.o
+ CFLAGS += -DCS_SUPPORT_AARCH64
+ifeq ($(CAPSTONE_ARCH), arm64)
+ LIBNAME = capstone-arm64
+endif
+endif
+
LIBOBJ += MCInst.o
EXT = so