cstool: compile/clean/install/uninstall from Makefile

This commit is contained in:
Nguyen Anh Quynh 2016-10-10 22:54:16 +08:00
parent 07337a708d
commit 2dbd079321
2 changed files with 24 additions and 2 deletions

View File

@ -74,6 +74,7 @@ LIBDIRARCH ?= lib
# Or better, pass 'LIBDIRARCH=lib64' to 'make install/uninstall' via 'make.sh'.
#LIBDIRARCH ?= lib64
LIBDIR ?= $(PREFIX)/$(LIBDIRARCH)
BINDIR = $(PREFIX)/bin
LIBDATADIR ?= $(LIBDIR)
@ -355,6 +356,7 @@ PKGCFGF = $(BLDIR)/$(LIBNAME).pc
all: $(LIBRARY) $(ARCHIVE) $(PKGCFGF)
ifeq (,$(findstring yes,$(CAPSTONE_BUILD_CORE_ONLY)))
@V=$(V) $(MAKE) -C cstool
ifndef BUILDDIR
cd tests && $(MAKE)
else
@ -414,16 +416,19 @@ endif
$(INSTALL_DATA) include/capstone/*.h $(DESTDIR)/$(INCDIR)/$(LIBNAME)
mkdir -p $(DESTDIR)/$(PKGCFGDIR)
$(INSTALL_DATA) $(PKGCFGF) $(DESTDIR)/$(PKGCFGDIR)
$(INSTALL_LIB) cstool/cstool $(DESTDIR)/$(BINDIR)
uninstall:
rm -rf $(DESTDIR)/$(INCDIR)/$(LIBNAME)
rm -f $(DESTDIR)/$(LIBDIR)/lib$(LIBNAME).*
rm -f $(DESTDIR)/$(PKGCFGDIR)/$(LIBNAME).pc
rm -f $(DESTDIR)/$(BINDIR)/cstool
clean:
rm -f $(LIBOBJ)
rm -f $(BLDIR)/lib$(LIBNAME).* $(BLDIR)/$(LIBNAME).*
rm -f $(PKGCFGF)
$(MAKE) -C cstool clean
ifeq (,$(findstring yes,$(CAPSTONE_BUILD_CORE_ONLY)))
cd tests && $(MAKE) clean

View File

@ -1,9 +1,26 @@
# Sample Makefile for Capstone Disassembly Engine
include ../functions.mk
.PHONY: clean
LIBNAME = capstone
cstool: cstool.o
${CC} $< -O3 -Wall -l$(LIBNAME) -o $@
ifeq ($(V),0)
$(call log,LINK,$@)
@${CC} $< -O3 -Wall -L.. -l$(LIBNAME) -o $@
else
${CC} $< -O3 -Wall -L.. -l$(LIBNAME) -o $@
endif
clean:
${RM} -rf *.o cstool
%.o: %.c
${CC} -c $< -o $@
ifeq ($(V),0)
$(call log,CC,$@)
@$(compile)
else
$(compile)
endif