Browse Source

add 'uninstall' make target

[skip ci]
Steffen Jaeckel 8 years ago
parent
commit
221f7f223d
3 changed files with 16 additions and 0 deletions
  1. 3 0
      makefile
  2. 4 0
      makefile.shared
  3. 9 0
      makefile_include.mk

+ 3 - 0
makefile

@@ -26,6 +26,7 @@ ifndef RANLIB
 RANLIB:=$(CROSS_COMPILE)ranlib
 endif
 INSTALL_CMD = install
+UNINSTALL_CMD = rm
 
 #Output filenames for various targets.
 ifndef LIBNAME
@@ -93,6 +94,8 @@ install: .common_install
 
 install_bins: .common_install_bins
 
+uninstall: .common_uninstall
+
 profile:
 	CFLAGS="$(CFLAGS) -fprofile-generate" $(MAKE) timing EXTRALIBS="$(EXTRALIBS) -lgcov"
 	./timing

+ 4 - 0
makefile.shared

@@ -25,6 +25,7 @@ ifndef LT
 endif
 LTCOMPILE = $(LT) --mode=compile --tag=CC $(CC)
 INSTALL_CMD = $(LT) --mode=install install
+UNINSTALL_CMD = $(LT) --mode=uninstall rm
 
 #Output filenames for various targets.
 ifndef LIBNAME
@@ -52,6 +53,9 @@ install: .common_install
 
 install_bins: .common_install_bins
 
+uninstall: .common_uninstall
+	rm $(DESTDIR)$(LIBPATH)/pkgconfig/libtomcrypt.pc
+
 test: $(LIBNAME) $(TOBJECTS)
 	$(LT) --mode=link --tag=CC $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $(TEST) $(TOBJECTS) $(LIBNAME) $(EXTRALIBS)
 

+ 9 - 0
makefile_include.mk

@@ -30,6 +30,9 @@ endif
 ifndef INSTALL_CMD
 $(error your makefile must define INSTALL_CMD)
 endif
+ifndef UNINSTALL_CMD
+$(error your makefile must define UNINSTALL_CMD)
+endif
 
 ifndef EXTRALIBS
 ifneq ($(shell echo $(CFLAGS) | grep USE_LTM),)
@@ -383,6 +386,12 @@ install_docs: doc/crypt.pdf
 install_hooks:
 	for s in `ls hooks/`; do ln -s ../../hooks/$$s .git/hooks/$$s; done
 
+
+HEADER_FILES=$(notdir $(HEADERS))
+.common_uninstall:
+	$(UNINSTALL_CMD) $(LIBPATH)/$(LIBNAME)
+	rm $(HEADER_FILES:%=$(INCPATH)/%)
+
 #This rule cleans the source tree of all compiled code, not including the pdf
 #documentation.
 clean: