mirror of
https://git.verdigado.com/NB-Public/simple-wkd.git
synced 2024-12-06 14:52:41 +01:00
Created Makefile and .gitgnore, updated deps
This commit is contained in:
parent
a61f03f412
commit
55fe51fa44
4 changed files with 3835 additions and 4584 deletions
43
Makefile
Normal file
43
Makefile
Normal file
|
@ -0,0 +1,43 @@
|
|||
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 $@
|
Loading…
Add table
Add a link
Reference in a new issue