secp256k1/Makefile

72 lines
2.1 KiB
Makefile
Raw Normal View History

FLAGS_COMMON:=-Wall -Wno-unused -fPIC
2013-03-31 02:17:44 +00:00
FLAGS_PROD:=-DNDEBUG -O2 -march=native
FLAGS_DEBUG:=-DVERIFY -ggdb3 -O1
FLAGS_TEST:=-DVERIFY -ggdb3 -O2 -march=native
2013-03-16 14:51:55 +00:00
2013-03-31 03:03:27 +00:00
SECP256K1_FILES := src/num.h src/field.h src/field_5x52.h src/group.h src/ecmult.h src/ecdsa.h \
src/num.cpp src/field.cpp src/field_5x52.cpp src/group.cpp src/ecmult.cpp src/ecdsa.cpp
2013-03-16 14:51:55 +00:00
ifndef CONF
CONF := gmp
endif
2013-03-31 03:03:27 +00:00
OBJS := obj/secp256k1-$(CONF).o
2013-03-26 00:39:53 +00:00
default: all
2013-03-16 14:51:55 +00:00
ifeq ($(CONF), openssl)
2013-03-31 03:03:27 +00:00
FLAGS_CONF:=-DUSE_NUM_OPENSSL -DUSE_FIELD_INV_BUILTIN
2013-03-16 14:51:55 +00:00
LIBS:=-lcrypto
2013-03-31 03:03:27 +00:00
SECP256K1_FILES := $(SECP256K1_FILES) src/num_openssl.h src/num_openssl.cpp src/field_5x52_int128.cpp
2013-03-16 14:51:55 +00:00
else
ifeq ($(CONF), gmp)
FLAGS_CONF:=-DUSE_NUM_GMP
LIBS:=-lgmp
2013-03-31 03:03:27 +00:00
SECP256K1_FILES := $(SECP256K1_FILES) src/num_gmp.h src/num_gmp.cpp src/field_5x52_int128.cpp
2013-03-26 00:39:53 +00:00
else
ifeq ($(CONF), gmpasm)
2013-03-31 03:03:27 +00:00
FLAGS_CONF:=-DUSE_NUM_GMP -DUSE_FIELD_5X52_ASM
2013-03-31 02:37:15 +00:00
LIBS:=-lgmp obj/field_5x52_asm.o
2013-03-31 03:03:27 +00:00
OBJS:=$(OBJS) obj/field_5x52_asm.o
SECP256K1_FILES := $(SECP256K1_FILES) src/num_gmp.h src/num_gmp.cpp src/field_5x52_asm.cpp
2013-03-26 00:39:53 +00:00
2013-03-31 03:03:27 +00:00
obj/field_5x52_asm.o: src/field_5x52_asm.asm
yasm -f elf64 -o obj/field_5x52_asm.o src/field_5x52_asm.asm
2013-03-31 02:37:15 +00:00
else
2013-03-31 03:03:27 +00:00
SECP256K1_FILES := $(SECP256K1_FILES) src/field_5x52_int128.cpp
2013-03-26 00:39:53 +00:00
endif
2013-03-16 14:51:55 +00:00
endif
endif
2013-03-31 03:03:27 +00:00
all: src/*.cpp src/*.asm src/*.h include/*.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-31 03:03:27 +00:00
all-$(CONF): bench-$(CONF) tests-$(CONF) libsecp256k1-$(CONF).a
2013-03-16 14:51:55 +00:00
clean-$(CONF):
2013-03-31 03:03:27 +00:00
rm -f bench-$(CONF) tests-$(CONF) libsecp256k1-$(CONF).a obj/*
obj/secp256k1-$(CONF).o: $(SECP256K1_FILES) src/secp256k1.cpp include/secp256k1.h
$(CXX) $(FLAGS_COMMON) $(FLAGS_PROD) $(FLAGS_CONF) src/secp256k1.cpp -c -o obj/secp256k1-$(CONF).o
2013-03-16 14:51:55 +00:00
2013-03-31 03:03:27 +00:00
bench-$(CONF): $(OBJS) src/bench.cpp
$(CXX) $(FLAGS_COMMON) $(FLAGS_PROD) $(FLAGS_CONF) src/bench.cpp $(LIBS) -o bench-$(CONF)
2013-03-16 14:51:55 +00:00
2013-03-31 03:03:27 +00:00
tests-$(CONF): $(OBJS) src/tests.cpp
$(CXX) $(FLAGS_COMMON) $(FLAGS_TEST) $(FLAGS_CONF) src/tests.cpp $(LIBS) -o tests-$(CONF)
2013-03-31 03:03:27 +00:00
libsecp256k1-$(CONF).a: $(OBJS)
$(AR) -rs $@ $(OBJS)