1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-30 15:52:12 +01:00

Added Linux uninstall target

Simplified earlier changes

added -r option to RM definition

fixed white space
This commit is contained in:
Paul Jewell 2015-09-11 22:48:32 +01:00
parent d6fa0bbf35
commit 27376bb81d
2 changed files with 26 additions and 3 deletions

View File

@ -93,7 +93,7 @@ $(foreach var, $(SANITIZE_DEPRECATED_VARS), $(eval $(call SANITIZE_VAR,$(var),de
# Make sure this isn't being run as root unless installing (no whoami on Windows, but that is ok here)
ifeq ($(shell whoami 2>/dev/null),root)
ifeq ($(filter install,$(MAKECMDGOALS)),)
ifeq ($(filter install uninstall,$(MAKECMDGOALS)),)
ifndef FAKEROOTKEY
$(error You should not be running this as root)
endif

View File

@ -34,9 +34,10 @@ udevrulesdir := /etc/udev/rules.d
INSTALL = cp -a --no-preserve=ownership
LN = ln
LN_S = ln -s
RM_RF = rm -rf
RM_F = rm -f
.PHONY: install
install:
install: uninstall
@$(ECHO) " INSTALLING GCS TO $(DESTDIR)/)"
$(V1) $(MKDIR) -p $(DESTDIR)$(bindir)
$(V1) $(MKDIR) -p $(DESTDIR)$(libdir)
@ -57,3 +58,25 @@ ifneq ($(enable-udev-rules), no)
$(V1) $(MKDIR) -p $(DESTDIR)$(udevrulesdir)
$(V1) $(INSTALL) -T $(ROOT_DIR)/package/linux/45-uav.rules $(DESTDIR)$(udevrulesdir)/45-$(ORG_SMALL_NAME).rules
endif
# uninstall target to ensure no side effects from previous installations
.PHONY: uninstall
uninstall:
@$(ECHO) " UNINSTALLING GCS FROM $(DESTDIR)/)"
# Protect against inadvertant 'rm -rf /'
ifeq ($(GCS_SMALL_NAME),)
@$(ECHO) "Error in build configuration - GCS_SMALL_NAME not defined"
exit 1
endif
ifeq ($(ORG_SMALL_NAME),)
@$(ECHO) "Error in build configuration - ORG_SMALL_NAME not defined"
exit 1
endif
# ...safe to Proceed
$(V1) $(RM_RF) $(DESTDIR)$(bindir)/$(GCS_SMALL_NAME) # Remove application
$(V1) $(RM_RF) $(DESTDIR)$(libdir)/$(GCS_SMALL_NAME) # Remove libraries
$(V1) $(RM_RF) $(DESTDOR)$(datadir)/$(GCS_SMALL_NAME) # Remove other data
$(V1) $(RM_F) $(DESTDIR)$(datadir)/applications/$(ORG_SMALL_NAME).desktop
$(V1) $(RM_F) $(DESTDIR)$(datadir)/pixmaps/$(ORG_SMALL_NAME).png
$(V1) $(RM_F) $(DESTDIR)$(udevrulesdir)/45-$(ORG_SMALL_NAME).rules