67 lines
1.5 KiB
Makefile
Raw Normal View History

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