-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
46 lines (36 loc) · 818 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
36
37
38
39
40
41
42
43
44
45
46
# init project path
WORKROOT := $(shell pwd)
OUTDIR := $(WORKROOT)/output
# init environment variables
export GOPATH := $(WORKROOT)/../../../../
export PATH := $(GOPATH)/bin:$(PATH)
export GO111MODULE := on
# init command params
GO := go
GOBUILD := $(GO) build
GOTEST := $(GO) test
GOVET := $(GO) vet
GOGET := $(GO) get
GOGEN := $(GO) generate
GOCLEAN := $(GO) clean
# make, make all
all: compile package
# make compile, go build
compile: build
build:
$(GOBUILD)
# make test, test your code
test: vet-case
vet-case:
${GOVET} ./...
# make package
package:
mkdir -p $(OUTDIR)/bin
mv hello $(OUTDIR)/bin
# make clean
clean:
$(GOCLEAN)
rm -rf $(OUTDIR)
rm -rf $(GOPATH)/pkg/linux_amd64
# avoid filename conflict and speed up build
.PHONY: all compile test package clean build