From 1752d00c5f076886e66a00eed5e98ab350d7a7c3 Mon Sep 17 00:00:00 2001 From: Tom Chapple Date: Sat, 17 Feb 2024 13:26:10 +1100 Subject: [PATCH] Define `install` and `uninstall` targets These targets are useful for moving the Gearsystem executable into a directory located on PATH. These targets aim to adhere to [Makefile Conventions][1], but have stripped those features that are unnecessary, given the only output is a single executable. This has been defined in a separate includable Makefile as these targets tend to be only applicable to Linux builds. Other distributions may include this as well if it is applicable. [1]: --- platforms/desktop-shared/Makefile.install | 23 +++++++++++++++++++++++ platforms/linux/Makefile | 1 + 2 files changed, 24 insertions(+) create mode 100644 platforms/desktop-shared/Makefile.install diff --git a/platforms/desktop-shared/Makefile.install b/platforms/desktop-shared/Makefile.install new file mode 100644 index 00000000..7ae8fb20 --- /dev/null +++ b/platforms/desktop-shared/Makefile.install @@ -0,0 +1,23 @@ +prefix ?= /usr/local +exec_prefix ?= $(prefix) +bindir ?= $(exec_prefix)/bin + +INSTALL ?= install +INSTALL_PROGRAM ?= $(INSTALL) +INSTALL_DATA ?= ${INSTALL} -m 644 + +install: $(TARGET) + $(PRE_INSTALL) + + $(NORMAL_INSTALL) + $(INSTALL_PROGRAM) -D $(TARGET) $(DESTDIR)$(bindir)/$(TARGET) + + $(POST_INSTALL) + +uninstall: + $(PRE_UNINSTALL) + + $(NORMAL_UNINSTALL) + rm $(DESTDIR)$(bindir)/$(TARGET) + + $(POST_UNINSTALL) diff --git a/platforms/linux/Makefile b/platforms/linux/Makefile index a6edcaea..34192529 100644 --- a/platforms/linux/Makefile +++ b/platforms/linux/Makefile @@ -5,3 +5,4 @@ CPPFLAGS += `pkg-config --cflags gtk+-3.0` LDFLAGS += `pkg-config --libs gtk+-3.0` include ../desktop-shared/Makefile.common +include ../desktop-shared/Makefile.install