From da6f5023ca19b3702240d0a95ba29a08a6295a0f Mon Sep 17 00:00:00 2001 From: Fabio Scotoni <34964387+fscoto@users.noreply.github.com> Date: Thu, 12 Dec 2019 09:58:05 +0100 Subject: [PATCH] makefile: Add LIBDIR option This is useful for multiarch, where you may have the library installed in a subdirectory of /usr/lib/, e.g. /usr/lib/x86_64-linux-gnu/. Debian and Ubuntu appear to make use of this extensively; having this in the makefile will avoid hacks when doing multiarch. Autotools has a similar feature (passing --libdir to configure). --- makefile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/makefile b/makefile index b17092e..e5f6dd4 100644 --- a/makefile +++ b/makefile @@ -2,7 +2,8 @@ CC=gcc -std=gnu99 # speed tests don't work with -std=cxx, they need the POSIX ex CFLAGS= -pedantic -Wall -Wextra -O3 -march=native DESTDIR= PREFIX=usr/local -PKGCONFIG=$(DESTDIR)/$(PREFIX)/lib/pkgconfig +LIBDIR=$(PREFIX)/lib +PKGCONFIG=$(DESTDIR)/$(LIBDIR)/pkgconfig MAN_DIR=$(DESTDIR)/$(PREFIX)/share/man/man3 SONAME=libmonocypher.so.3 @@ -23,15 +24,15 @@ endif all : library install: library src/monocypher.h install-doc mkdir -p $(DESTDIR)/$(PREFIX)/include - mkdir -p $(DESTDIR)/$(PREFIX)/lib + mkdir -p $(DESTDIR)/$(LIBDIR) mkdir -p $(PKGCONFIG) - cp -P lib/libmonocypher.a lib/libmonocypher.so* $(DESTDIR)/$(PREFIX)/lib + cp -P lib/libmonocypher.a lib/libmonocypher.so* $(DESTDIR)/$(LIBDIR) cp src/monocypher.h $(DESTDIR)/$(PREFIX)/include $(INSTALL_ED25519) @echo "Creating $(PKGCONFIG)/monocypher.pc" @echo "prefix=/$(PREFIX)" > $(PKGCONFIG)/monocypher.pc @echo 'exec_prefix=$${prefix}' >> $(PKGCONFIG)/monocypher.pc - @echo 'libdir=$${exec_prefix}/lib' >> $(PKGCONFIG)/monocypher.pc + @echo 'libdir=$(LIBDIR)' >> $(PKGCONFIG)/monocypher.pc @echo 'includedir=$${prefix}/include' >> $(PKGCONFIG)/monocypher.pc @echo '' >> $(PKGCONFIG)/monocypher.pc @echo 'Name: monocypher' >> $(PKGCONFIG)/monocypher.pc @@ -75,8 +76,8 @@ clean: rm -f *.out uninstall: - rm -f $(DESTDIR)/$(PREFIX)/lib/libmonocypher.a - rm -f $(DESTDIR)/$(PREFIX)/lib/libmonocypher.so* + rm -f $(DESTDIR)/$(LIBDIR)/libmonocypher.a + rm -f $(DESTDIR)/$(LIBDIR)/libmonocypher.so* rm -f $(DESTDIR)/$(PREFIX)/include/monocypher.h rm -f $(PKGCONFIG)/monocypher.pc rm -f $(MAN_DIR)/*.3monocypher -- 2.47.3