Newer
Older
EnvoyControlPlane / Makefile
# Project settings
APP_NAME := xds-server
PKG := ./...
BIN_DIR := bin
BIN := $(BIN_DIR)/$(APP_NAME)

# Go build settings
GO       ?= go
GOFLAGS  ?=
LDFLAGS  := -s -w

# Default target
.PHONY: all
all: build

## Build binary
.PHONY: build
build:
	@echo "==> Building $(APP_NAME)..."
	@mkdir -p $(BIN_DIR)
	$(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $(BIN) .

## Run directly (default port 18000, override with PORT env var)
.PHONY: run
run:
	@echo "==> Running $(APP_NAME)..."
	@$(GO) run . --port=$${PORT:-18000} --nodeID=test-id

## Run tests
.PHONY: test
test:
	@echo "==> Running tests..."
	$(GO) test -v $(PKG)

## Lint (basic formatting + vet)
.PHONY: lint
lint:
	@echo "==> Running go fmt and go vet..."
	@$(GO) fmt $(PKG)
	@$(GO) vet $(PKG)

## Clean up build artifacts
.PHONY: clean
clean:
	@echo "==> Cleaning build artifacts..."
	rm -rf $(BIN_DIR)

## Install deps (tidy)
.PHONY: deps
deps:
	@echo "==> Downloading dependencies..."
	$(GO) mod tidy