mirror of
https://github.com/status-im/c-kzg-4844.git
synced 2025-02-03 05:44:52 +00:00
Add KZG_CFLAGS env var to compiler options for passing additional compiler options (#6)
* Add KZG_CFLAGS env var to compiler options for passing additional compiler options
This commit is contained in:
parent
32becfefcf
commit
7f8b81717d
18
src/Makefile
18
src/Makefile
@ -4,36 +4,36 @@ BENCH = fft_fr_bench fft_g1_bench recover_bench zero_poly_bench
|
|||||||
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
|
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
|
||||||
LIB_OBJ = $(LIB_SRC:.c=.o)
|
LIB_OBJ = $(LIB_SRC:.c=.o)
|
||||||
|
|
||||||
CFLAGS =
|
KZG_CFLAGS =
|
||||||
INCLUDE_DIRS = ../inc
|
INCLUDE_DIRS = ../inc
|
||||||
|
|
||||||
.PRECIOUS: %.o
|
.PRECIOUS: %.o
|
||||||
|
|
||||||
%.o: %.c %.h c_kzg.h Makefile
|
%.o: %.c %.h c_kzg.h Makefile
|
||||||
clang -Wall -I$(INCLUDE_DIRS) $(CFLAGS) -c $*.c
|
clang -Wall -I$(INCLUDE_DIRS) $(CFLAGS) $(KZG_CFLAGS) -c $*.c
|
||||||
|
|
||||||
libckzg.a: $(LIB_OBJ) Makefile
|
libckzg.a: $(LIB_OBJ) Makefile
|
||||||
ar rc libckzg.a $(LIB_OBJ)
|
ar rc libckzg.a $(LIB_OBJ)
|
||||||
|
|
||||||
%_test: %_test.c debug_util.o test_util.o libckzg.a Makefile
|
%_test: %_test.c debug_util.o test_util.o libckzg.a Makefile
|
||||||
clang -Wall -I$(INCLUDE_DIRS) $(CFLAGS) -o $@ $@.c debug_util.o test_util.o libckzg.a -L../lib -lblst
|
clang -Wall -I$(INCLUDE_DIRS) $(CFLAGS) $(KZG_CFLAGS) -o $@ $@.c debug_util.o test_util.o libckzg.a -L../lib -lblst
|
||||||
./$@
|
./$@
|
||||||
|
|
||||||
# This version will abort on error and print the file and line number
|
# This version will abort on error and print the file and line number
|
||||||
%_test_debug: CFLAGS += -g -O0 -DDEBUG
|
%_test_debug: KZG_CFLAGS += -g -O0 -DDEBUG
|
||||||
%_test_debug: %_test.c debug_util.o test_util.o libckzg.a Makefile
|
%_test_debug: %_test.c debug_util.o test_util.o libckzg.a Makefile
|
||||||
clang -Wall -I$(INCLUDE_DIRS) $(CFLAGS) -o $@ $*_test.c debug_util.o test_util.o libckzg.a -L../lib -lblst
|
clang -Wall -I$(INCLUDE_DIRS) $(CFLAGS) $(KZG_CFLAGS) -o $@ $*_test.c debug_util.o test_util.o libckzg.a -L../lib -lblst
|
||||||
|
|
||||||
# Benchmarks
|
# Benchmarks
|
||||||
%_bench: CFLAGS += -O
|
%_bench: KZG_CFLAGS += -O
|
||||||
%_bench: %_bench.c bench_util.o test_util.o $(LIB_OBJ) Makefile
|
%_bench: %_bench.c bench_util.o test_util.o $(LIB_OBJ) Makefile
|
||||||
clang -Wall -I$(INCLUDE_DIRS) $(CFLAGS) -o $@ $@.c bench_util.o test_util.o $(LIB_OBJ) -L../lib -lblst
|
clang -Wall -I$(INCLUDE_DIRS) $(CFLAGS) $(KZG_CFLAGS) -o $@ $@.c bench_util.o test_util.o $(LIB_OBJ) -L../lib -lblst
|
||||||
./$@
|
./$@
|
||||||
|
|
||||||
lib: CFLAGS += -O
|
lib: KZG_CFLAGS += -O
|
||||||
lib: clean libckzg.a
|
lib: clean libckzg.a
|
||||||
|
|
||||||
profilelib: CFLAGS += -fprofile-instr-generate -fcoverage-mapping
|
profilelib: KZG_CFLAGS += -fprofile-instr-generate -fcoverage-mapping
|
||||||
profilelib: clean libckzg.a
|
profilelib: clean libckzg.a
|
||||||
|
|
||||||
test: $(TESTS)
|
test: $(TESTS)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user