aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-10-25 21:21:43 +0200
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-10-25 21:33:38 +0200
commit4c88cb098a1496b70c920e1ea0b57b9cf1d5fe17 (patch)
tree4bec58027ac98e26fdd9dcab19377afa42128aed /Makefile
parent4cd86ad23bd10ceaf104db8dcced43f2ca0fbb38 (diff)
Makefile: Adhere to GNU Make directory variablesshared
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile32
1 files changed, 17 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index 4d6e65a..4d53d66 100644
--- a/Makefile
+++ b/Makefile
@@ -14,9 +14,11 @@
.POSIX:
-PREFIX = /usr/local
-DST = $(PREFIX)/lib
-PC_DST = $(DST)/pkgconfig
+prefix = /usr/local
+exec_prefix = $(prefix)
+includedir = $(prefix)/include
+libdir = $(exec_prefix)/lib
+pkgcfgdir = $(libdir)/pkgconfig
PROJECT = libdynstr
MAJOR_VERSION = 0
MINOR_VERSION = 1
@@ -33,15 +35,15 @@ DEPS = \
all: $(PROJECT_A) $(PROJECT_SO)
-install: all $(PC_DST)/dynstr.pc
- mkdir -p $(PREFIX)/include
- cp include/dynstr.h $(PREFIX)/include
- chmod 0644 $(PREFIX)/include/dynstr.h
- mkdir -p $(DST)
- cp $(PROJECT_A) $(PROJECT_SO) $(DST)
- chmod 0755 $(DST)/$(PROJECT_A) $(DST)/$(PROJECT_SO)
- ln -s $(DST)/$(PROJECT_SO) $(DST)/$(PROJECT_SO_FQ)
- ln -s $(DST)/$(PROJECT_SO) $(DST)/$(PROJECT_SO_NV)
+install: all $(pkgcfgdir)/dynstr.pc
+ mkdir -p $(DESTDIR)$(includedir)
+ cp include/dynstr.h $(DESTDIR)$(includedir)
+ chmod 0644 $(DESTDIR)$(includedir)/dynstr.h
+ mkdir -p $(DESTDIR)$(libdir)
+ cp $(PROJECT_A) $(PROJECT_SO) $(DESTDIR)$(libdir)
+ chmod 0755 $(libdir)/$(PROJECT_A) $(DESTDIR)$(libdir)/$(PROJECT_SO)
+ ln -s $(DESTDIR)$(libdir)/$(PROJECT_SO) $(DESTDIR)$(libdir)/$(PROJECT_SO_FQ)
+ ln -s $(DESTDIR)$(libdir)/$(PROJECT_SO) $(DESTDIR)$(libdir)/$(PROJECT_SO_NV)
clean:
rm -f $(DEPS)
@@ -52,7 +54,7 @@ $(PROJECT_A): $(DEPS)
$(PROJECT_SO): $(DEPS)
$(CC) $(LDFLAGS) $(DEPS) -o $@
-$(PC_DST)/dynstr.pc: dynstr.pc
- mkdir -p $(PC_DST)
- sed -e 's,/usr/local,$(PREFIX),' $< > $@
+$(pkgcfgdir)/dynstr.pc: dynstr.pc
+ mkdir -p $(DESTDIR)$(pkgcfgdir)
+ sed -e 's,/usr/local,$(DESTDIR)$(prefix),' $< > $@
chmod 0644 $@