This repository has been archived by the owner on Nov 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
74 lines (57 loc) · 2.17 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Basic go commands
GOCMD=go
GOGEN=$(GOCMD) generate
GOINS=$(GOCMD) install
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOVER=$(GOCMD) version
GOBIN=./bin
# Project
NAME=dd-recorder
VERSION=$(shell git describe --tags || echo "testing version" )
# Go Build ldflags
LDFLAGS=-ldflags "-w -s -X 'main.Name=$(NAME)' -X 'main.Version=$(VERSION)' -X 'main.Build=`date`' -X 'main.GoVersion=`$(GOVER)`'"
all: mkdir
$(GOBUILD) ${LDFLAGS} -o $(GOBIN)/$(NAME)\
mkdir:
@mkdir -p $(GOBIN)
clean:
@rm -rf $(GOBIN)
configuration:
@cp config.yml.example $(GOBIN)/config.yml
build-linux-386:
GOARCH=386 GOOS=linux $(GOBUILD) ${LDFLAGS} -o $(GOBIN)/$(NAME)-linux-386 recorder.go
release-linux-386: build-linux-386
@tar zcf $(GOBIN)/$(NAME)-linux-386.tar.gz -C $(GOBIN) $(NAME)-linux-386 config.yml
@rm -rf $(GOBIN)/$(NAME)-linux-386
build-linux-amd64:
GOARCH=amd64 GOOS=linux $(GOBUILD) ${LDFLAGS} -o $(GOBIN)/$(NAME)-linux-amd64 recorder.go
release-linux-amd64: build-linux-amd64
@tar zcf $(GOBIN)/$(NAME)-linux-amd64.tar.gz -C $(GOBIN) $(NAME)-linux-amd64 config.yml
@rm -rf $(GOBIN)/$(NAME)-linux-amd64
build-darwin-amd64:
GOARCH=amd64 GOOS=darwin $(GOBUILD) ${LDFLAGS} -o $(GOBIN)/$(NAME)-darwin-amd64 recorder.go
release-darwin-amd64: build-darwin-amd64
@tar zcf $(GOBIN)/$(NAME)-darwin-amd64.tar.gz -C $(GOBIN) $(NAME)-darwin-amd64 config.yml
@rm -rf $(GOBIN)/$(NAME)-darwin-amd64
build-windows-386:
GOARCH=386 GOOS=windows $(GOBUILD) ${LDFLAGS} -o $(GOBIN)/$(NAME)-windows-386.exe recorder.go
release-windows-386: build-windows-386
@zip -j $(GOBIN)/$(NAME)-windows-386.zip $(GOBIN)/config.yml $(GOBIN)/$(NAME)-windows-386.exe
@rm -rf $(GOBIN)/$(NAME)-windows-386.exe
build-windows-amd64:
GOARCH=amd64 GOOS=windows $(GOBUILD) ${LDFLAGS} -o $(GOBIN)/$(NAME)-windows-amd64.exe recorder.go
release-windows-amd64: build-windows-amd64
@zip -j $(GOBIN)/$(NAME)-windows-amd64.zip $(GOBIN)/config.yml $(GOBIN)/$(NAME)-windows-amd64.exe
@rm -rf $(GOBIN)/$(NAME)-windows-amd64.exe
release: clean \
mkdir \
configuration \
release-linux-386 \
release-linux-amd64 \
release-darwin-amd64 \
release-windows-386 \
release-windows-amd64
@rm -rf $(GOBIN)/config.yml