c-kzg-4844/bindings/csharp/Makefile

59 lines
1.5 KiB
Makefile
Raw Normal View History

2022-11-03 13:08:17 +00:00
INCLUDE_DIRS = ../../src ../../blst/bindings
2022-10-01 17:03:52 +00:00
FIELD_ELEMENTS_PER_BLOB ?= 4096
2022-11-03 13:08:17 +00:00
ifeq ($(OS),Windows_NT)
BLST_BUILDSCRIPT=./build.bat
BLST_OBJ=blst.lib
2022-11-03 13:08:17 +00:00
TESTS_EXECUTABLE=test_ckzg.exe
CSHARP_PLATFORM?=win-x64
CLANG_PLATFROM?=x86_64-win
CLANG_FLAGS=
CLANG_EXECUTABLE=clang
CKZG_LIBRARY_PATH=Ckzg.Bindings\runtimes\$(CSHARP_PLATFORM)\native\ckzg.dll
2022-11-03 13:08:17 +00:00
else
BLST_BUILDSCRIPT=./build.sh
BLST_OBJ=libblst.a
TESTS_EXECUTABLE=./test_ckzg
CSHARP_PLATFORM?=linux-x64
CLANG_PLATFORM?=x86_64-linux
CLANG_FLAGS=-fPIC
CLANG_EXECUTABLE=cc
CKZG_LIBRARY_PATH=Ckzg.Bindings/runtimes/$(CSHARP_PLATFORM)/native/ckzg.so
2022-11-03 13:08:17 +00:00
endif
2022-10-01 17:03:52 +00:00
CLANG_FLAGS += -DFIELD_ELEMENTS_PER_BLOB=$(FIELD_ELEMENTS_PER_BLOB)
TARGETS=ckzg.c ../../src/c_kzg_4844.c ../../blst/$(BLST_OBJ)
2022-11-03 13:08:17 +00:00
.blst:
cd ../../blst &&\
git apply ../blst_sha.patch &&\
$(BLST_BUILDSCRIPT) &&\
git apply -R ../blst_sha.patch &&\
cd ../bindings/csharp
.ckzg:
$(CLANG_EXECUTABLE) -O -Wall -shared $(CLANG_FLAGS) ${addprefix -I,${INCLUDE_DIRS}} -o $(CKZG_LIBRARY_PATH) $(TARGETS)
2022-11-03 13:08:17 +00:00
# Ckzg library
ckzg:
@make .blst
@make .ckzg
# E2e tests as an executable
test:
2022-11-03 13:08:17 +00:00
@make .blst
$(CLANG_EXECUTABLE) -O -w -Wall $(CLANG_FLAGS) ${addprefix -I,${INCLUDE_DIRS}} -o $(TESTS_EXECUTABLE) kzg_tests.c $(TARGETS)
2022-11-03 13:08:17 +00:00
# E2e tests are built and run
run-test:
@make test
$(TESTS_EXECUTABLE)
# Makes a build and a nuget package just for windows or linux
# To build full package - use ckzg command on every plaform and dotnet build
ckzg-dotnet:
@make ckzg
dotnet build