https://github.com/younghakim7/makefile_training
https://github.com/younghakim7/makefile_training
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/younghakim7/makefile_training
- Owner: YoungHaKim7
- Created: 2024-01-17T15:36:44.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-17T15:41:06.000Z (over 1 year ago)
- Last Synced: 2025-01-16T21:11:33.432Z (5 months ago)
- Size: 1000 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Makefile_training
- https://github.com/danielclough/candle_chat
# Makefile sample
```Makefile
help:
@echo "Make Commands:"
@echo "make help\n\tThis menu"
@echo "make init\n\tInitialize Project (For Debian/Ubuntu)"
@echo "make dev\n\tStart with Hot Module Reload."
@echo "make prod\n\tStart with --release"
@echo "make stop\n\tKill running processes."init:
# apt-get install
@sudo apt-get update && sudo apt-get install -y gcc build-essential libssl-dev pkg-config nvidia-cuda-toolkit;
# install rust if not available
@if ! command -v cargo; then \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh; \
. "$$HOME/.cargo/env"; \
fi
# install wasm target if not available
@if ! command -v rustup target list | grep "wasm32-unknown-unknown (installed)"; then \
rustup target add wasm32-unknown-unknown; \
fi
# install trunk if not available
@if ! command -v trunk; then \
cargo install trunk; \
fi
# install cargo-watch if not available
@if ! command -v cargo-watch; then \
cargo install cargo-watch; \
fi
# create required frontend/.env file if not available
@if ! cat -v frontend/.env; then \
cp frontend/.env-example frontend/.env; \
echo "copied frontend/.env-example to frontend/.env"; \
fidev:
cd backend && cargo watch -q -c -w src/ -x run &
cd frontend && trunk serve &prod:
cd backend && cargo run --release &
cd frontend && trunk serve --release &kill:
@kill -9 $$(ps aux | grep -v "grep" | grep "candle-chat" | xargs | cut -d ' ' -f 2) 2&1> /dev/null
@kill -9 $$(ps aux | grep -v "grep" | grep "candle-chat-backend" | xargs | cut -d ' ' -f 2) 2&1> /dev/null
@kill -9 $$(ps aux | grep -v "grep" | grep "cargo-watch" | xargs | cut -d ' ' -f 2) 2&1> /dev/null
@kill -9 $$(ps aux | grep -v "grep" | grep "cargo run" | xargs | cut -d ' ' -f 2) 2&1> /dev/null
@kill -9 $$(ps aux | grep -v "grep" | grep "trunk serve" | xargs | cut -d ' ' -f 2) 2&1> /dev/null
```