-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
56 lines (37 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
56
VERSION_INJECT=main.versionText
SRCS=*.go cmd/*.go
PACKAGE=cmd/*.go
EXECUTABLE=bin/pushover
LINUX=$(EXECUTABLE)-linux
DARWIN=$(EXECUTABLE)-darwin
WINDOWS=$(EXECUTABLE)-windows
LINUX_AMD64=$(LINUX)-amd64
DARWIN_AMD64=$(DARWIN)-amd64
WINDOWS_AMD64=$(WINDOWS)-amd64.exe
LINUX_386=$(LINUX)-386
WINDOWS_386=$(WINDOWS)-386.exe
.PHONY: all test clean
all: build
build: linux-amd64 windows-amd64 darwin-amd64 linux-386 windows-386
linux-amd64: $(LINUX_AMD64)
windows-amd64: $(WINDOWS_AMD64)
darwin-amd64: $(DARWIN_AMD64)
linux-386: $(LINUX_386)
windows-386: $(WINDOWS_386)
test:
go test -race -coverprofile=coverage.txt -covermode=atomic ./...
go tool cover -html=coverage.txt -o coverage.html
# AMD64 Versions
$(WINDOWS_AMD64): $(SRCS)
GOOS=windows GOARCH=amd64 go build -o $@ -ldflags "-s -w -X $(VERSION_INJECT)=$(shell sh scripts/get-version.sh)" $(PACKAGE)
$(LINUX_AMD64): $(SRCS)
GOOS=linux GOARCH=amd64 go build -o $@ -ldflags "-s -w -X $(VERSION_INJECT)=$(shell sh scripts/get-version.sh)" $(PACKAGE)
$(DARWIN_AMD64): $(SRCS)
GOOS=darwin GOARCH=amd64 go build -o $@ -ldflags "-s -w -X $(VERSION_INJECT)=$(shell sh scripts/get-version.sh)" $(PACKAGE)
# 386 Versions
$(WINDOWS_386): $(SRCS)
GOOS=windows GOARCH=386 go build -o $@ -ldflags "-s -w -X $(VERSION_INJECT)=$(shell sh scripts/get-version.sh)" $(PACKAGE)
$(LINUX_386): $(SRCS)
GOOS=linux GOARCH=386 go build -o $@ -ldflags "-s -w -X $(VERSION_INJECT)=$(shell sh scripts/get-version.sh)" $(PACKAGE)
clean:
rm -rf bin