aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-11-05 00:25:41 +0100
committerMattias Andrée <maandree@operamail.com>2014-11-05 00:25:41 +0100
commit44eaa09dc1082c1e35bfb7cc8f8c694ec0df1991 (patch)
treedc044a2de63641f975e82bb93e5d773591aaf559 /Makefile
parentadd *.test to gitignore so it can be used for your test files (diff)
downloadlibkeccak-44eaa09dc1082c1e35bfb7cc8f8c694ec0df1991.tar.gz
libkeccak-44eaa09dc1082c1e35bfb7cc8f8c694ec0df1991.tar.bz2
libkeccak-44eaa09dc1082c1e35bfb7cc8f8c694ec0df1991.tar.xz
beginning of test
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile19
1 files changed, 16 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 19f4feb..52280af 100644
--- a/Makefile
+++ b/Makefile
@@ -102,11 +102,13 @@ FLAGS = -std=gnu99 $(WARN)
-OBJ = digest files generalised-spec hex state
+LIB_OBJ = digest files generalised-spec hex state
+TEST_OBJ = test
.PHONY: all
-all: lib
+all: lib test
+
.PHONY: lib
lib: bin/libkeccak.so.$(LIB_VERSION) bin/libkeccak.so.$(LIB_MAJOR) bin/libkeccak.so
@@ -115,7 +117,7 @@ obj/libkeccak/%.o: src/libkeccak/%.c src/libkeccak.h src/libkeccak/*.h
@mkdir -p obj/libkeccak
$(CC) $(FLAGS) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $<
-bin/libkeccak.so.$(LIB_VERSION): $(foreach O,$(OBJ),obj/libkeccak/$(O).o)
+bin/libkeccak.so.$(LIB_VERSION): $(foreach O,$(LIB_OBJ),obj/libkeccak/$(O).o)
@mkdir -p bin
$(CC) $(FLAGS) $(LDFLAGS) -shared -Wl,-soname,libkeccak.so.$(LIB_MAJOR) -o $@ $^
@@ -128,6 +130,17 @@ bin/libkeccak.so:
ln -sf libkeccak.so.$(LIB_VERSION) $@
+.PHONY: test
+test: bin/test
+
+bin/test: lib $(foreach O,$(TEST_OBJ),obj/test/$(O).o)
+ $(CC) $(FLAGS) $(LDFLAGS) -Lbin -lkeccak -o $@ $(foreach O,$(TEST_OBJ),obj/test/$(O).o)
+
+obj/test/%.o: src/test/%.c src/libkeccak/*.h src/libkeccak.h
+ @mkdir -p obj/test
+ $(CC) $(FLAGS) $(CFLAGS) $(CPPFLAGS) -Isrc -c -o $@ $<
+
+
.PHONY: clean
clean: