Archived
3
0

extract config to external files
Some checks failed
Check indentation / build (push) Has been cancelled
Continuous testing / build (push) Has been cancelled

This commit is contained in:
2025-03-12 23:08:40 +01:00
parent 975ebedace
commit 5513042b1b
10 changed files with 193 additions and 46 deletions

View File

@@ -6,25 +6,16 @@ ARCH := $(shell uname -m)
FILES_RS := $(shell find src -type f -regex '^.*\.rs$$')
FILES_CLIENT := client/dst/index.html client/dst/script.js client/dst/style.css
MAIN_RS_SRCS := $(FILES_RS) $(FILES_CLIENT) Cargo.toml config.json
MAIN_RS_SRCS := $(FILES_RS) $(FILES_CLIENT) Cargo.toml
SEARCH_REPLACE := lib/search_and_replace/target/release/search_and_replace
DEV_DB := $(shell jq -r .dev.db config.json)
DEV_BIND := $(shell jq -r .dev.bind_to config.json)
PROD_DB := $(shell jq -r .prod.db config.json)
PROD_SOCK_PATH := $(shell jq -r .prod.sock_path config.json)
.PHONY: run
run: $(MAIN_RS_SRCS)
DB_PATH="$(DEV_DB)" \
BIND_TO="$(DEV_BIND)" \
cargo run --features dev
run: $(MAIN_RS_SRCS) dst/dev_config.toml
cargo run --features dev -- dst/dev_config.toml
.PHONY: test
test: target/debug/zmp24
DB_PATH="$(DEV_DB)" \
BIND_TO="$(DEV_BIND)" \
cargo test
.PHONY: test_tabs
@@ -47,22 +38,17 @@ clean: client_clean
dst:
mkdir dst
include lib/config.mk
include client/client.mk
include image/image.mk
target/release/zmp24: $(MAIN_RS_SRCS)
DB_PATH="$(PROD_DB)" \
BIND_TO="$(PROD_SOCK_PATH)" \
cargo build --release
target/debug/zmp24: $(MAIN_RS_SRCS)
DB_PATH="$(DEV_DB)" \
BIND_TO="$(DEV_BIND)" \
cargo build
target/$(ARCH)-unknown-linux-musl/release/zmp24: $(MAIN_RS_SRCS)
DB_PATH="$(PROD_DB)" \
BIND_TO="$(PROD_SOCK_PATH)" \
cargo build --target $(ARCH)-unknown-linux-musl --release
$(SEARCH_REPLACE): lib/search_and_replace/src/main.rs lib/search_and_replace/Cargo.toml