From b4639f132c633f131ed7f63977a553a561492812 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 4 Nov 2014 20:45:30 +0100 Subject: compile so file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- Makefile | 27 +++++++++++++++++++++++++-- 1 file 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 -- cgit v1.2.3-70-g09d2