add Makefile
This commit is contained in:
47
Makefile
Normal file
47
Makefile
Normal file
@ -0,0 +1,47 @@
|
||||
# Router Backup Tool Makefile
|
||||
|
||||
# Variables
|
||||
BINARY_NAME=router_backup
|
||||
SOURCE_DIR=src
|
||||
BUILD_DIR=.
|
||||
GO_FILES=$(SOURCE_DIR)/router_backup.go
|
||||
|
||||
# Default target
|
||||
.PHONY: all
|
||||
all: build
|
||||
|
||||
# Build the Go binary
|
||||
.PHONY: build
|
||||
build:
|
||||
@echo "Building $(BINARY_NAME)..."
|
||||
cd $(SOURCE_DIR) && go build -o ../$(BUILD_DIR)/$(BINARY_NAME) router_backup.go
|
||||
@echo "Build complete: $(BINARY_NAME)"
|
||||
|
||||
# Clean build artifacts
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@echo "Cleaning build artifacts..."
|
||||
rm -f $(BUILD_DIR)/$(BINARY_NAME)
|
||||
@echo "Clean complete"
|
||||
|
||||
# Run tests
|
||||
.PHONY: test
|
||||
test:
|
||||
@echo "Running tests..."
|
||||
cd $(SOURCE_DIR) && go test ./...
|
||||
|
||||
# Format Go code
|
||||
.PHONY: fmt
|
||||
fmt:
|
||||
@echo "Formatting Go code..."
|
||||
cd $(SOURCE_DIR) && go fmt ./...
|
||||
|
||||
# Show help
|
||||
.PHONY: help
|
||||
help:
|
||||
@echo "Available targets:"
|
||||
@echo " build - Build the router_backup binary"
|
||||
@echo " clean - Remove build artifacts"
|
||||
@echo " test - Run tests"
|
||||
@echo " fmt - Format Go code"
|
||||
@echo " help - Show this help message"
|
Reference in New Issue
Block a user