# Router Backup Tool Makefile # Variables BINARY_NAME=ipng-router-backup SOURCE_DIR=src BUILD_DIR=. GO_FILES=$(SOURCE_DIR)/main.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) main.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 -v . # Format Go code .PHONY: fmt fmt: @echo "Formatting Go code..." cd $(SOURCE_DIR) && go fmt ./... # Build Debian package .PHONY: pkg-deb pkg-deb: fakeroot dpkg-buildpackage -us -uc -b # Clean package artifacts .PHONY: clean-pkg clean-pkg: @echo "Cleaning package artifacts..." @rm -f *.deb @echo "Package cleanup complete" # 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 " pkg-deb - Create Debian package" @echo " clean-pkg - Remove package artifacts" @echo " help - Show this help message"