Makefile: Add possibility to uninstall spdk.
Add uninstall target to makefiles to be able to perform reverse of install target. Fixes #464 This patch adds 'uninstall' target to makefile. 'make uninstall' will remove spdk_tgt app, headers, libraries and shared libraries from system directories defined by $DESTDIR. Additionaly, if there will be any empty directories left after this operation, they will be removed as well. Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com> Change-Id: I7b07fb4b81081d3914ff09165991fbe3a26b9067 Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/431471 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
7c00bdab97
commit
c4d9daeb7b
6
Makefile
6
Makefile
@ -44,7 +44,8 @@ DIRS-$(CONFIG_IPSEC_MB) += ipsecbuild
|
||||
DIRS-$(CONFIG_ISAL) += isalbuild
|
||||
|
||||
.PHONY: all clean $(DIRS-y) include/spdk/config.h mk/config.mk mk/cc.mk \
|
||||
cc_version cxx_version .libs_only_other .ldflags ldflags
|
||||
cc_version cxx_version .libs_only_other .ldflags ldflags install \
|
||||
uninstall
|
||||
|
||||
ifeq ($(SPDK_ROOT_DIR)/lib/env_dpdk,$(CONFIG_ENV))
|
||||
ifeq ($(CURDIR)/dpdk/build,$(CONFIG_DPDK_DIR))
|
||||
@ -77,6 +78,9 @@ clean: $(DIRS-y)
|
||||
install: all
|
||||
$(Q)echo "Installed to $(DESTDIR)$(CONFIG_PREFIX)"
|
||||
|
||||
uninstall: $(DIRS-y)
|
||||
$(Q)echo "Uninstalled spdk"
|
||||
|
||||
ifneq ($(SKIP_DPDK_BUILD),1)
|
||||
ifeq ($(CONFIG_ISAL),y)
|
||||
dpdkbuild: isalbuild
|
||||
|
@ -62,3 +62,6 @@ include $(SPDK_ROOT_DIR)/mk/spdk.app.mk
|
||||
|
||||
install: $(APP)
|
||||
$(INSTALL_APP)
|
||||
|
||||
uninstall:
|
||||
$(UNINSTALL_APP)
|
||||
|
17
autobuild.sh
17
autobuild.sh
@ -129,10 +129,23 @@ timing_enter make_install
|
||||
rm -rf /tmp/spdk
|
||||
mkdir /tmp/spdk
|
||||
$MAKE $MAKEFLAGS install DESTDIR=/tmp/spdk prefix=/usr
|
||||
ls -lR /tmp/spdk
|
||||
rm -rf /tmp/spdk
|
||||
timing_exit make_install
|
||||
|
||||
# Test 'make uninstall'
|
||||
timing_enter make_uninstall
|
||||
# Create empty file to check if it is not deleted by target uninstall
|
||||
touch /tmp/spdk/usr/lib/sample_xyz.a
|
||||
$MAKE $MAKEFLAGS uninstall DESTDIR=/tmp/spdk prefix=/usr
|
||||
if [[ $(ls -A /tmp/spdk/usr | wc -l) -ne 2 ]] || [[ $(ls -A /tmp/spdk/usr/lib/ | wc -l) -ne 1 ]]; then
|
||||
ls -lR /tmp/spdk
|
||||
rm -rf /tmp/spdk
|
||||
echo "Make uninstall failed"
|
||||
exit 1
|
||||
else
|
||||
rm -rf /tmp/spdk
|
||||
fi
|
||||
timing_exit make_uninstall
|
||||
|
||||
timing_enter doxygen
|
||||
if [ $SPDK_BUILD_DOC -eq 1 ] && hash doxygen; then
|
||||
$MAKE -C "$rootdir"/doc --no-print-directory $MAKEFLAGS &> "$out"/doxygen.log
|
||||
|
@ -34,7 +34,7 @@
|
||||
SPDK_ROOT_DIR := $(abspath $(CURDIR)/..)
|
||||
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
|
||||
|
||||
.PHONY: all clean install
|
||||
.PHONY: all clean install uninstall
|
||||
|
||||
CRYPTO_ENABLED=n
|
||||
|
||||
@ -123,3 +123,6 @@ clean:
|
||||
$(Q)rm -rf $(SPDK_ROOT_DIR)/dpdk/build
|
||||
|
||||
install: all
|
||||
|
||||
uninstall:
|
||||
@:
|
||||
|
@ -39,4 +39,7 @@ APP = identify
|
||||
install: $(APP)
|
||||
$(INSTALL_EXAMPLE)
|
||||
|
||||
uninstall:
|
||||
$(UNINSTALL_EXAMPLE)
|
||||
|
||||
include $(SPDK_ROOT_DIR)/mk/nvme.libtest.mk
|
||||
|
@ -54,4 +54,7 @@ endif
|
||||
install: $(APP)
|
||||
$(INSTALL_EXAMPLE)
|
||||
|
||||
uninstall:
|
||||
$(UNINSTALL_EXAMPLE)
|
||||
|
||||
include $(SPDK_ROOT_DIR)/mk/nvme.libtest.mk
|
||||
|
@ -37,8 +37,14 @@ include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
|
||||
HEADERS := $(wildcard $(SPDK_ROOT_DIR)/include/spdk/*.h)
|
||||
INSTALLED_HEADERS := $(patsubst $(SPDK_ROOT_DIR)/include%,$(DESTDIR)$(includedir)%,$(HEADERS))
|
||||
|
||||
$(DESTDIR)$(includedir)%.h:
|
||||
$(INSTALLED_HEADERS):
|
||||
ifeq ($(MAKECMDGOALS),install)
|
||||
$(INSTALL_HEADER)
|
||||
else
|
||||
$(UNINSTALL_HEADER)
|
||||
endif
|
||||
|
||||
.PHONY: $(INSTALLED_HEADERS)
|
||||
|
||||
all:
|
||||
@:
|
||||
@ -48,4 +54,6 @@ clean:
|
||||
|
||||
install: $(INSTALLED_HEADERS)
|
||||
|
||||
uninstall: $(INSTALLED_HEADERS)
|
||||
|
||||
include $(SPDK_ROOT_DIR)/mk/spdk.deps.mk
|
||||
|
@ -34,7 +34,7 @@
|
||||
SPDK_ROOT_DIR := $(abspath $(CURDIR)/..)
|
||||
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
|
||||
|
||||
.PHONY: all clean install
|
||||
.PHONY: all clean install uninstall
|
||||
|
||||
ifneq ($(Q),)
|
||||
REDIRECT=> /dev/null
|
||||
@ -45,5 +45,8 @@ all:
|
||||
|
||||
install: all
|
||||
|
||||
uninstall:
|
||||
@:
|
||||
|
||||
clean:
|
||||
$(Q)$(MAKE) -C $(SPDK_ROOT_DIR)/intel-ipsec-mb clean SHARED=n $(REDIRECT)
|
||||
|
@ -48,6 +48,9 @@ all: $(ISAL_DIR)/isa-l
|
||||
|
||||
install: all
|
||||
|
||||
uninstall:
|
||||
@:
|
||||
|
||||
clean:
|
||||
$(Q)$(MAKE) -C $(SPDK_ROOT_DIR)/isa-l clean $(REDIRECT)
|
||||
$(Q)rm -rf $(ISAL_DIR)/isa-l
|
||||
|
6
lib/bdev/ocf/env/Makefile
vendored
6
lib/bdev/ocf/env/Makefile
vendored
@ -65,6 +65,9 @@ $(LIB):
|
||||
|
||||
install:
|
||||
|
||||
uninstall:
|
||||
$(UNINSTALL_LIB)
|
||||
|
||||
else
|
||||
|
||||
.PHONY: all clean install ocf_inc ocf_src ocf_distclean all exportlib
|
||||
@ -91,6 +94,9 @@ $(LIB): $(OBJS)
|
||||
|
||||
install:
|
||||
|
||||
uninstall:
|
||||
$(UNINSTALL_LIB)
|
||||
|
||||
endif
|
||||
|
||||
exportlib: all
|
||||
|
@ -42,6 +42,12 @@ all : $(APP)
|
||||
|
||||
install: all
|
||||
|
||||
# To avoid overwriting warning
|
||||
empty_uninstall_rule:
|
||||
@:
|
||||
|
||||
uninstall: empty_uninstall_rule
|
||||
|
||||
$(APP) : $(OBJS) $(SPDK_LIB_FILES) $(ENV_LIBS)
|
||||
$(LINK_C)
|
||||
|
||||
|
@ -34,3 +34,6 @@
|
||||
include $(SPDK_ROOT_DIR)/mk/spdk.app_vars.mk
|
||||
|
||||
install: all
|
||||
|
||||
uninstall:
|
||||
@:
|
||||
|
@ -292,6 +292,12 @@ INSTALL_LIB=\
|
||||
install -d -m 755 "$(DESTDIR)$(libdir)"; \
|
||||
install -m 644 "$(LIB)" "$(DESTDIR)$(libdir)/"
|
||||
|
||||
# Uninstall a library
|
||||
UNINSTALL_LIB=\
|
||||
$(Q)echo " UNINSTALL $(DESTDIR)$(libdir)/$(notdir $(LIB))";\
|
||||
rm -f "$(DESTDIR)$(libdir)/$(notdir $(LIB))"; \
|
||||
if [ -d "$(DESTDIR)$(libdir)" ] && [ $$(ls -A "$(DESTDIR)$(libdir)" | wc -l) -eq 0 ]; then rm -rf "$(DESTDIR)$(libdir)"; fi
|
||||
|
||||
ifeq ($(OS),FreeBSD)
|
||||
INSTALL_REL_SYMLINK := install -l rs
|
||||
else
|
||||
@ -313,22 +319,50 @@ INSTALL_SHARED_LIB=\
|
||||
install -m $$perm_mode "$(SHARED_REALNAME_LIB)" "$(DESTDIR)$(libdir)/"; \
|
||||
$(call spdk_install_lib_symlink,$(notdir $(SHARED_REALNAME_LIB)),$(notdir $(SHARED_LINKED_LIB)));
|
||||
|
||||
# Uninstall an shared library
|
||||
UNINSTALL_SHARED_LIB=\
|
||||
$(Q)echo " UNINSTALL $(DESTDIR)$(libdir)/$(notdir $(SHARED_LINKED_LIB))"; \
|
||||
rm -f "$(DESTDIR)$(libdir)/$(notdir $(SHARED_LINKED_LIB))"; \
|
||||
rm -f "$(DESTDIR)$(libdir)/$(notdir $(SHARED_REALNAME_LIB))"; \
|
||||
if [ -d "$(DESTDIR)$(libdir)" ] && [ $$(ls -A "$(DESTDIR)$(libdir)" | wc -l) -eq 0 ]; then rm -rf "$(DESTDIR)$(libdir)"; fi
|
||||
|
||||
|
||||
# Install an app binary
|
||||
INSTALL_APP=\
|
||||
$(Q)echo " INSTALL $(DESTDIR)$(bindir)/$(APP)"; \
|
||||
install -d -m 755 "$(DESTDIR)$(bindir)"; \
|
||||
install -m 755 "$(APP)" "$(DESTDIR)$(bindir)/"
|
||||
|
||||
# Uninstall an app binary
|
||||
UNINSTALL_APP=\
|
||||
$(Q)echo " UNINSTALL $(DESTDIR)$(bindir)/$(notdir $(APP))"; \
|
||||
rm -f "$(DESTDIR)$(bindir)/$(notdir $(APP))"; \
|
||||
if [ -d "$(DESTDIR)$(bindir)" ] && [ $$(ls -A "$(DESTDIR)$(bindir)" | wc -l) -eq 0 ]; then rm -rf "$(DESTDIR)$(bindir)"; fi
|
||||
|
||||
INSTALL_EXAMPLE=\
|
||||
$(Q)echo " INSTALL $(DESTDIR)$(bindir)/spdk_$(strip $(subst /,_,$(subst $(SPDK_ROOT_DIR)/examples/, ,$(CURDIR))))"; \
|
||||
install -d -m 755 "$(DESTDIR)$(bindir)"; \
|
||||
install -m 755 "$(APP)" "$(DESTDIR)$(bindir)/spdk_$(strip $(subst /,_,$(subst $(SPDK_ROOT_DIR)/examples/, ,$(CURDIR))))"
|
||||
|
||||
# Uninstall an example binary
|
||||
UNINSTALL_EXAMPLE=\
|
||||
$(Q)echo " UNINSTALL $(DESTDIR)$(bindir)/spdk_$(strip $(subst /,_,$(subst $(SPDK_ROOT_DIR)/examples/, ,$(CURDIR))))"; \
|
||||
rm -f "$(DESTDIR)$(bindir)/spdk_$(strip $(subst /,_,$(subst $(SPDK_ROOT_DIR)/examples/, ,$(CURDIR))))"; \
|
||||
if [ -d "$(DESTDIR)$(bindir)" ] && [ $$(ls -A "$(DESTDIR)$(bindir)" | wc -l) -eq 0 ]; then rm -rf "$(DESTDIR)$(bindir)"; fi
|
||||
|
||||
# Install a header
|
||||
INSTALL_HEADER=\
|
||||
$(Q)echo " INSTALL $@"; \
|
||||
install -d -m 755 "$(DESTDIR)$(includedir)/$(dir $(patsubst $(DESTDIR)$(includedir)/%,%,$@))"; \
|
||||
install -m 644 "$(patsubst $(DESTDIR)$(includedir)/%,%,$@)" "$(DESTDIR)$(includedir)/$(dir $(patsubst $(DESTDIR)$(includedir)/%,%,$@))/"
|
||||
install -m 644 "$(patsubst $(DESTDIR)$(includedir)/%,%,$@)" "$(DESTDIR)$(includedir)/$(dir $(patsubst $(DESTDIR)$(includedir)/%,%,$@))";
|
||||
|
||||
# Uninstall a header
|
||||
UNINSTALL_HEADER=\
|
||||
$(Q)echo " UNINSTALL $@"; \
|
||||
rm -rf "$(DESTDIR)$(includedir)/$(dir $(patsubst $(DESTDIR)$(includedir)/%,%,$@))$(notdir $@)"; \
|
||||
if [ -d "$(DESTDIR)$(includedir)/$(dir $(patsubst $(DESTDIR)$(includedir)/%,%,$@))" ] \
|
||||
&& [ $$(ls -A "$(DESTDIR)$(includedir)/$(dir $(patsubst $(DESTDIR)$(includedir)/%,%,$@))" | wc -l) -eq 0 ]; \
|
||||
then rm -rf "$(DESTDIR)$(includedir)/$(dir $(patsubst $(DESTDIR)$(includedir)/%,%,$@))"; fi
|
||||
|
||||
%.o: %.c %.d $(MAKEFILE_LIST)
|
||||
$(COMPILE_C)
|
||||
|
@ -76,6 +76,12 @@ ifeq ($(CONFIG_SHARED),y)
|
||||
$(INSTALL_SHARED_LIB)
|
||||
endif
|
||||
|
||||
uninstall:
|
||||
$(UNINSTALL_LIB)
|
||||
ifeq ($(CONFIG_SHARED),y)
|
||||
$(UNINSTALL_SHARED_LIB)
|
||||
endif
|
||||
|
||||
include $(SPDK_ROOT_DIR)/mk/spdk.deps.mk
|
||||
|
||||
include $(SPDK_ROOT_DIR)/mk/spdk.subdirs.mk
|
||||
|
@ -46,3 +46,5 @@ $(DIRS-y) :
|
||||
$(foreach dir,$(ALL_DEPDIRS),$(eval $(call depdirs_rule,$(dir))))
|
||||
|
||||
install: all $(DIRS-y)
|
||||
|
||||
uninstall: $(DIRS-y)
|
||||
|
@ -64,3 +64,6 @@ clean:
|
||||
$(CLEAN_C) $(APP)
|
||||
|
||||
include $(SPDK_ROOT_DIR)/mk/spdk.deps.mk
|
||||
|
||||
uninstall:
|
||||
@:
|
||||
|
@ -52,7 +52,7 @@ $(SHARED_REALNAME_LIB):
|
||||
$(SHARED_LINKED_LIB) : $(SHARED_REALNAME_LIB)
|
||||
$(Q)echo " SYMLINK $(notdir $@)"; $(BUILD_LINKERNAME_LIB)
|
||||
|
||||
.PHONY: all clean $(DIRS-y)
|
||||
.PHONY: all clean $(DIRS-y) $(SHARED_LINKED_LIB) install uninstall
|
||||
|
||||
all: $(SHARED_LINKED_LIB)
|
||||
|
||||
@ -61,4 +61,7 @@ CLEAN_FILES += $(SHARED_REALNAME_LIB) $(SHARED_LINKED_LIB)
|
||||
install:
|
||||
$(INSTALL_SHARED_LIB)
|
||||
|
||||
uninstall:
|
||||
$(UNINSTALL_SHARED_LIB)
|
||||
|
||||
include $(SPDK_ROOT_DIR)/mk/spdk.subdirs.mk
|
||||
|
@ -50,3 +50,6 @@ clean :
|
||||
$(CLEAN_C) $(CXX_SRCS)
|
||||
|
||||
include $(SPDK_ROOT_DIR)/mk/spdk.deps.mk
|
||||
|
||||
uninstall:
|
||||
@:
|
||||
|
Loading…
x
Reference in New Issue
Block a user