]> git.codecow.com Git - Monocypher.git/commitdiff
makefile: Add LIBDIR option
authorFabio Scotoni <34964387+fscoto@users.noreply.github.com>
Thu, 12 Dec 2019 08:58:05 +0000 (09:58 +0100)
committerFabio Scotoni <34964387+fscoto@users.noreply.github.com>
Thu, 12 Dec 2019 08:58:05 +0000 (09:58 +0100)
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

index b17092e1eb1d654c0ce6e2ac1f3a6b6e34144777..e5f6dd4c48f8ab4bbed2594867ca30efcd89445f 100644 (file)
--- 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