From 221f7f223db5cf570c4d3c9faf8e6857d1b9ab53 Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Mon, 10 Jul 2017 10:16:35 +0200 Subject: [PATCH] add 'uninstall' make target [skip ci] --- makefile | 3 +++ makefile.shared | 4 ++++ makefile_include.mk | 9 +++++++++ 3 files changed, 16 insertions(+) diff --git a/makefile b/makefile index f0a5b68..7bd3453 100644 --- a/makefile +++ b/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 diff --git a/makefile.shared b/makefile.shared index 0a69bf9..bb83c9f 100644 --- a/makefile.shared +++ b/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) diff --git a/makefile_include.mk b/makefile_include.mk index 0dacc3f..a7ec042 100644 --- a/makefile_include.mk +++ b/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: