mirror of
https://github.com/kaaninchen/Laterna.git
synced 2026-09-17 19:12:48 +00:00
🔧 refactor: improve makefile
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
logs
|
logs
|
||||||
build
|
bin
|
||||||
*.sql
|
*.sql
|
||||||
config.json
|
config.json
|
||||||
@@ -1,19 +1,27 @@
|
|||||||
MAIN_PKG=./cmd/server
|
MAIN_PKG :=./cmd/server
|
||||||
|
|
||||||
BIN_NAME ?= laterna
|
BIN_NAME ?= laterna
|
||||||
BIN_DIR=build
|
BIN_DIR := bin
|
||||||
|
CONFIG_FILE := config.json
|
||||||
|
|
||||||
|
.DEFAULT_GOAL := build
|
||||||
|
|
||||||
build:
|
build:
|
||||||
@mkdir -p ${BIN_DIR}
|
@mkdir -p $(BIN_DIR)
|
||||||
@echo "🔧 Building binary using the standard go compiler..."
|
@echo "🔧 Building binary..."
|
||||||
cp config.json build
|
@cp $(CONFIG_FILE) $(BIN_DIR)/
|
||||||
go build -o $(BIN_DIR)/$(BIN_NAME) $(MAIN_PKG)
|
@go build -o $(BIN_DIR)/$(BIN_NAME) $(MAIN_PKG)
|
||||||
@echo "✅ Build complete: $(BIN_DIR)/$(BIN_NAME)"
|
@echo "✅ Build complete: $(BIN_DIR)/$(BIN_NAME)"
|
||||||
|
|
||||||
run:
|
run:
|
||||||
go run ./cmd/server/
|
@echo "🚀 Running server..."
|
||||||
|
@go run $(MAIN_PKG)
|
||||||
clean:
|
clean:
|
||||||
rm -rf ${BIN_DIR}
|
@echo "🧹 Cleaning up..."
|
||||||
rm -rf logs/
|
@rm -rf $(BIN_DIR) logs/
|
||||||
go mod tidy
|
@go mod tidy
|
||||||
|
help:
|
||||||
|
@echo "Makefile targets:"
|
||||||
|
@echo " build – Build the binary"
|
||||||
|
@echo " run – Run the development server"
|
||||||
|
@echo " clean – Remove build artifacts and tidy modules"
|
||||||
|
@echo " help – Show this help message"
|
||||||
@@ -27,12 +27,12 @@ You can leave the json as it is or configure it to your liking, although some co
|
|||||||
|
|
||||||
Make sure that go is installed. The server was tested with go 1.24.5 on linux.
|
Make sure that go is installed. The server was tested with go 1.24.5 on linux.
|
||||||
|
|
||||||
`$ go run ./cmd/server`
|
run using the makefile
|
||||||
|
|
||||||
or use the makefile:
|
|
||||||
|
|
||||||
`$ make run`
|
`$ make run`
|
||||||
|
|
||||||
|
for further makefile usage, see
|
||||||
|
`$ make help`
|
||||||
|
|
||||||
## 🛜 API Documentation
|
## 🛜 API Documentation
|
||||||
|
|
||||||
<details><summary>Docs</summary>
|
<details><summary>Docs</summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user