This repository has been archived by the owner on Dec 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
68 lines (52 loc) · 1.86 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
# 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-watcher
# Go Build ldflags
LDFLAGS=-ldflags "-w -s"
all: mkdir
$(GOBUILD) ${LDFLAGS} -o $(GOBIN)/$(NAME)\
mkdir:
@mkdir -p $(GOBIN)
clean:
@rm -rf $(GOBIN)
build-linux-386:
GOARCH=386 GOOS=linux $(GOBUILD) ${LDFLAGS} -o $(GOBIN)/$(NAME)-linux-386 main.go
release-linux-386: build-linux-386
@tar zcf $(GOBIN)/$(NAME)-linux-386.tar.gz config.yml -C $(GOBIN) $(NAME)-linux-386
@rm -rf $(GOBIN)/$(NAME)-linux-386
build-linux-amd64:
GOARCH=amd64 GOOS=linux $(GOBUILD) ${LDFLAGS} -o $(GOBIN)/$(NAME)-linux-amd64 main.go
release-linux-amd64: build-linux-amd64
@tar zcf $(GOBIN)/$(NAME)-linux-amd64.tar.gz config.yml -C $(GOBIN) $(NAME)-linux-amd64
@rm -rf $(GOBIN)/$(NAME)-linux-amd64
build-darwin-amd64:
GOARCH=amd64 GOOS=darwin $(GOBUILD) ${LDFLAGS} -o $(GOBIN)/$(NAME)-darwin-amd64 main.go
release-darwin-amd64: build-darwin-amd64
@tar zcf $(GOBIN)/$(NAME)-darwin-amd64.tar.gz config.yml -C $(GOBIN) $(NAME)-darwin-amd64
@rm -rf $(GOBIN)/$(NAME)-darwin-amd64
build-windows-386:
GOARCH=386 GOOS=windows $(GOBUILD) ${LDFLAGS} -o $(GOBIN)/$(NAME)-windows-386.exe main.go
release-windows-386: build-windows-386
@zip -j $(GOBIN)/$(NAME)-windows-386.zip 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 main.go
release-windows-amd64: build-windows-amd64
@zip -j $(GOBIN)/$(NAME)-windows-amd64.zip config.yml $(GOBIN)/$(NAME)-windows-amd64.exe
@rm -rf $(GOBIN)/$(NAME)-windows-amd64.exe
release: clean \
mkdir \
release-linux-386 \
release-linux-amd64 \
release-darwin-amd64 \
release-windows-386 \
release-windows-amd64