|
|
@ -19,7 +19,7 @@ DEB_PACKAGE_NAME := $(BINARY_NAME)_$(DEB_VERSION)_amd64.deb
|
|
|
|
.PHONY: all
|
|
|
|
.PHONY: all
|
|
|
|
all: build
|
|
|
|
all: build
|
|
|
|
|
|
|
|
|
|
|
|
# Build the binary
|
|
|
|
## build: - Build the binary
|
|
|
|
.PHONY: build
|
|
|
|
.PHONY: build
|
|
|
|
build:
|
|
|
|
build:
|
|
|
|
@echo "Building $(BINARY_NAME) version $(VERSION)..."
|
|
|
|
@echo "Building $(BINARY_NAME) version $(VERSION)..."
|
|
|
@ -27,14 +27,14 @@ build:
|
|
|
|
@go build -ldflags "-X $(PKG_PATH).Version=$(VERSION) -X $(PKG_PATH).BuildTime=$(BUILD_TIME) -X $(PKG_PATH).GitCommit=$(GIT_COMMIT)" \
|
|
|
|
@go build -ldflags "-X $(PKG_PATH).Version=$(VERSION) -X $(PKG_PATH).BuildTime=$(BUILD_TIME) -X $(PKG_PATH).GitCommit=$(GIT_COMMIT)" \
|
|
|
|
-o $(BUILD_DIR)/$(BINARY_NAME) .
|
|
|
|
-o $(BUILD_DIR)/$(BINARY_NAME) .
|
|
|
|
|
|
|
|
|
|
|
|
# Clean build artifacts
|
|
|
|
## clean: - Clean build artifacts
|
|
|
|
.PHONY: clean
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
clean:
|
|
|
|
@echo "Cleaning build artifacts..."
|
|
|
|
@echo "Cleaning build artifacts..."
|
|
|
|
@rm -rf $(BUILD_DIR)
|
|
|
|
@rm -rf $(BUILD_DIR)
|
|
|
|
@rm -rf $(DIST_DIR)
|
|
|
|
@rm -rf $(DIST_DIR)
|
|
|
|
|
|
|
|
|
|
|
|
# Build Debian package
|
|
|
|
## deb: - Build Debian package
|
|
|
|
.PHONY: deb
|
|
|
|
.PHONY: deb
|
|
|
|
deb: build
|
|
|
|
deb: build
|
|
|
|
@echo "Building Debian package..."
|
|
|
|
@echo "Building Debian package..."
|
|
|
@ -65,40 +65,32 @@ deb: build
|
|
|
|
@mv $(DIST_DIR)/$(BINARY_NAME)_$(DEB_VERSION).deb $(DIST_DIR)/$(DEB_PACKAGE_NAME)
|
|
|
|
@mv $(DIST_DIR)/$(BINARY_NAME)_$(DEB_VERSION).deb $(DIST_DIR)/$(DEB_PACKAGE_NAME)
|
|
|
|
@echo "Debian package created: $(DIST_DIR)/$(DEB_PACKAGE_NAME)"
|
|
|
|
@echo "Debian package created: $(DIST_DIR)/$(DEB_PACKAGE_NAME)"
|
|
|
|
|
|
|
|
|
|
|
|
# Install dependencies
|
|
|
|
## deps: - Installs Go mod dependencies
|
|
|
|
.PHONY: deps
|
|
|
|
.PHONY: deps
|
|
|
|
deps:
|
|
|
|
deps:
|
|
|
|
@echo "Installing dependencies..."
|
|
|
|
@echo "Installing dependencies..."
|
|
|
|
@go mod download
|
|
|
|
@go mod download
|
|
|
|
|
|
|
|
|
|
|
|
# Run tests
|
|
|
|
## test: - Run tests
|
|
|
|
.PHONY: test
|
|
|
|
.PHONY: test
|
|
|
|
test:
|
|
|
|
test:
|
|
|
|
@echo "Running tests..."
|
|
|
|
@echo "Running tests..."
|
|
|
|
@go test ./...
|
|
|
|
@go test ./...
|
|
|
|
|
|
|
|
|
|
|
|
# Format code
|
|
|
|
## fmt: - Format code
|
|
|
|
.PHONY: fmt
|
|
|
|
.PHONY: fmt
|
|
|
|
fmt:
|
|
|
|
fmt:
|
|
|
|
@echo "Formatting code..."
|
|
|
|
@echo "Formatting code..."
|
|
|
|
@go fmt ./...
|
|
|
|
@go fmt ./...
|
|
|
|
|
|
|
|
|
|
|
|
# Lint code
|
|
|
|
## lint: - Lint code
|
|
|
|
.PHONY: lint
|
|
|
|
.PHONY: lint
|
|
|
|
lint:
|
|
|
|
lint:
|
|
|
|
@echo "Linting code..."
|
|
|
|
@echo "Linting code..."
|
|
|
|
@go vet ./...
|
|
|
|
@go vet ./...
|
|
|
|
|
|
|
|
|
|
|
|
# Show help
|
|
|
|
## help: - Show make file usage
|
|
|
|
.PHONY: help
|
|
|
|
.PHONY: help
|
|
|
|
help:
|
|
|
|
help:
|
|
|
|
@echo "Available targets:"
|
|
|
|
@echo "Usage:"
|
|
|
|
@echo " build - Build the binary in ./build directory"
|
|
|
|
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
|
|
|
|
@echo " deb - Build Debian package in ./dist directory"
|
|
|
|
|
|
|
|
@echo " clean - Clean build and dist directories"
|
|
|
|
|
|
|
|
@echo " deps - Install dependencies"
|
|
|
|
|
|
|
|
@echo " test - Run tests"
|
|
|
|
|
|
|
|
@echo " fmt - Format code"
|
|
|
|
|
|
|
|
@echo " lint - Lint code"
|
|
|
|
|
|
|
|
@echo " help - Show this help message"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|