diff options
author | Rich Salz <rsalz@openssl.org> | 2015-01-12 10:28:05 -0500 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2015-01-12 10:28:05 -0500 |
commit | 9405a9a2e1594cea9c963c29d9898bb03cb0f24f (patch) | |
tree | daf20aa2848dc699281ec9b7bf95db91467e4ed0 | |
parent | 732192a0796c4ecbef3b13ccc8ee8ab23e28f483 (diff) | |
download | openssl-new-9405a9a2e1594cea9c963c29d9898bb03cb0f24f.tar.gz |
RT478: Add uninstall make target
Add INSTALLDIRS variable, list of directories where things get
installed. Change install_html_docs to use perl mkdir-p script.
Add uninstall, uninstall_sw, uninstall_docs, uninstall_html_docs
to Makefile.org. The actions of these targets were figured out
by "inverting" the install target.
Recurse into subdirs to do uninstall as needed. Added uninstall
targets whose actions were similarly figured out by "inverting"
the install target.
Also remove some 'space before tab' complaints in Makefile.org
Reviewed-by: Tim Hudson <tjh@openssl.org>
-rw-r--r-- | Makefile.org | 132 | ||||
-rw-r--r-- | apps/Makefile | 13 | ||||
-rw-r--r-- | crypto/Makefile | 2 | ||||
-rw-r--r-- | ssl/Makefile | 2 | ||||
-rw-r--r-- | test/Makefile | 2 | ||||
-rw-r--r-- | tools/Makefile | 12 |
6 files changed, 146 insertions, 17 deletions
diff --git a/Makefile.org b/Makefile.org index f2460dc180..2e4c76ee82 100644 --- a/Makefile.org +++ b/Makefile.org @@ -68,6 +68,8 @@ AR=ar $(ARFLAGS) r RANLIB= ranlib NM= nm PERL= perl +#RM= echo -- +RM= rm -f TAR= tar TARFLAGS= --no-recursion MAKEDEPPROG=makedepend @@ -181,6 +183,17 @@ WTARFILE= $(NAME)-win.tar EXHEADER= e_os2.h HEADER= e_os.h +# Directories created on install if they don't exist. +INSTALLDIRS= \ + $(INSTALL_PREFIX)$(INSTALLTOP)/bin \ + $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR) \ + $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines \ + $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig \ + $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \ + $(INSTALL_PREFIX)$(OPENSSLDIR)/misc \ + $(INSTALL_PREFIX)$(OPENSSLDIR)/certs \ + $(INSTALL_PREFIX)$(OPENSSLDIR)/private + all: Makefile build_all openssl.pc libssl.pc libcrypto.pc # as we stick to -e, CLEARENV ensures that local variables in lower @@ -219,7 +232,7 @@ BUILDENV= PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)' \ SHLIB_EXT='$(SHLIB_EXT)' SHLIB_TARGET='$(SHLIB_TARGET)' \ PEX_LIBS='$(PEX_LIBS)' EX_LIBS='$(EX_LIBS)' \ CPUID_OBJ='$(CPUID_OBJ)' BN_ASM='$(BN_ASM)' \ - EC_ASM='$(EC_ASM)' DES_ENC='$(DES_ENC)' \ + EC_ASM='$(EC_ASM)' DES_ENC='$(DES_ENC)' \ AES_ENC='$(AES_ENC)' CMLL_ENC='$(CMLL_ENC)' \ BF_ENC='$(BF_ENC)' CAST_ENC='$(CAST_ENC)' \ RC4_ENC='$(RC4_ENC)' RC5_ENC='$(RC5_ENC)' \ @@ -243,13 +256,13 @@ BUILDENV= PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)' \ # This macro shouldn't be used directly, use RECURSIVE_BUILD_CMD or # BUILD_ONE_CMD instead. # -# BUILD_ONE_CMD is a macro to build a given target in a given -# subdirectory if that subdirectory is part of $(DIRS). It requires -# exactly the same shell variables as BUILD_CMD. -# # RECURSIVE_BUILD_CMD is a macro to build a given target in all # subdirectories defined in $(DIRS). It requires that the target # is given through the shell variable `target'. +# +# BUILD_ONE_CMD is a macro to build a given target in a given +# subdirectory if that subdirectory is part of $(DIRS). It requires +# exactly the same shell variables as BUILD_CMD. BUILD_CMD= if [ -d "$$dir" ]; then \ ( cd $$dir && echo "making $$target in $$dir..." && \ $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. DIR=$$dir $$target \ @@ -614,15 +627,10 @@ dist_pem_h: install: all install_docs install_sw +uninstall: uninstall_sw uninstall_docs + install_sw: - @$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \ - $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR) \ - $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines \ - $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig \ - $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \ - $(INSTALL_PREFIX)$(OPENSSLDIR)/misc \ - $(INSTALL_PREFIX)$(OPENSSLDIR)/certs \ - $(INSTALL_PREFIX)$(OPENSSLDIR)/private + @$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALLDIRS) @set -e; headerlist="$(EXHEADER)"; for i in $$headerlist;\ do \ (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ @@ -664,9 +672,9 @@ install_sw: *ssl*) i=ssleay32.dll;; \ esac; \ echo installing $$i; \ - cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \ - chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \ - mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \ + cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \ + chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \ + mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \ fi; \ fi; \ done; \ @@ -687,6 +695,45 @@ install_sw: cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc +uninstall_sw: + cd include/openssl && files=* && cd $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl && $(RM) $$files + @for i in $(LIBS) ;\ + do \ + test -f "$$i" && \ + echo $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i && \ + $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \ + done; + @if [ -n "$(SHARED_LIBS)" ]; then \ + tmp="$(SHARED_LIBS)"; \ + for i in $${tmp:-x}; \ + do \ + if [ -f "$$i" -o -f "$$i.a" ]; then \ + if expr "$(PLATFORM)" : "Cygwin" >/dev/null; then \ + c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \ + echo $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \ + $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \ + echo $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \ + $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \ + else \ + echo $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \ + $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \ + fi; \ + if expr $(PLATFORM) : 'mingw' > /dev/null; then \ + case $$i in \ + *crypto*) i=libeay32.dll;; \ + *ssl*) i=ssleay32.dll;; \ + esac; \ + echo $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i; \ + $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i; \ + fi; \ + fi; \ + done; \ + fi + $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc + $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc + $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc + @target=uninstall; $(RECURSIVE_BUILD_CMD) + install_html_docs: here="`pwd`"; \ filecase=; \ @@ -694,7 +741,7 @@ install_html_docs: filecase=-i; \ esac; \ for subdir in apps crypto ssl; do \ - mkdir -p $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \ + $(PERL) $(TOP)/util/mkdir-p $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \ for i in doc/$$subdir/*.pod; do \ fn=`basename $$i .pod`; \ echo "installing html/$$fn.$(HTMLSUFFIX)"; \ @@ -712,6 +759,24 @@ install_html_docs: done; \ done +uninstall_html_docs: + here="`pwd`"; \ + filecase=; \ + case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \ + filecase=-i; \ + esac; \ + for subdir in apps crypto ssl; do \ + for i in doc/$$subdir/*.pod; do \ + fn=`basename $$i .pod`; \ + $(RM) $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir/$$fn.$(HTMLSUFFIX); \ + $(PERL) util/extract-names.pl < $$i | \ + grep -v $$filecase "^$$fn\$$" | \ + while read n; do \ + $(RM) $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir/"$$n".$(HTMLSUFFIX); \ + done; \ + done; \ + done + install_docs: @$(PERL) $(TOP)/util/mkdir-p.pl \ $(INSTALL_PREFIX)$(MANDIR)/man1 \ @@ -758,4 +823,37 @@ install_docs: done); \ done +uninstall_docs: + @here="`pwd`"; \ + filecase=; \ + case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*) \ + filecase=-i; \ + esac; \ + for i in doc/apps/*.pod; do \ + fn=`basename $$i .pod`; \ + sec=`$(PERL) util/extract-section.pl 1 < $$i`; \ + echo $(RM) $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \ + $(RM) $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \ + $(PERL) util/extract-names.pl < $$i | \ + (grep -v $$filecase "^$$fn\$$"; true) | \ + (grep -v "[ ]"; true) | \ + while read n; do \ + echo $(RM) $(INSTALL_PREFIX)$(MANDIR)/man$$sec/"$$n".$${sec}$(MANSUFFIX); \ + $(RM) $(INSTALL_PREFIX)$(MANDIR)/man$$sec/"$$n".$${sec}$(MANSUFFIX); \ + done; \ + done; \ + for i in doc/crypto/*.pod doc/ssl/*.pod; do \ + fn=`basename $$i .pod`; \ + sec=`$(PERL) util/extract-section.pl 3 < $$i`; \ + echo $(RM) $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \ + $(RM) $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \ + $(PERL) util/extract-names.pl < $$i | \ + (grep -v $$filecase "^$$fn\$$"; true) | \ + (grep -v "[ ]"; true) | \ + while read n; do \ + echo $(RM) $(INSTALL_PREFIX)$(MANDIR)/man$$sec/"$$n".$${sec}$(MANSUFFIX); \ + $(RM) $(INSTALL_PREFIX)$(MANDIR)/man$$sec/"$$n".$${sec}$(MANSUFFIX); \ + done; \ + done + # DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/apps/Makefile b/apps/Makefile index 6ced2bd0eb..4270659c43 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -117,6 +117,19 @@ install: chmod 644 $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf.new; \ mv -f $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf.new $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf +uninstall: + @set -e; for i in $(EXE); \ + do \ + echo $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i; \ + $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i; \ + done; + @set -e; for i in $(SCRIPTS); \ + do \ + echo $(RM) $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i; \ + $(RM) $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i; \ + done + $(RM) $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf + tags: ctags $(SRC) diff --git a/crypto/Makefile b/crypto/Makefile index d4c7712ffd..5e6a0c3329 100644 --- a/crypto/Makefile +++ b/crypto/Makefile @@ -124,6 +124,8 @@ install: done; @target=install; $(RECURSIVE_MAKE) +uninstall: + lint: @target=lint; $(RECURSIVE_MAKE) diff --git a/ssl/Makefile b/ssl/Makefile index 0a7a1a382d..087f7968dc 100644 --- a/ssl/Makefile +++ b/ssl/Makefile @@ -79,6 +79,8 @@ install: chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ done; +uninstall: + tags: ctags $(SRC) diff --git a/test/Makefile b/test/Makefile index 8d952390c0..176bf70a9a 100644 --- a/test/Makefile +++ b/test/Makefile @@ -135,6 +135,8 @@ errors: install: +uninstall: + tags: ctags $(SRC) diff --git a/tools/Makefile b/tools/Makefile index 4ca835c4af..19950d14e5 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -33,6 +33,18 @@ install: mv -f $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i.new $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i ); \ done; +uninstall: + @for i in $(APPS) ; \ + do \ + echo $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i; \ + $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i; \ + done; + @for i in $(MISC_APPS) ; \ + do \ + echo $(RM) $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i; \ + $(RM) $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i; \ + done; + files: $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO |