34 lines
1.2 KiB
Diff
34 lines
1.2 KiB
Diff
|
From 74700b2c04adcdfa9b081526c514859b62304ecd Mon Sep 17 00:00:00 2001
|
||
|
From: Sven-Hendrik Haase <svenstaro@gmail.com>
|
||
|
Date: Thu, 4 May 2023 03:42:21 +0200
|
||
|
Subject: [PATCH] Proper installation paths
|
||
|
|
||
|
It's Makefile convention to be able to install to `DESTDIR`. This is especially important for packaging on Linux distributions but might be convenient for other users as well. Also this introduces `PREFIX`, another convention.
|
||
|
---
|
||
|
Makefile | 7 +++++--
|
||
|
1 file changed, 5 insertions(+), 2 deletions(-)
|
||
|
|
||
|
diff --git a/Makefile b/Makefile
|
||
|
index 5ac4d7e..a0df9aa 100644
|
||
|
--- a/Makefile
|
||
|
+++ b/Makefile
|
||
|
@@ -1,5 +1,7 @@
|
||
|
LIBTOOL ?= libtool
|
||
|
-LIBDIR ?= /usr/lib
|
||
|
+PREFIX ?= /usr
|
||
|
+INCLUDEDIR ?= ${PREFIX}/include/pystring
|
||
|
+LIBDIR ?= ${PREFIX}/lib
|
||
|
CXX ?= g++
|
||
|
CXXFLAGS ?= -g -O3 -Wall -Wextra -Wshadow -Wconversion -Wcast-qual -Wformat=2
|
||
|
|
||
|
@@ -12,7 +14,8 @@ libpystring.la: pystring.lo
|
||
|
$(LIBTOOL) --mode=link --tag=CXX $(CXX) -o $@ $< -rpath $(LIBDIR)
|
||
|
|
||
|
install: libpystring.la
|
||
|
- $(LIBTOOL) --mode=install install -c $< $(LIBDIR)/$<
|
||
|
+ $(LIBTOOL) --mode=install install -Dm755 $< $(DESTDIR)$(LIBDIR)/$<
|
||
|
+ $(LIBTOOL) --mode=install install -Dm644 pystring.h $(DESTDIR)$(INCLUDEDIR)/pystring.h
|
||
|
|
||
|
clean:
|
||
|
$(RM) -fr pystring.lo pystring.o libpystring.la .libs
|