0
0
Fork 0
mirror of https://git.verdigado.com/NB-Public/simple-wkd.git synced 2024-10-30 03:05:51 +01:00
simple-wkd/Makefile

44 lines
1.2 KiB
Makefile
Raw Normal View History

TARGET_DIR = ./build
BACKEND_EXECUTABLE = simple-wkd
FRONTEND_DIST = dist
ASSETS_DIR = assets/webpage
BACKEND_FILES=backend/Cargo.toml backend/src/*
WEBSITE_FILES=website/*
# Phony targets to ensure they are always executed
.PHONY: all backend frontend
# Main target to build both backend and frontend
all: backend frontend
# Target to install dependencies for the backend
backend-deps:
if [ ! -f /usr/bin/clang -o ! -f /usr/bin/lld -o ! -f /usr/bin/cargo ]; then sudo apt install -y clang lld cargo; fi
touch $@
# Target to build the backend using Cargo
backend:
@echo "Building backend..."
cp -R backend/* .
cargo build --release --target-dir $(TARGET_DIR)
mv $(TARGET_DIR)/release/$(BACKEND_EXECUTABLE) $(BACKEND_EXECUTABLE)-executable
touch $@
# Target to install dependencies for the frontend
frontend-deps:
sudo apt install -y npm
if [ ! -f /usr/bin/node ]; then sudo apt install -y npm; fi
touch $@
# Target to build the frontend using pnpm
frontend: frontend-deps $(WEBSITE_FILES)
@echo "Building frontend..."
cp -R website/* .
[ ! -f /usr/bin/pnpm -a ! -f /usr/local/bin/pnpm ] && sudo npm install -g pnpm
pnpm install
pnpm astro telemetry disable
pnpm run build
mv $(FRONTEND_DIST) $(ASSETS_DIR)
touch $@