cstool: compile/clean/install/uninstall from Makefile

v3
Nguyen Anh Quynh 8 years ago
parent a5ff4bd263
commit 346032797a
  1. 6
      Makefile
  2. 21
      cstool/Makefile

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

@ -1,9 +1,26 @@
# Sample Makefile for Capstone Disassembly Engine # Sample Makefile for Capstone Disassembly Engine
include ../functions.mk
.PHONY: clean
LIBNAME = capstone LIBNAME = capstone
cstool: cstool.o 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 %.o: %.c
${CC} -c $< -o $@ ifeq ($(V),0)
$(call log,CC,$@)
@$(compile)
else
$(compile)
endif

Loading…
Cancel
Save