-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
45 lines (32 loc) · 1.19 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
SHA := $(shell git rev-parse --short HEAD)
DATE := $(shell TZ=UTC date +%FT%T)Z
VERSION := $(shell cat VERSION)-$(DATE)-$(SHA)
RELEASES=release/imgdiff-darwin-amd64 \
release/imgdiff-darwin-386 \
release/imgdiff-linux-amd64 \
release/imgdiff-linux-386 \
release/imgdiff-windows-amd64.exe \
release/imgdiff-windows-386.exe
SRCS=./cmd/imgdiff/*.go
LDFLAGS=-ldflags "-X main.version=$(VERSION)"
imgdiff: $(SRCS)
go build -o imgdiff $(LDFLAGS) $(SRCS)
prof:
go test -bench . -cpuprofile cpu.prof
go tool pprof -top imgdiff.test cpu.prof
release: $(RELEASES)
release/imgdiff-darwin-amd64: $(SRCS)
GOOS=darwin GOARCH=amd64 go build -o $@ $(LDFLAGS) $(SRCS)
release/imgdiff-darwin-386: $(SRCS)
GOOS=darwin GOARCH=386 go build -o $@ $(LDFLAGS) $(SRCS)
release/imgdiff-linux-amd64: $(SRCS)
GOOS=linux GOARCH=amd64 go build -o $@ $(LDFLAGS) $(SRCS)
release/imgdiff-linux-386: $(SRCS)
GOOS=linux GOARCH=386 go build -o $@ $(LDFLAGS) $(SRCS)
release/imgdiff-windows-amd64.exe: $(SRCS)
GOOS=windows GOARCH=amd64 go build -o $@ $(LDFLAGS) $(SRCS)
release/imgdiff-windows-386.exe: $(SRCS)
GOOS=windows GOARCH=386 go build -o $@ $(LDFLAGS) $(SRCS)
clean:
rm -rf release imgdiff *.prof
default: imgdiff