You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/dev-libs/libntru/files/libntru-0.3-Allow-building-...

79 lines
2.4 KiB

From 5cb48a5a1bf43c5d4811295aa3fb25744c4c254d Mon Sep 17 00:00:00 2001
From: Julian Ospald <hasufell@hasufell.de>
Date: Mon, 17 Nov 2014 23:25:31 +0100
Subject: [PATCH 3/6] Allow building and installing static lib
Refactored the install rules a bit, so that installing the static
lib optionally becomes a bit more convenient.
---
Makefile.linux | 36 ++++++++++++++++++++++++++++++------
1 file changed, 30 insertions(+), 6 deletions(-)
diff --git a/Makefile.linux b/Makefile.linux
index dbc4957..218162c 100644
--- a/Makefile.linux
+++ b/Makefile.linux
@@ -1,4 +1,5 @@
CC?=gcc
+AR?=ar
CFLAGS?=-g -O2
CFLAGS+=-Wall -Wextra -Wno-unused-parameter
LIBS+=-lrt
@@ -24,24 +25,47 @@ all: lib
lib: libntru.so
+static-lib: libntru.a
+
libntru.so: $(LIB_OBJS_PATHS)
$(CC) $(CFLAGS) $(CPPFLAGS) -shared -Wl,-soname,libntru.so -o libntru.so $(LIB_OBJS_PATHS) $(LDFLAGS) $(LIBS)
-install: lib
- test -d "$(DESTDIR)$(INST_PFX)" || mkdir -p "$(DESTDIR)$(INST_PFX)"
- test -d "$(DESTDIR)$(INST_LIBDIR)" || mkdir "$(DESTDIR)$(INST_LIBDIR)"
- test -d "$(DESTDIR)$(INST_INCLUDE)" || mkdir -p "$(DESTDIR)$(INST_INCLUDE)"
- test -d "$(DESTDIR)$(INST_DOCDIR)" || mkdir -p "$(DESTDIR)$(INST_DOCDIR)"
+libntru.a: $(LIB_OBJS_PATHS)
+ $(AR) cru libntru.a $(LIB_OBJS_PATHS)
+
+install: install-lib install-doc install-headers
+
+install-lib: lib
+ test -d "$(DESTDIR)$(INST_LIBDIR)" || mkdir -p "$(DESTDIR)$(INST_LIBDIR)"
install -m 0755 libntru.so "$(DESTDIR)$(INST_LIBDIR)/libntru.so"
+
+install-static-lib: static-lib
+ test -d "$(DESTDIR)$(INST_LIBDIR)" || mkdir -p "$(DESTDIR)$(INST_LIBDIR)"
+ install -m 0755 libntru.a "$(DESTDIR)$(INST_LIBDIR)/libntru.a"
+
+install-doc:
+ test -d "$(DESTDIR)$(INST_DOCDIR)" || mkdir -p "$(DESTDIR)$(INST_DOCDIR)"
install -m 0644 README.md "$(DESTDIR)$(INST_DOCDIR)/README.md"
+
+install-headers:
+ test -d "$(DESTDIR)$(INST_INCLUDE)" || mkdir -p "$(DESTDIR)$(INST_INCLUDE)"
for header in $(INST_HEADERS) ; do \
install -m 0644 "$(SRCDIR)/$$header" "$(DESTDIR)$(INST_INCLUDE)/" ; \
done
-uninstall:
+uninstall: uninstall-lib uninstall-doc uninstall-headers
+
+uninstall-lib:
rm -f "$(DESTDIR)$(INST_LIBDIR)/libntru.so"
+
+uninstall-static-lib:
+ rm -f "$(DESTDIR)$(INST_LIBDIR)/libntru.a"
+
+uninstall-doc:
rm -f "$(DESTDIR)$(INST_DOCDIR)/README.md"
rmdir "$(DESTDIR)$(INST_DOCDIR)/"
+
+uninstall-headers:
for header in $(INST_HEADERS) ; do \
rm "$(DESTDIR)$(INST_INCLUDE)/$$header" ; \
done
--
2.1.3