2013-03-16 14:51:55 +00:00
|
|
|
FLAGS_COMMON:=-Wall
|
2013-03-31 02:17:44 +00:00
|
|
|
FLAGS_PROD:=-DNDEBUG -O2 -march=native
|
2013-03-31 01:46:01 +00:00
|
|
|
FLAGS_DEBUG:=-DVERIFY -ggdb3 -O1
|
|
|
|
FLAGS_TEST:=-DVERIFY -ggdb3 -O2 -march=native
|
2013-03-16 14:51:55 +00:00
|
|
|
|
2013-03-30 20:49:09 +00:00
|
|
|
SECP256K1_FILES := num.h field.h field_5x52.h group.h ecmult.h ecdsa.h \
|
|
|
|
num.cpp field.cpp field_5x52.cpp group.cpp ecmult.cpp ecdsa.cpp
|
2013-03-16 14:51:55 +00:00
|
|
|
|
|
|
|
ifndef CONF
|
|
|
|
CONF := gmp
|
|
|
|
endif
|
|
|
|
|
2013-03-26 00:39:53 +00:00
|
|
|
default: all
|
|
|
|
|
2013-03-16 14:51:55 +00:00
|
|
|
ifeq ($(CONF), openssl)
|
|
|
|
FLAGS_CONF:=-DUSE_NUM_OPENSSL -DUSE_FIELDINVERSE_BUILTIN
|
|
|
|
LIBS:=-lcrypto
|
|
|
|
SECP256K1_FILES := $(SECP256K1_FILES) num_openssl.h num_openssl.cpp
|
|
|
|
else
|
|
|
|
ifeq ($(CONF), gmp)
|
|
|
|
FLAGS_CONF:=-DUSE_NUM_GMP
|
|
|
|
LIBS:=-lgmp
|
|
|
|
SECP256K1_FILES := $(SECP256K1_FILES) num_gmp.h num_gmp.cpp
|
2013-03-26 00:39:53 +00:00
|
|
|
else
|
|
|
|
ifeq ($(CONF), gmpasm)
|
|
|
|
FLAGS_CONF:=-DUSE_NUM_GMP -DINLINE_ASM
|
|
|
|
LIBS:=-lgmp obj/lin64.o
|
|
|
|
SECP256K1_FILES := $(SECP256K1_FILES) num_gmp.h num_gmp.cpp obj/lin64.o
|
|
|
|
|
|
|
|
obj/lin64.o: lin64.asm
|
2013-03-27 13:13:52 +00:00
|
|
|
yasm -f elf64 -o obj/lin64.o lin64.asm
|
2013-03-26 00:39:53 +00:00
|
|
|
endif
|
2013-03-16 14:51:55 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2013-03-25 23:39:22 +00:00
|
|
|
all: *.cpp *.asm *.h
|
2013-03-16 14:51:55 +00:00
|
|
|
+make CONF=openssl all-openssl
|
|
|
|
+make CONF=gmp all-gmp
|
2013-03-26 00:39:53 +00:00
|
|
|
+make CONF=gmpasm all-gmpasm
|
2013-03-16 14:51:55 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
+make CONF=openssl clean-openssl
|
|
|
|
+make CONF=gmp clean-gmp
|
2013-03-26 00:39:53 +00:00
|
|
|
+make CONF=gmpasm clean-gmpasm
|
2013-03-16 14:51:55 +00:00
|
|
|
|
|
|
|
bench-any: bench-$(CONF)
|
|
|
|
tests-any: tests-$(CONF)
|
|
|
|
|
2013-03-30 20:49:09 +00:00
|
|
|
all-$(CONF): bench-$(CONF) tests-$(CONF) obj/secp256k1-$(CONF).o
|
2013-03-16 14:51:55 +00:00
|
|
|
|
|
|
|
clean-$(CONF):
|
|
|
|
rm -f bench-$(CONF) tests-$(CONF) obj/secp256k1-$(CONF).o
|
|
|
|
|
|
|
|
obj/secp256k1-$(CONF).o: $(SECP256K1_FILES)
|
|
|
|
$(CXX) $(FLAGS_COMMON) $(FLAGS_PROD) $(FLAGS_CONF) secp256k1.cpp -c -o obj/secp256k1-$(CONF).o
|
|
|
|
|
2013-03-24 09:38:35 +00:00
|
|
|
bench-$(CONF): $(SECP256K1_FILES) bench.cpp
|
|
|
|
$(CXX) $(FLAGS_COMMON) $(FLAGS_PROD) $(FLAGS_CONF) bench.cpp $(LIBS) -o bench-$(CONF)
|
2013-03-25 23:39:22 +00:00
|
|
|
|
2013-03-26 00:39:53 +00:00
|
|
|
tests-$(CONF): $(SECP256K1_FILES) tests.cpp
|
2013-03-31 01:46:01 +00:00
|
|
|
$(CXX) $(FLAGS_COMMON) $(FLAGS_TEST) $(FLAGS_CONF) tests.cpp $(LIBS) -o tests-$(CONF)
|