diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ddc9a83 --- /dev/null +++ b/Makefile @@ -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" \ No newline at end of file