Skip to content

Commit

Permalink
Finalize generation and compilation of C code.
Browse files Browse the repository at this point in the history
  • Loading branch information
MilanSkocic committed Nov 19, 2024
1 parent 28a9230 commit b4609bc
Show file tree
Hide file tree
Showing 9 changed files with 9,715 additions and 65 deletions.
3 changes: 2 additions & 1 deletion C/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ all: headers sources
headers:
make -C include

sources:
sources: headers
make -C src sources

build:
mkdir -p $(BUILD_DIR)
make -C src build

clean:
make -C include clean
Expand Down
25 changes: 24 additions & 1 deletion C/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,39 @@ PY=python
GEN=../../scripts/gen_c.py

AST_DIR=../../data
CBUILD_DIR = ../build

AST_SRC=$(wildcard $(AST_DIR)/*.toml)
C_SRC = codata_constants_2010.c codata_constants_2014.c codata_constants_2018.c codata_constants_2022.c
C_OBJ=$(patsubst %.c, $(CBUILD_DIR)/%.o, $(C_SRC))
DLIB=$(CBUILD_DIR)/$(LIBNAME)$(EXT)

.PHONY: clean

all: sources

sources: $(SRC)
sources: $(C_SRC)

build: $(C_OBJ) $(DLIB)

codata_constants_2010.c: $(AST_DIR)/codata_2010.toml
$(PY) $(GEN) $< $@

codata_constants_2014.c: $(AST_DIR)/codata_2014.toml
$(PY) $(GEN) $< $@

codata_constants_2018.c: $(AST_DIR)/codata_2018.toml
$(PY) $(GEN) $< $@

codata_constants_2022.c: $(AST_DIR)/codata_2022.toml
$(PY) $(GEN) $< $@

$(CBUILD_DIR)/%.o: %.c
gcc -c -I ../include $(CFLAGS_RELEASE) $(FPM_CFLAGS) $< -o $@

$(CBUILD_DIR)/$(LIBNAME)$(EXT): $(C_OBJ)
gcc -shared $(C_OBJ) -o $@

clean:
rm -rf $(C_SRC)
rm -rf $(CBUILD_DIR)/*
Loading

0 comments on commit b4609bc

Please sign in to comment.