Add ability to build a debug library

This commit is contained in:
Ben Edgington 2021-02-03 16:59:59 +00:00
parent cc1ea188bc
commit 9f9c34e0ca
1 changed files with 16 additions and 11 deletions

View File

@ -1,25 +1,30 @@
tests = fft_util_test fft_fr_test fft_g1_test
c_kzg_sources = fft_util.c fft_fr.c fft_g1.c
c_kzg_objects = $(c_kzg_sources:.c=.o)
TESTS = fft_util_test fft_fr_test fft_g1_test
LIB_SRC = fft_util.c fft_fr.c fft_g1.c
LIB_OBJ = $(LIB_SRC:.c=.o)
CFLAGS =
.PRECIOUS: %.o
%.o: %.c %.h c-kzg.h
clang -Wall -c $*.c
%.o: %.c %.h c-kzg.h Makefile
clang -Wall $(CFLAGS) -c $*.c
libckzg.a: $(c_kzg_objects)
ar rc libckzg.a $(c_kzg_objects)
libckzg.a: $(LIB_OBJ) Makefile
ar rc libckzg.a $(LIB_OBJ)
%_test: %_test.c test_util.o libckzg.a Makefile
clang -Wall -o $@ $@.c test_util.o libckzg.a -L../lib -lblst
clang -Wall $(CFLAGS) -o $@ $@.c test_util.o libckzg.a -L../lib -lblst
./$@
lib: libckzg.a
lib: clean libckzg.a
test: $(tests)
debuglib: CFLAGS += -DDEBUG
debuglib: clean libckzg.a
test: $(TESTS)
clean:
rm -f *.o
rm -f libckzg.a
rm -f $(tests)
rm -f $(TESTS)
rm -f a.out