-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
35 lines (27 loc) · 830 Bytes
/
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
VERSION=$(patsubst "%",%,$(lastword $(shell grep 'const Version' main.go)))
PRODUCT_NAME=qiic
GOVERSION=$(shell go version)
GOOS=$(word 1,$(subst /, ,$(word $(words $(GOVERSION)), $(GOVERSION))))
GOARCH=$(word 2,$(subst /, ,$(word $(words $(GOVERSION)), $(GOVERSION))))
GOCMD=go
BINPATH=./cmd/qiic
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
.PHONY: build test clean
all: build test
build:
$(GOBUILD) $(BINPATH)
test:
$(GOTEST) -v ./...
clean:
rm -f ./qiic
docker-build:
docker build -t $(PRODUCT_NAME):$(VERSION) .
docker-run:
docker build -t $(PRODUCT_NAME):$(VERSION) . \
&& docker run --rm \
$(PRODUCT_NAME):$(VERSION)
.PHONY: help
help: ## Help command
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'