Makefile: make it possible to avoid building static/shared library
diff --git a/Makefile b/Makefile
index ebf6332..9c8743d 100644
--- a/Makefile
+++ b/Makefile
@@ -253,8 +253,12 @@
 endif
 endif
 
+ifeq ($(CAPSTONE_SHARED),yes)
 LIBRARY = $(BLDIR)/lib$(LIBNAME).$(EXT)
+endif
+ifeq ($(CAPSTONE_STATIC),yes)
 ARCHIVE = $(BLDIR)/lib$(LIBNAME).$(AR_EXT)
+endif
 PKGCFGF = $(BLDIR)/$(LIBNAME).pc
 
 .PHONY: all clean install uninstall dist
@@ -265,8 +269,11 @@
 else
 	$(MAKE) -C tests BUILDDIR=$(BLDIR)
 endif
+ifeq ($(CAPSTONE_SHARED),yes)
 	$(INSTALL_DATA) $(BLDIR)/lib$(LIBNAME).$(EXT) $(BLDIR)/tests/
+endif
 
+ifeq ($(CAPSTONE_SHARED),yes)
 $(LIBRARY): $(LIBOBJ)
 ifeq ($(V),0)
 	$(call log,CCLD,$(@:$(BLDIR)/%=%))
@@ -274,6 +281,7 @@
 else
 	$(create-library)
 endif
+endif
 
 $(LIBOBJ): config.mk
 
@@ -285,6 +293,7 @@
 $(LIBOBJ_SYSZ): $(DEP_SYSZ)
 $(LIBOBJ_X86): $(DEP_X86)
 
+ifeq ($(CAPSTONE_STATIC),yes)
 $(ARCHIVE): $(LIBOBJ)
 	@rm -f $(ARCHIVE)
 ifeq ($(V),0)
@@ -293,6 +302,7 @@
 else
 	$(create-archive)
 endif
+endif
 
 $(PKGCFGF):
 ifeq ($(V),0)
@@ -304,6 +314,7 @@
 
 install: $(PKGCFGF) $(ARCHIVE) $(LIBRARY)
 	mkdir -p $(LIBDIR)
+ifeq ($(CAPSTONE_SHARED),yes)
 	# remove potential broken old libs
 	rm -f $(LIBDIR)/lib$(LIBNAME).*
 	$(INSTALL_LIB) $(BLDIR)/lib$(LIBNAME).$(EXT) $(LIBDIR)
@@ -312,7 +323,10 @@
 	mv lib$(LIBNAME).$(EXT) lib$(LIBNAME).$(VERSION_EXT) && \
 	ln -s lib$(LIBNAME).$(VERSION_EXT) lib$(LIBNAME).$(EXT)
 endif
+endif
+ifeq ($(CAPSTONE_STATIC),yes)
 	$(INSTALL_DATA) $(BLDIR)/lib$(LIBNAME).$(AR_EXT) $(LIBDIR)
+endif
 	mkdir -p $(INCDIR)/$(LIBNAME)
 	$(INSTALL_DATA) include/*.h $(INCDIR)/$(LIBNAME)
 	mkdir -p $(PKGCFGDIR)