2021-02-20 21:33:30 +00:00
|
|
|
TESTS = bls12_381_test das_extension_test c_kzg_util_test fft_common_test fft_fr_test fft_g1_test \
|
2021-02-27 15:19:46 +00:00
|
|
|
fk20_proofs_test kzg_proofs_test poly_test recover_test utility_test zero_poly_test
|
2021-06-28 12:42:14 +01:00
|
|
|
BENCH = fft_fr_bench fft_g1_bench recover_bench zero_poly_bench kzg_proofs_bench poly_bench
|
|
|
|
TUNE = poly_mul_tune poly_div_tune
|
2021-02-27 15:19:46 +00:00
|
|
|
LIB_SRC = bls12_381.c c_kzg_util.c das_extension.c fft_common.c fft_fr.c fft_g1.c fk20_proofs.c kzg_proofs.c poly.c recover.c utility.c zero_poly.c
|
2021-02-03 16:59:59 +00:00
|
|
|
LIB_OBJ = $(LIB_SRC:.c=.o)
|
|
|
|
|
2021-06-14 15:00:17 +03:00
|
|
|
KZG_CFLAGS =
|
2021-06-10 18:52:36 +03:00
|
|
|
INCLUDE_DIRS = ../inc
|
2021-02-01 20:15:45 +00:00
|
|
|
|
2021-02-02 11:18:43 +00:00
|
|
|
.PRECIOUS: %.o
|
2021-02-01 20:15:45 +00:00
|
|
|
|
2021-02-03 21:00:14 +00:00
|
|
|
%.o: %.c %.h c_kzg.h Makefile
|
2021-06-14 15:00:17 +03:00
|
|
|
clang -Wall -I$(INCLUDE_DIRS) $(CFLAGS) $(KZG_CFLAGS) -c $*.c
|
2021-02-02 11:18:43 +00:00
|
|
|
|
2021-02-03 16:59:59 +00:00
|
|
|
libckzg.a: $(LIB_OBJ) Makefile
|
|
|
|
ar rc libckzg.a $(LIB_OBJ)
|
2021-02-02 12:29:56 +00:00
|
|
|
|
2021-07-03 13:55:54 +01:00
|
|
|
%_test: %.c debug_util.o test_util.o libckzg.a Makefile
|
|
|
|
clang -Wall -DKZGTEST -I$(INCLUDE_DIRS) $(CFLAGS) $(KZG_CFLAGS) -o $@ $*.c debug_util.o test_util.o libckzg.a -L../lib -lblst
|
2021-02-02 23:06:42 +00:00
|
|
|
./$@
|
|
|
|
|
2021-02-10 11:55:38 +00:00
|
|
|
# This version will abort on error and print the file and line number
|
2021-07-03 13:55:54 +01:00
|
|
|
%_test_debug: KZG_CFLAGS += -g -O0
|
|
|
|
%_test_debug: %.c debug_util.o test_util.o libckzg.a Makefile
|
|
|
|
clang -Wall -DKZGTEST -DDEBUG -I$(INCLUDE_DIRS) $(CFLAGS) $(KZG_CFLAGS) -o $@ $*.c debug_util.o test_util.o libckzg.a -L../lib -lblst
|
2021-02-10 11:55:38 +00:00
|
|
|
|
|
|
|
# Benchmarks
|
2021-06-14 15:00:17 +03:00
|
|
|
%_bench: KZG_CFLAGS += -O
|
2021-02-17 12:25:03 +00:00
|
|
|
%_bench: %_bench.c bench_util.o test_util.o $(LIB_OBJ) Makefile
|
2021-06-14 15:00:17 +03:00
|
|
|
clang -Wall -I$(INCLUDE_DIRS) $(CFLAGS) $(KZG_CFLAGS) -o $@ $@.c bench_util.o test_util.o $(LIB_OBJ) -L../lib -lblst
|
2021-02-07 20:58:19 +00:00
|
|
|
./$@
|
|
|
|
|
2021-06-28 12:42:14 +01:00
|
|
|
# Tuning
|
|
|
|
%_tune: KZG_CFLAGS += -O
|
|
|
|
%_tune: %_tune.c bench_util.o test_util.o $(LIB_OBJ) Makefile
|
|
|
|
clang -Wall -I$(INCLUDE_DIRS) $(CFLAGS) $(KZG_CFLAGS) -o $@ $@.c bench_util.o test_util.o $(LIB_OBJ) -L../lib -lblst
|
|
|
|
./$@
|
|
|
|
|
2021-06-14 15:00:17 +03:00
|
|
|
lib: KZG_CFLAGS += -O
|
2021-02-03 16:59:59 +00:00
|
|
|
lib: clean libckzg.a
|
|
|
|
|
2021-06-14 15:00:17 +03:00
|
|
|
profilelib: KZG_CFLAGS += -fprofile-instr-generate -fcoverage-mapping
|
2021-02-07 20:58:19 +00:00
|
|
|
profilelib: clean libckzg.a
|
|
|
|
|
2021-02-03 16:59:59 +00:00
|
|
|
test: $(TESTS)
|
2021-02-01 20:15:45 +00:00
|
|
|
|
2021-02-07 20:58:19 +00:00
|
|
|
bench: $(BENCH)
|
|
|
|
|
2021-02-01 20:15:45 +00:00
|
|
|
clean:
|
|
|
|
rm -f *.o
|
2021-02-03 14:30:44 +00:00
|
|
|
rm -f libckzg.a
|
2021-02-03 16:59:59 +00:00
|
|
|
rm -f $(TESTS)
|
2021-02-08 08:39:24 +00:00
|
|
|
rm -f $(BENCH)
|
2021-06-28 12:42:14 +01:00
|
|
|
rm -f $(TUNE)
|
2021-02-10 11:55:38 +00:00
|
|
|
rm -f *_debug
|
2021-02-01 20:15:45 +00:00
|
|
|
rm -f a.out
|