summaryrefslogtreecommitdiff
blob: 236e80730d5758d583d4617a606496441d34fdab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
From bdfec26744122e8f52a58bc086c89b27faaf5888 Mon Sep 17 00:00:00 2001
From: Alon Bar-Lev <alon.barlev@gmail.com>
Date: Sat, 1 Jul 2017 23:06:41 +0300
Subject: [PATCH 1/2] build: move non-essential flags to *_EXTRA

This enables downstream to selectively add/replace the optimization and
other non-essential flags.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
---
 Makefile | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 7022a4a..c9313cb 100644
--- a/Makefile
+++ b/Makefile
@@ -5,21 +5,22 @@ MAKE_DIR     ?= install -d
 INSTALL_DATA ?= install
 
 CC?=gcc
-CFLAGS?=-O2 -Wall -g -D_FORTIFY_SOURCE=2 -fstack-protector -fPIC
-LDFLAGS?=-Wl,-z,now -Wl,-z,relro -Wl,-soname,libscrypt.so.0 -Wl,--version-script=libscrypt.version
-CFLAGS_EXTRA?=-Wl,-rpath=.
+CFLAGS?=$(CFLAGS_EXTRA) -D_FORTIFY_SOURCE=2 -fPIC
+LDFLAGS?=$(LDFLAGS_EXTRA) -Wl,-soname,libscrypt.so.0 -Wl,--version-script=libscrypt.version
+CFLAGS_EXTRA?=-Wl,-rpath=. -O2 -Wall -g -fstack-protector
+LDFLAGS_EXTRA?=-Wl,-z,relro
 
 all: reference
 
 OBJS= crypto_scrypt-nosse.o sha256.o crypto-mcf.o b64.o crypto-scrypt-saltgen.o crypto_scrypt-check.o crypto_scrypt-hash.o slowequals.o
 
 libscrypt.so.0: $(OBJS) 
-	$(CC)  $(LDFLAGS) -shared -o libscrypt.so.0  $(OBJS) -lm -lc
+	$(CC) $(LDFLAGS) -shared -o libscrypt.so.0  $(OBJS) -lm -lc
 	ar rcs libscrypt.a  $(OBJS)
 
 reference: libscrypt.so.0 main.o crypto_scrypt-hexconvert.o
 	ln -s -f libscrypt.so.0 libscrypt.so
-	$(CC) -Wall -o reference main.o b64.o crypto_scrypt-hexconvert.o $(CFLAGS_EXTRA) -L.  -lscrypt
+	$(CC) -o reference main.o b64.o crypto_scrypt-hexconvert.o $(CFLAGS) $(LDFLAGS_EXTRA) -L.  -lscrypt
 
 clean:
 	rm -f *.o reference libscrypt.so* libscrypt.a endian.h
-- 
2.13.0

From 7899df0447e0fcad32a6cce7439eef1f1295aaeb Mon Sep 17 00:00:00 2001
From: Alon Bar-Lev <alon.barlev@gmail.com>
Date: Sat, 1 Jul 2017 23:14:29 +0300
Subject: [PATCH 2/2] build: run tests with local library

Ensure tests can run and when run are run with current library.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index c9313cb..783c537 100644
--- a/Makefile
+++ b/Makefile
@@ -26,7 +26,7 @@ clean:
 	rm -f *.o reference libscrypt.so* libscrypt.a endian.h
 
 check: all
-	./reference
+	LD_LIBRARY_PATH=. ./reference
 
 devtest:
 	splint crypto_scrypt-hexconvert.c 
-- 
2.13.0