refactor: move cron code to libvieter; link libvieter
Some checks failed
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/docs Pipeline was successful
ci/woodpecker/pr/build Pipeline failed
ci/woodpecker/pr/docker unknown status
ci/woodpecker/pr/man unknown status
ci/woodpecker/pr/test Pipeline failed

This commit is contained in:
Jef Roosens 2023-01-18 17:49:30 +01:00
parent e3e90674c1
commit 5a85441336
9 changed files with 34 additions and 545 deletions

View file

@ -1,9 +1,6 @@
# =====CONFIG=====
SRC_DIR := src
SRCS_C != find '$(SRC_DIR)' -iname '*.c'
SRCS_H != find '$(SRC_DIR)' -iname '*.h'
SRCS_V != find '$(SRC_DIR)' -iname '*.v'
SOURCES := $(SRCS_C) $(SRCS_H) $(SRCS_V)
SRCS != find '$(SRC_DIR)' -iname '*.v'
V_PATH ?= v
V := $(V_PATH) -showcc -gc boehm -W -d use_openssl -skip-unused
@ -12,8 +9,12 @@ all: vieter
# =====COMPILATION=====
.PHONY: libvieter
libvieter:
CFLAGS='-O3' make -C '$(SRC_DIR)/libvieter'
# Regular binary
vieter: $(SOURCES)
vieter: $(SOURCES) libvieter
$(V) -g -o vieter $(SRC_DIR)
# Debug build using gcc
@ -21,7 +22,7 @@ vieter: $(SOURCES)
# multi-threaded and causes issues when running vieter inside gdb.
.PHONY: debug
debug: dvieter
dvieter: $(SOURCES)
dvieter: $(SOURCES) libvieter
$(V_PATH) -showcc -keepc -cg -o dvieter $(SRC_DIR)
# Run the debug build inside gdb
@ -32,12 +33,12 @@ gdb: dvieter
# Optimised production build
.PHONY: prod
prod: pvieter
pvieter: $(SOURCES)
pvieter: $(SOURCES) libvieter
$(V) -o pvieter -prod $(SRC_DIR)
# Only generate C code
.PHONY: c
c: $(SOURCES)
c: $(SOURCES) libvieter
$(V) -o vieter.c $(SRC_DIR)
@ -72,32 +73,18 @@ man: vieter
# =====OTHER=====
# Linting
.PHONY: lint
lint: lint-v lint-c
.PHONY: lint-v
lint-v:
lint:
$(V) fmt -verify $(SRC_DIR)
$(V) vet -W $(SRC_DIR)
$(V_PATH) missdoc -p $(SRC_DIR)
@ [ $$($(V_PATH) missdoc -p $(SRC_DIR) | wc -l) = 0 ]
.PHONY: lint-c
lint-c:
clang-format --Werror -n $(SRCS_C) $(SRCS_H)
# Formatting
.PHONY: fmt
fmt: fmt-v fmt-c
.PHONY: fmt-v
fmt-v:
fmt:
$(V) fmt -w $(SRC_DIR)
.PHONY: fmt-c
fmt-c:
clang-format -i $(SRCS_C) $(SRCS_H)
# Testing
.PHONY: test
@ -109,6 +96,7 @@ test:
.PHONY: clean
clean:
rm -rf 'data' 'vieter' 'dvieter' 'pvieter' 'vieter.c' 'pkg' 'src/vieter' *.pkg.tar.zst 'suvieter' 'afvieter' '$(SRC_DIR)/_docs' 'docs/public'
make -C '$(SRC_DIR)/libvieter' clean
# =====EXPERIMENTAL=====