`make` inits submodule & builds blst (#250)

* Make inits submodule & builds blst

* Update the README

* Clean up C workflow
This commit is contained in:
Justin Traglia 2023-03-28 08:26:51 -05:00 committed by GitHub
parent 8de0aa54ce
commit 3c6b9346b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 44 deletions

View File

@ -15,33 +15,24 @@ jobs:
with:
submodules: recursive
- name: Check formatting
working-directory: src
run: |
cd src
make format
git diff --exit-code
- name: Build
run: |
cd src
make blst
make
- name: Test
run: |
cd src
make test
- name: Build/Test
working-directory: src
run: make
- name: Clang Sanitizers
run: |
cd src
make sanitize
working-directory: src
run: make sanitize
- name: Clang Static Analyzer
run: |
cd src
make analyze
working-directory: src
run: make analyze
- name: Install LLVM
uses: egor-tensin/setup-clang@v1
- name: Generate coverage report
run: |
cd src
make coverage
working-directory: src
run: make coverage
- name: Save coverage report
uses: actions/upload-artifact@v3
with:

View File

@ -39,22 +39,21 @@ There are bindings for the following languages:
## Installation
Initialize the blst submodule:
### Prerequisites
The following must be installed:
* `git`
* `make`
* `clang`
### Build & test
To build `c_kzg_4844.o`, the object file that the bindings use, run `make` in
the `src` directory. This will ensure the `blst` submodule has been initialized,
build `blst`, build `c_kzg_4844`, and run the tests. From the project root, run
this:
```
git submodule update --init
```
Build the blst library:
```
cd src
make blst
```
Build/test the C-KZG-4844 library:
```
cd src
make
cd src && make
```

View File

@ -16,7 +16,9 @@ CFLAGS += -DFIELD_ELEMENTS_PER_BLOB=$(FIELD_ELEMENTS_PER_BLOB)
# Disable optimizations. Put after $CFLAGS.
NO_OPTIMIZE = -O0
# Compiler flags for including blst. Put after source files.
# Settings for blst.
BLST_LIBRARY = ../lib/libblst.a
BLST_BUILDSCRIPT = ../blst/build.sh
BLST = -L../lib -lblst
# Compiler flags for generating coverage data.
@ -44,7 +46,19 @@ endif
all: c_kzg_4844.o test
%.o: %.c
$(BLST_BUILDSCRIPT):
@git submodule update --init
$(BLST_LIBRARY): $(BLST_BUILDSCRIPT)
@cd $(dir $(BLST_BUILDSCRIPT)) && \
./$(notdir $(BLST_BUILDSCRIPT)) && \
cp $(notdir $(BLST_LIBRARY)) ../lib && \
cp bindings/*.h ../inc
.PHONY: blst
blst: $(BLST_LIBRARY)
c_kzg_4844.o: c_kzg_4844.c $(BLST_LIBRARY)
@$(CC) $(CFLAGS) -c $<
test_c_kzg_4844: test_c_kzg_4844.c c_kzg_4844.c
@ -56,13 +70,6 @@ test_c_kzg_4844_cov: test_c_kzg_4844.c c_kzg_4844.c
test_c_kzg_4844_prof: test_c_kzg_4844.c c_kzg_4844.c
@$(CC) $(CFLAGS) $(NO_OPTIMIZE) $(PROFILE) -o $@ $< $(BLST) $(PROFILER)
.PHONY: blst
blst:
@cd ../blst && \
./build.sh && \
cp libblst.a ../lib && \
cp bindings/*.h ../inc
.PHONY: test
test: test_c_kzg_4844
@./test_c_kzg_4844