aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-11-04 20:45:30 +0100
committerMattias Andrée <maandree@operamail.com>2014-11-04 20:45:30 +0100
commitb4639f132c633f131ed7f63977a553a561492812 (patch)
tree183182c637bf94ad0fe9623773587d58317718ad
parentlist optimisation flags to try out (not filtered, contains all defined by gcc) (diff)
downloadlibkeccak-b4639f132c633f131ed7f63977a553a561492812.tar.gz
libkeccak-b4639f132c633f131ed7f63977a553a561492812.tar.bz2
libkeccak-b4639f132c633f131ed7f63977a553a561492812.tar.xz
compile so file
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--Makefile27
1 files changed, 25 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 3844beb..19f4feb 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,13 @@
# without any warranty.
+# The version of the library.
+LIB_MAJOR = 1
+LIB_MINOR = 0
+LIB_VERSION = $(LIB_MAJOR).$(LIB_MINOR)
+
+
+
WARN = -Wall -Wextra -pedantic -Wdouble-promotion -Wformat=2 -Winit-self -Wmissing-include-dirs \
-Wtrampolines -Wfloat-equal -Wshadow -Wmissing-prototypes -Wmissing-declarations \
-Wredundant-decls -Wnested-externs -Winline -Wno-variadic-macros -Wswitch-default \
@@ -99,11 +106,27 @@ OBJ = digest files generalised-spec hex state
.PHONY: all
-all: $(foreach O,$(OBJ),obj/libkeccak/$(O).o)
+all: lib
+
+.PHONY: lib
+lib: bin/libkeccak.so.$(LIB_VERSION) bin/libkeccak.so.$(LIB_MAJOR) bin/libkeccak.so
obj/libkeccak/%.o: src/libkeccak/%.c src/libkeccak.h src/libkeccak/*.h
@mkdir -p obj/libkeccak
- $(CC) $(FLAGS) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
+ $(CC) $(FLAGS) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $<
+
+bin/libkeccak.so.$(LIB_VERSION): $(foreach O,$(OBJ),obj/libkeccak/$(O).o)
+ @mkdir -p bin
+ $(CC) $(FLAGS) $(LDFLAGS) -shared -Wl,-soname,libkeccak.so.$(LIB_MAJOR) -o $@ $^
+
+bin/libkeccak.so.$(LIB_MAJOR):
+ @mkdir -p bin
+ ln -sf libkeccak.so.$(LIB_VERSION) $@
+
+bin/libkeccak.so:
+ @mkdir -p bin
+ ln -sf libkeccak.so.$(LIB_VERSION) $@
+
.PHONY: clean