From 3cbcfee4498359c07fe6d1530cc97f0c26833e72 Mon Sep 17 00:00:00 2001 From: Thomas Klaehn Date: Thu, 18 Jul 2019 11:45:44 +0200 Subject: [PATCH] Add uninstall make target --- Makefile | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 1b4e1a7..589ea17 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ CROSS_COMPILE ?= -TARGET_FILE ?= ftdi_gpio -STATIC_LIB_FILE ?= libftdi_gpio.a -DYNAMIC_LIB_FILE ?= libftdi_gpio.so +TARGET_FILE ?= gpio_ftdi +STATIC_LIB_FILE ?= libgpio_ftdi.a +DYNAMIC_LIB_FILE ?= libgpio_ftdi.so CC = $(CROSS_COMPILE)gcc CPP = $(CROSS_COMPILE)cpp @@ -19,8 +19,8 @@ UNIT_TEST_SRC_DIR = test/unit UNIT_TEST_OBJ_DIR = $(OBJ_DIR)/$(UNIT_TEST_SRC_DIR) PREFIX ?= /usr -LIB_INSTALL_DIR ?= $(PREFIX)/lib/ftdi_gpio -INC_INSTALL_DIR ?= $(PREFIX)/include/ftdi_gpio +LIB_INSTALL_DIR ?= $(PREFIX)/lib/gpio_ftdi +INC_INSTALL_DIR ?= $(PREFIX)/include/gpio_ftdi INCLUDES := inc INCLUDES += /usr/include/libftdi1 @@ -52,7 +52,7 @@ UNIT_TEST_TARGET = $(BIN_DIR)/$(UNIT_TEST_SRC_DIR)/$(TARGET_FILE) THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST)) -.PHONY: all install clean +.PHONY: all install uninstall clean all: $(STATIC_LIB) $(DYNAMIC_LIB) install: all @@ -62,6 +62,12 @@ install: all install -m 0777 $(DYNAMIC_LIB) $(LIB_INSTALL_DIR) install -m 0644 inc/* $(INC_INSTALL_DIR) +uninstall: + rm -f $(LIB_INSTALL_DIR)/$(STATIC_LIB) + rm -f $(LIB_INSTALL_DIR)/$(DYNAMIC_LIB) + rm -f $(addprefix $(INC_INSTALL_DIR)/,$(shell ls inc)) + rm -rf $(INC_INSTALL_DIR) + clean: rm -f $(STATIC_LIB) $(DYNAMIC_LIB) rm -f $(OBJS) $(patsubst %.o,%.d,$(OBJS))