aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile44
1 files changed, 44 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..b8784b2
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,44 @@
+.POSIX:
+PREFIX = /usr
+NAME = siphash
+LIBDIR = $(PREFIX)/lib
+INCLUDEDIR = $(PREFIX)/include
+SRCDIR = $(PREFIX)/src/$(NAME)
+
+
+all: lib$(NAME).a
+
+lib$(NAME).a: lib$(NAME).a($(NAME).o)
+lib$(NAME).a: lib$(NAME).a(halfsiphash.o)
+
+$(NAME).o: $(NAME).h
+halfsiphash.o: halfsiphash.h
+
+
+test.o: halfsiphash.h siphash.h vectors.h
+test.bin: test.o testmain.o lib$(NAME).a
+ $(CC) $(LDFLAGS) -o $@ test.o testmain.o lib$(NAME).a $(LDLIBS)
+
+
+check: test.bin
+ ./test.bin
+
+clean:
+ rm -f *.o *.a
+ rm -f test.bin
+
+
+install: all
+ mkdir -p \
+ '$(DESTDIR)$(LIBDIR)' \
+ '$(DESTDIR)$(INCLUDEDIR)' \
+ '$(DESTDIR)$(SRCDIR)'
+ cp lib$(NAME).a '$(DESTDIR)$(LIBDIR)'
+ cp $(NAME).h '$(DESTDIR)$(INCLUDEDIR)'
+ cp $(NAME).h $(NAME).c '$(DESTDIR)$(SRCDIR)'
+
+uninstall:
+ rm -rf \
+ '$(DESTDIR)$(LIBDIR)'/lib$(NAME).a \
+ '$(DESTDIR)$(INCLUDEDIR)'/$(NAME).h \
+ '$(DESTDIR)$(SRCDIR)'