From 848b4889274edb2ec6ef6218f3d8b55288dc4151 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 9 Jun 2020 12:40:24 +0200 Subject: build: Fix for failing 'make uninstall' Support for uninstalling is severely broken: - extensions/GNUmakefile.in defines an 'install' target but lacks a respective 'uninstall' one, causing 'make uninstall' abort with an error message. - iptables/Makefile.am defines an 'install-exec-hook' to create the binary symlinks which are left in place after 'make uninstall'. Fix these problems by defining respective targets containing code copied from automake-generated uninstall targets. While being at it, add a few more uninstall-hooks removing custom directories created by 'make install' if they are empty afterwards. Reported-by: Richard Guy Briggs Signed-off-by: Phil Sutter Tested-by: Richard Guy Briggs --- iptables/Makefile.am | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'iptables/Makefile.am') diff --git a/iptables/Makefile.am b/iptables/Makefile.am index 2024dbf5..bab094b7 100644 --- a/iptables/Makefile.am +++ b/iptables/Makefile.am @@ -111,3 +111,26 @@ install-exec-hook: for i in ${v6_sbin_links}; do ${LN_S} -f xtables-legacy-multi "${DESTDIR}${sbindir}/$$i"; done; for i in ${x_sbin_links}; do ${LN_S} -f xtables-nft-multi "${DESTDIR}${sbindir}/$$i"; done; ${LN_S} -f iptables-apply "${DESTDIR}${sbindir}/ip6tables-apply" + +uninstall-hook: + dir=${DESTDIR}${bindir}; { \ + test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; \ + } || { \ + test -z "${vx_bin_links}" || ( \ + cd "$$dir" && rm -f ${vx_bin_links} \ + ) \ + } + dir=${DESTDIR}${sbindir}; { \ + test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; \ + } || { \ + test -z "${v4_sbin_links}" || ( \ + cd "$$dir" && rm -f ${v4_sbin_links} \ + ); \ + test -z "${v6_sbin_links}" || ( \ + cd "$$dir" && rm -f ${v6_sbin_links} \ + ); \ + test -z "${x_sbin_links}" || ( \ + cd "$$dir" && rm -f ${x_sbin_links} \ + ); \ + ( cd "$$dir" && rm -f ip6tables-apply ); \ + } -- cgit v1.2.3