Add uninstall make target

This commit is contained in:
Thomas Klaehn 2019-07-18 11:45:44 +02:00
parent 62fc41d5c9
commit 3cbcfee449

View File

@ -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))