forked from mimiro-io/datahub-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (38 loc) · 1.46 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
SHELL := /bin/bash
EXECUTABLE=datahub-cli
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
.PHONY: all clean
#all: test build ## Build and run tests
all: crossplatform test ## Build and run tests
#test: ## Run unit tests
# ./scripts/test_unit.sh
crossplatform: windows linux darwin ## Build binaries
@echo version: $(VERSION)
windows: $(WINDOWS) ## Build for Windows
linux: $(LINUX) ## Build for Linux
darwin: $(DARWIN) ## Build for Darwin (macOS)
$(WINDOWS):
env GOOS=windows GOARCH=amd64 go build -v -o bin/$(WINDOWS) -ldflags="-s -w -X main.version=$(VERSION)" ./cmd/cli/main.go
$(LINUX):
env GOOS=linux GOARCH=amd64 go build -v -o bin/$(LINUX) -ldflags="-s -w -X main.version=$(VERSION)" ./cmd/cli/main.go
$(DARWIN):
env GOOS=darwin GOARCH=amd64 go build -v -o bin/$(DARWIN) -ldflags="-s -w -X main.version=$(VERSION)" ./cmd/cli/main.go
clean: ## Remove previous build
rm -f $(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}'
run:
go run cmd/cli/main.go
build:
go build cmd/cli/main.go
test:
go vet ./...
go test ./... -v
license:
go install github.com/google/addlicense; addlicense -c "MIMIRO AS" $(shell find . -iname "*.go")
mim:
go build -o bin/mim ./cmd/cli/main.go