-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
36 lines (26 loc) · 1.03 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
VERSION := $(shell git describe --tags --dirty --always)
LDFLAGS = -ldflags "-X main.Version=${VERSION}"
SOURCES := $(shell find $(SOURCEDIR) -name '*.go' ! -name '*_test.go')
build:
CGO_ENABLED=0 go build ${LDFLAGS} .
build_all: bin/narr-amd64-linux bin/narr-amd64-darwin bin/narr-amd64-windows.exe bin/narr-arm64-darwin
bin/narr-amd64-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build ${LDFLAGS} -o bin/narr-amd64-linux $(SOURCES)
bin/narr-amd64-darwin:
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build ${LDFLAGS} -o bin/narr-amd64-darwin $(SOURCES)
bin/narr-amd64-windows.exe:
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build ${LDFLAGS} -o bin/narr-amd64-windows.exe $(SOURCES)
bin/narr-arm64-darwin:
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build ${LDFLAGS} -o bin/narr-arm64-darwin $(SOURCES)
.PHONY: test
test:
go test -v ./...
.PHONY: test-coverage
coverage:
go test -coverprofile cover.out -v ./...
.PHONY: show-coverage
show-coverage: coverage
go tool cover -html=cover.out
.PHONY: clean
clean:
rm -rf ./bin narr cover.out