-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
57 lines (45 loc) · 1.42 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
.PHONY: all
all: test install
ifeq ($(GOPATH),)
GOPATH=~/go
endif
# setup dependencies
.PHONY: setup
setup:
go get
# runs all tests and benchmarks
.PHONY: bench
bench: setup
go test -bench .
cd encryption && go test -bench=.
cd gohash_db && go test -bench=.
# runs all tests
.PHONY: test
test: setup
go test ./...
# installs go-hash
.PHONY: install
install: setup
go install
# build a smaller executable without symbols and debug info for all supported OSs and ARCHs
.PHONY: release release-linux release-windows release-darwin
release-linux:
env GOOS=linux env GOARCH=amd64 go build -ldflags "-s -w" -o releases/go-hash-linux-amd64
env GOOS=linux env GOARCH=386 go build -ldflags "-s -w" -o releases/go-hash-linux-386
release-windows:
env GOOS=windows env GOARCH=amd64 go build -ldflags "-s -w" -o releases/go-hash-windows-amd64
env GOOS=windows env GOARCH=386 go build -ldflags "-s -w" -o releases/go-hash-windows-386
release-darwin:
env GOOS=darwin env GOARCH=amd64 go build -ldflags "-s -w" -o releases/go-hash-darwin-amd64
env GOOS=darwin env GOARCH=arm64 go build -ldflags "-s -w" -o releases/go-hash-darwin-arm64
release: test release-linux release-windows release-darwin
# clean build artifacts, i.e. everything that is not source code.
# Does not remove the installed binary.
.PHONY: clean
clean:
rm -f go-hash
rm -rf releases
# uninstall the go-hash binary
.PHONY: uninstall
uninstall:
rm -f $(GOPATH)/bin/go-hash