summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile39
1 files changed, 39 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..6a0a659
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,39 @@
+PREFIX = /usr/local
+LIBDIR = $(PREFIX)/lib
+INCLUDEDIR = $(PREFIX)/include
+MAKE_DIR = install -d
+INSTALL_DATA = install -m 0644
+
+CC=gcc
+CFLAGS=-O2 -Wall -g -D_FORTIFY_SOURCE=2 -fstack-protector -fPIC
+all: reference
+
+OBJS= crypto_scrypt-nosse.o sha256.o crypto_scrypt-hexconvert.o crypto-mcf.o modp_b64.o crypto-scrypt-saltgen.o crypto_scrypt-check.o crypto_scrypt-hash.o
+
+
+library: $(OBJS)
+ $(CC) -shared -Wl,-soname,libscrypt.so.0 -Wl,--version-script=libscrypt.version -o libscrypt.so.0 -lc $(OBJS)
+ ar rcs libscrypt.a $(OBJS)
+
+reference: library main.o
+ ln -s -f libscrypt.so.0 libscrypt.so
+ $(CC) -Wall -o reference main.o -Wl,-rpath=. -L. -lm -lscrypt
+
+clean:
+ rm -f *.o reference libscrypt.so* libscrypt.a
+
+check: all
+ ./reference
+
+devtest:
+ splint crypto_scrypt-hexconvert.c
+ splint crypto-mcf.c crypto_scrypt-check.c crypto_scrypt-hash.c
+ splint crypto-scrypt-saltgen.c +posixlib
+ valgrind ./reference
+
+install: library
+ $(MAKE_DIR) $(DESTDIR) $(DESTDIR)$(PREFIX) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(INCLUDEDIR)
+ $(INSTALL_DATA) libscrypt.a $(DESTDIR)$(LIBDIR)
+ $(INSTALL_DATA) libscrypt.so.0 $(DESTDIR)$(LIBDIR)
+ ln -s -f libscrypt.so.0 $(DESTDIR)$(LIBDIR)/libscrypt.so
+ $(INSTALL_DATA) libscrypt.h $(DESTDIR)$(INCLUDEDIR)