@@ -11,37 +11,53 @@ INC=-Igoldilocks/src/GENERATED/include -I/usr/include/sodium
11
11
LIBS =-lsodium
12
12
CFLAGS =$(INC ) -Wall -Os
13
13
LDFLAGS =-g $(LIBS )
14
+ CC =gcc
15
+ SOEXT =so
14
16
15
17
all : bin libsphinx.so tests
16
-
17
18
bin : bin/challenge bin/respond bin/derive
18
19
19
- tests : tests/pake tests/sphinx
20
+ win : CC=x86_64-w64-mingw32-gcc
21
+ win : INC=-Igoldilocks/src/GENERATED/include -Iwin/libsodium-win64/include/sodium -Iwin/libsodium-win64/include
22
+ win : LIBS=-L. -Lwin/libsodium-win64/lib/ -Wl,-Bstatic -lsodium -Wl,-Bdynamic
23
+ win : SOEXT=dll
24
+ win : EXT=.exe
25
+ win : MAKETARGET=win
26
+ win : win/libsodium-win64 exe libsphinx.$(SOEXT ) tests$(EXT )
27
+ exe : bin/challenge$(EXT ) bin/respond$(EXT ) bin/derive$(EXT )
28
+
29
+ tests$(EXT ) : tests/pake$(EXT ) tests/sphinx$(EXT )
20
30
21
31
$(objs ) :
22
- cd goldilocks; make
32
+ cd goldilocks; OFLAGS=' ' ARCHFLAGS=' ' make $(MAKETARGET )
33
+
34
+ bin/challenge$(EXT ) : $(objs ) bin/challenge.c
35
+ $(CC ) $(CFLAGS ) -o bin/challenge$(EXT ) bin/challenge.c $(LDFLAGS ) $(objs )
23
36
24
- bin/challenge : $(objs ) bin/challenge .c
25
- gcc $(CFLAGS ) -o bin/challenge bin/challenge .c $(LDFLAGS ) $(objs )
37
+ bin/respond $( EXT ) : $(objs ) bin/respond .c
38
+ $( CC ) $(CFLAGS ) -o bin/respond $( EXT ) bin/respond .c $(LDFLAGS ) $(objs )
26
39
27
- bin/respond : $(objs ) bin/respond .c
28
- gcc $(CFLAGS ) -o bin/respond bin/respond .c $(LDFLAGS ) $(objs )
40
+ bin/derive $( EXT ) : $(objs ) bin/derive .c
41
+ $( CC ) $(CFLAGS ) -o bin/derive $( EXT ) bin/derive .c $(LDFLAGS ) $(objs )
29
42
30
- bin/derive : $(objs ) bin/derive.c
31
- gcc $(CFLAGS ) -o bin/derive bin/derive.c $( LDFLAGS ) $(objs )
43
+ libsphinx. $( SOEXT ) : $(objs ) sphinx.o pake.o
44
+ $( CC ) -shared -fpic $(CFLAGS ) -o libsphinx. $( SOEXT ) $(objs ) pake.o sphinx.o $( LDFLAGS )
32
45
33
- libsphinx.so : $( objs ) sphinx.o pake.o
34
- $(CC ) -shared -fpic $(CFLAGS ) -o $@ $( objs ) pake.o sphinx.o $(LDFLAGS )
46
+ tests/sphinx $( EXT ) : tests/test.c libsphinx. $( SOEXT )
47
+ $(CC ) $(CFLAGS ) -o tests/sphinx $( EXT ) tests/test.c -lsphinx $(LDFLAGS ) $( objs )
35
48
36
- tests/sphinx : tests/test.c libsphinx.so
37
- gcc $(CFLAGS ) -o tests/sphinx tests/test.c -lsphinx $(LDFLAGS ) $(objs )
49
+ tests/pake $( EXT ) : tests/pake- test.c libsphinx.$( SOEXT )
50
+ $( CC ) $(CFLAGS ) -o tests/pake $( EXT ) tests/pake- test.c -lsphinx $(LDFLAGS ) $(objs )
38
51
39
- tests/pake : tests/pake-test.c libsphinx.so
40
- gcc $(CFLAGS ) -o tests/pake tests/pake-test.c -lsphinx $(LDFLAGS ) $(objs )
52
+ win/libsodium-win64 :
53
+ @echo ' win/libsodium-win64 not found.'
54
+ @echo ' download and unpack latest libsodium-*-mingw.tar.gz and unpack into win/'
55
+ @echo ' https://download.libsodium.org/libsodium/releases/'
56
+ @false
41
57
42
58
clean :
43
- @ rm -f bin/sphinx bin/challenge bin/respond bin/derive libsphinx.so * .o * .pyc || true
44
- @ rm -f tests/sphinx tests/pake || true
45
- @ rm -rf __pycache__ || true
59
+ rm -f bin/sphinx bin/challenge bin/respond bin/derive libsphinx.so
60
+ rm -f tests/sphinx tests/pake tests/sphinx.exe tests/pake.exe * .o
61
+ rm -f bin/sphinx.exe bin/challenge.exe bin/respond.exe bin/derive.exe libsphinx.dll
46
62
47
63
.PHONY : bin clean
0 commit comments