forked from jancarlsson/snarklib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
123 lines (105 loc) · 2.86 KB
/
Makefile
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
CXX = g++
CXXFLAGS = -O2 -g3 -std=c++11 -fPIC
AR = ar
RANLIB = ranlib
LIBRARY_FILES = \
AsmMacros.hpp \
AuxSTL.hpp\
BigInt.hpp \
EC_BN128_GroupCurve.hpp \
EC_BN128_InitFields.hpp \
EC_BN128_InitGroups.hpp \
EC_BN128_Modulus.hpp \
EC_BN128_Pairing.hpp \
EC_Edwards_GroupCurve.hpp \
EC_Edwards_InitFields.hpp \
EC_Edwards_InitGroups.hpp \
EC_Edwards_Modulus.hpp \
EC_Edwards_Pairing.hpp \
EC.hpp \
EC_Pairing.hpp \
Field.hpp \
FpModel.hpp \
FpModel.tcc \
FpX.hpp \
Group.hpp \
IndexSpace.hpp \
LagrangeFFT.hpp \
LagrangeFFTX.hpp \
MultiExp.hpp \
Pairing.hpp \
PPZK_keypair.hpp \
PPZK_keystruct.hpp \
PPZK_proof.hpp \
PPZK_query.hpp \
PPZK_randomness.hpp \
PPZK_verify.hpp \
PPZK_witness.hpp \
ProgressCallback.hpp \
QAP.hpp \
Rank1DSL.hpp \
Util.hpp \
WindowExp.hpp
default :
@echo Build options:
@echo make autotest_bn128 LIBSNARK_PREFIX=\<path\>
@echo make autotest_edwards LIBSNARK_PREFIX=\<path\>
@echo make install PREFIX=\<path\>
@echo make doc
@echo make clean
README.html : README.md
markdown_py -f README.html README.md -x toc -x extra --noisy
doc : README.html
ifeq ($(PREFIX),)
install :
$(error Please provide PREFIX, e.g. make install PREFIX=/usr/local)
else
# installing just copies over the template library header files
install :
mkdir -p $(PREFIX)/include/snarklib
cp $(LIBRARY_FILES) $(PREFIX)/include/snarklib
endif
CLEAN_FILES = \
autotest_bn128 \
autotest_edwards \
README.html
clean :
rm -f *.o $(CLEAN_FILES)
################################################################################
# CURVE_ALT_BN128
#
ifeq ($(LIBSNARK_PREFIX),)
autotest_bn128 :
$(error Please provide LIBSNARK_PREFIX, e.g. make autotest_bn128 LIBSNARK_PREFIX=/usr/local)
else
CXXFLAGS_CURVE_ALT_BN128 = \
-I$(LIBSNARK_PREFIX)/include \
-I$(LIBSNARK_PREFIX)/include/libsnark \
-DCURVE_ALT_BN128 -DUSE_ASM -DUSE_ADD_SPECIAL -DUSE_ASSERT
LDFLAGS_CURVE_ALT_BN128 = \
-L$(LIBSNARK_PREFIX)/lib \
-Wl,-rpath $(LIBSNARK_PREFIX)/lib \
-lgmpxx -lgmp -lprocps -lsnark
autotest_bn128 : autotest.cpp $(LIBRARY_FILES)
$(CXX) -c $(CXXFLAGS) $(CXXFLAGS_CURVE_ALT_BN128) $< -o autotest_bn128.o
$(CXX) -o $@ autotest_bn128.o $(LDFLAGS_CURVE_ALT_BN128)
endif
################################################################################
# CURVE_EDWARDS
#
ifeq ($(LIBSNARK_PREFIX),)
autotest_edwards :
$(error Please provide LIBSNARK_PREFIX, e.g. make autotest_edwards LIBSNARK_PREFIX=/usr/local)
else
CXXFLAGS_CURVE_EDWARDS = \
-I$(LIBSNARK_PREFIX)/include \
-I$(LIBSNARK_PREFIX)/include/libsnark \
-DCURVE_EDWARDS -DUSE_ASM -DUSE_ADD_SPECIAL -DUSE_ASSERT
LDFLAGS_CURVE_EDWARDS = \
-L$(LIBSNARK_PREFIX)/lib \
-Wl,-rpath $(LIBSNARK_PREFIX)/lib \
-lgmpxx -lgmp -lprocps -lsnark
autotest_edwards : autotest.cpp $(LIBRARY_FILES)
$(CXX) -c $(CXXFLAGS) $(CXXFLAGS_CURVE_EDWARDS) $< -o autotest_edwards.o
$(CXX) -o $@ autotest_edwards.o $(LDFLAGS_CURVE_EDWARDS)
endif