2022-11-03 13:08:17 +00:00
|
|
|
ifeq ($(OS),Windows_NT)
|
2023-04-26 17:55:52 +00:00
|
|
|
ifneq (,$(findstring Git/,$(SHELL)))
|
|
|
|
BLST_BUILDSCRIPT = ./build.bat
|
|
|
|
else
|
|
|
|
BLST_BUILDSCRIPT = .\build.bat
|
|
|
|
endif
|
|
|
|
BLST_OBJ = blst.lib
|
|
|
|
LOCATION ?= win-x64
|
|
|
|
CLANG_EXECUTABLE = clang
|
|
|
|
CKZG_LIBRARY_PATH = Ckzg.Bindings\runtimes\$(LOCATION)\native\ckzg.dll
|
|
|
|
CFLAGS += -Wl,/def:ckzg.def
|
2022-11-03 13:08:17 +00:00
|
|
|
else
|
2023-04-26 17:55:52 +00:00
|
|
|
BLST_BUILDSCRIPT = ./build.sh
|
|
|
|
BLST_OBJ = libblst.a
|
|
|
|
CLANG_EXECUTABLE = clang
|
|
|
|
|
|
|
|
UNAME_S := $(shell uname -s)
|
|
|
|
UNAME_M := $(shell uname -m)
|
|
|
|
ifeq ($(UNAME_S),Linux)
|
|
|
|
ifeq ($(UNAME_M),x86_64)
|
|
|
|
LOCATION ?= linux-x64
|
|
|
|
else
|
|
|
|
LOCATION ?= linux-arm64
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
ifeq ($(UNAME_S),Darwin)
|
|
|
|
ifeq ($(UNAME_M),arm64)
|
|
|
|
LOCATION ?= osx-arm64
|
|
|
|
else
|
|
|
|
LOCATION ?= osx-x64
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
CKZG_LIBRARY_PATH = Ckzg.Bindings/runtimes/$(LOCATION)/native/ckzg.so
|
2022-11-03 13:08:17 +00:00
|
|
|
endif
|
2022-10-01 17:03:52 +00:00
|
|
|
|
2023-02-21 15:57:25 +00:00
|
|
|
FIELD_ELEMENTS_PER_BLOB ?= 4096
|
|
|
|
INCLUDE_DIRS = ../../src ../../blst/bindings
|
|
|
|
TARGETS = ckzg.c ../../src/c_kzg_4844.c ../../blst/$(BLST_OBJ)
|
2022-11-03 13:08:17 +00:00
|
|
|
|
2023-02-21 15:57:25 +00:00
|
|
|
CFLAGS += -O2 -Wall -Wextra -shared
|
|
|
|
CFLAGS += -DFIELD_ELEMENTS_PER_BLOB=$(FIELD_ELEMENTS_PER_BLOB)
|
|
|
|
CFLAGS += ${addprefix -I,${INCLUDE_DIRS}}
|
2023-03-06 21:46:00 +00:00
|
|
|
ifdef ARCH
|
|
|
|
CFLAGS += --target=$(ARCH)
|
|
|
|
BLST_BUILDSCRIPT_FLAGS += --target=$(ARCH)
|
|
|
|
endif
|
2022-11-03 13:08:17 +00:00
|
|
|
|
2023-02-21 15:57:25 +00:00
|
|
|
.PHONY: all
|
|
|
|
all: blst ckzg ckzg-dotnet
|
2022-11-03 13:08:17 +00:00
|
|
|
|
2023-02-21 15:57:25 +00:00
|
|
|
.PHONY: blst
|
|
|
|
blst:
|
2023-03-06 21:46:00 +00:00
|
|
|
cd ../../blst && $(BLST_BUILDSCRIPT) $(BLST_BUILDSCRIPT_FLAGS)
|
2022-11-03 13:08:17 +00:00
|
|
|
|
2023-02-21 15:57:25 +00:00
|
|
|
.PHONY: ckzg
|
|
|
|
ckzg: blst
|
|
|
|
$(CLANG_EXECUTABLE) $(CFLAGS) -o $(CKZG_LIBRARY_PATH) $(TARGETS)
|
2022-11-03 13:08:17 +00:00
|
|
|
|
2023-02-21 15:57:25 +00:00
|
|
|
.PHONY: ckzg-dotnet
|
|
|
|
ckzg-dotnet: ckzg
|
2022-11-29 20:47:44 +00:00
|
|
|
dotnet build
|
2023-02-21 15:57:25 +00:00
|
|
|
dotnet test
|