-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
32 lines (25 loc) · 1.05 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
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
BINARY_NAME=bin/IIoTOEE
BINARY_WINDOWS=$(BINARY_NAME)_windows_amd64.exe
BINARY_LINUX=$(BINARY_NAME)_linux_amd64
BINARY_DARWIN=$(BINARY_NAME)_darwin_amd64
all: build ## Build for all platforms
build: build-windows build-linux build-darwin ## Build binaries for all platforms
clean: ## Clean all binaries
$(GOCLEAN)
rm -f $(BINARY_WINDOWS)
rm -f $(BINARY_LINUX)
# Cross compilation
build-windows: ## Build binary for windows
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(GOBUILD) -o $(BINARY_WINDOWS) -v
build-linux: ## Build binary for linux
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_LINUX) -v
build-darwin: ## Build binary for darwin
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 $(GOBUILD) -o $(BINARY_DARWIN) -v
help: ## Display available commands
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'