2013-04-06 22:37:06 +00:00
|
|
|
$(shell CC=$(CC) YASM=$(YASM) ./configure)
|
|
|
|
include config.mk
|
2013-03-16 14:51:55 +00:00
|
|
|
|
2013-04-06 22:37:06 +00:00
|
|
|
FILES := src/*.h src/impl/*.h
|
2013-03-31 03:03:27 +00:00
|
|
|
|
2013-03-30 01:12:08 +00:00
|
|
|
JAVA_FILES := src/java/org_bitcoin_NativeSecp256k1.h src/java/org_bitcoin_NativeSecp256k1.c
|
2013-03-16 14:51:55 +00:00
|
|
|
|
2013-04-01 10:49:54 +00:00
|
|
|
OBJS :=
|
2013-03-31 03:03:27 +00:00
|
|
|
|
2013-04-06 22:37:06 +00:00
|
|
|
ifeq ($(USE_ASM), 1)
|
2013-06-16 20:46:43 +00:00
|
|
|
OBJS := $(OBJS) obj/field_5x$(HAVE_LIMB)_asm.o
|
2013-04-03 01:43:14 +00:00
|
|
|
endif
|
2013-06-16 20:46:43 +00:00
|
|
|
STD="gnu99"
|
2013-03-31 03:03:27 +00:00
|
|
|
|
2013-04-06 22:37:06 +00:00
|
|
|
default: tests libsecp256k1.a libsecp256k1.so
|
2013-03-16 14:51:55 +00:00
|
|
|
|
|
|
|
clean:
|
2013-04-06 22:37:06 +00:00
|
|
|
rm -rf obj/*.o bench tests *.a *.so config.mk
|
2013-03-16 14:51:55 +00:00
|
|
|
|
2013-04-06 22:37:06 +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 03:03:27 +00:00
|
|
|
|
2013-06-16 20:46:43 +00:00
|
|
|
obj/field_5x64_asm.o: src/field_5x64_asm.asm
|
|
|
|
$(YASM) -f elf64 -o obj/field_5x64_asm.o src/field_5x64_asm.asm
|
|
|
|
|
2013-04-06 22:37:06 +00:00
|
|
|
obj/secp256k1.o: $(FILES) src/secp256k1.c include/secp256k1.h
|
2013-06-16 20:46:43 +00:00
|
|
|
$(CC) -fPIC -std=$(STD) $(CFLAGS) $(CFLAGS_EXTRA) -DNDEBUG -$(OPTLEVEL) src/secp256k1.c -c -o obj/secp256k1.o
|
2013-03-16 14:51:55 +00:00
|
|
|
|
2013-04-06 22:37:06 +00:00
|
|
|
bench: $(FILES) src/bench.c $(OBJS)
|
2013-06-16 20:46:43 +00:00
|
|
|
$(CC) -fPIC -std=$(STD) $(CFLAGS) $(CFLAGS_EXTRA) $(CFLAGS_TEST_EXTRA) -DNDEBUG -$(OPTLEVEL) src/bench.c $(OBJS) $(LDFLAGS_EXTRA) $(LDFLAGS_TEST_EXTRA) -o bench
|
2013-03-16 14:51:55 +00:00
|
|
|
|
2013-04-06 22:37:06 +00:00
|
|
|
tests: $(FILES) src/tests.c $(OBJS)
|
2013-06-16 20:46:43 +00:00
|
|
|
$(CC) -std=$(STD) $(CFLAGS) $(CFLAGS_EXTRA) $(CFLAGS_TEST_EXTRA) -DVERIFY -fstack-protector-all -$(OPTLEVEL) -ggdb3 src/tests.c $(OBJS) $(LDFLAGS_EXTRA) $(LDFLAGS_TEST_EXTRA) -o tests
|
2013-03-25 23:39:22 +00:00
|
|
|
|
2013-04-22 00:10:41 +00:00
|
|
|
coverage: $(FILES) src/tests.c $(OBJS)
|
|
|
|
rm -rf tests.gcno tests.gcda tests_cov
|
2013-06-16 20:46:43 +00:00
|
|
|
$(CC) -std=$(STD) $(CFLAGS) $(CFLAGS_EXTRA) $(CFLAGS_TEST_EXTRA) -DVERIFY --coverage -$(OPTLEVEL) -g src/tests.c $(OBJS) $(LDFLAGS_EXTRA) $(LDFLAGS_TEST_EXTRA) -o tests_cov
|
2013-04-22 00:10:41 +00:00
|
|
|
rm -rf lcov
|
|
|
|
mkdir -p lcov
|
|
|
|
cd lcov; lcov --directory ../ --zerocounters
|
|
|
|
cd lcov; ../tests_cov
|
|
|
|
cd lcov; lcov --directory ../ --capture --output-file secp256k1.info
|
|
|
|
cd lcov; genhtml -o . secp256k1.info
|
|
|
|
|
2013-04-06 22:37:06 +00:00
|
|
|
libsecp256k1.a: obj/secp256k1.o $(OBJS)
|
|
|
|
$(AR) -rs $@ $(OBJS) obj/secp256k1.o
|
2013-03-30 01:12:08 +00:00
|
|
|
|
2013-04-06 22:37:06 +00:00
|
|
|
libsecp256k1.so: obj/secp256k1.o $(OBJS)
|
2013-06-16 20:46:43 +00:00
|
|
|
$(CC) -std=$(STD) $(LDFLAGS_EXTRA) $(OBJS) obj/secp256k1.o -shared -o libsecp256k1.so
|
2013-03-30 01:12:08 +00:00
|
|
|
|
2013-04-06 22:37:06 +00:00
|
|
|
libjavasecp256k1.so: $(OBJS) obj/secp256k1.o $(JAVA_FILES)
|
2013-06-16 20:46:43 +00:00
|
|
|
$(CC) -fPIC -std=$(STD) $(CFLAGS) $(CFLAGS_EXTRA) -DNDEBUG -$(OPTLEVEL) -I. src/java/org_bitcoin_NativeSecp256k1.c $(LDFLAGS_EXTRA) $(OBJS) obj/secp256k1.o -shared -o libjavasecp256k1.so
|