-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
33 lines (23 loc) · 1.09 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
EXECUTABLE=gameoflife
WINDOWS=$(EXECUTABLE)_windows_amd64.exe
LINUX=$(EXECUTABLE)_linux_amd64
DARWIN=$(EXECUTABLE)_darwin_amd64
VERSION=$(shell git describe --tags --always --long --dirty)
.PHONY: all test clean
all: test build ## Build and run tests
test: ## Run unit tests
./scripts/test_unit.sh
bench: ## Run benchmark tests
./scripts/test_bench.sh
build: $(WINDOWS) ## Build binaries
@echo version: $(VERSION)
$(WINDOWS): ## Build for Windows
env GOOS=windows GOARCH=amd64 go build -i -v -o $(WINDOWS) -ldflags="-s -w -X main.version=$(VERSION)" ./cmd/game/main.go
$(DARWIN): ## Build for macOS
env GOOS=darwin GOARCH=amd64 go build -i -v -o $(DARWIN) -ldflags="-s -w -X main.version=$(VERSION)" ./cmd/game/main.go
$(LINUX): ## Build for Linux
env GOOS=linux GOARCH=amd64 go build -i -v -o $(LINUX) -ldflags="-s -w -X main.version=$(VERSION)" ./cmd/game/main.go
clean: ## Remove previous build
rm $(WINDOWS) $(LINUX) $(DARWIN)
help: ## Display available commands
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'