-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
46 lines (37 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
46
BUILT := $(shell date -u '+%Y-%m-%d %I:%M:%S')
TAG := $(shell git tag --points-at HEAD)
COMMIT := $(shell git rev-parse --short HEAD)
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
GO_VERSION := $(shell go version)
LDFLAGS += -X "main.Built=$(BUILT)"
LDFLAGS += -X "main.Commit=$(COMMIT)/$(TAG)"
LDFLAGS += -X "main.Branch=$(BRANCH)"
LDFLAGS += -X "main.GoVersion=$(GO_VERSION)"
BUILD := go build -ldflags '$(LDFLAGS)'
default: build
setup:
@go get
@go install github.com/benbjohnson/ego/cmd/ego
build: *.go ego.go
$(BUILD) .
install: *.go *.ego
go install -ldflags '$(LDFLAGS)' .
ego.go: *.ego
@ego
samples: build
@rm -f samples/out/*
@./gpx -o samples/out -vo 0 samples/in/*
dist:
GOOS=darwin GOARCH=arm64 $(BUILD) -o dist/ .
tar zcf dist/gpx-osx-arm64.tgz -C dist/ gpx
GOOS=darwin GOARCH=amd64 $(BUILD) -o dist/ .
tar zcf dist/gpx-osx-amd64.tgz -C dist/ gpx
GOOS=linux GOARCH=arm64 $(BUILD) -o dist/ .
tar zcf dist/gpx-linux-arm64.tgz -C dist/ gpx
GOOS=linux GOARCH=amd64 $(BUILD) -o dist/ .
tar zcf dist/gpx-linux-amd64.tgz -C dist/ gpx
GOOS=windows GOARCH=amd64 $(BUILD) -o dist/ .
tar zcf dist/gpx-windows-amd64.tgz -C dist/ gpx.exe
test:
@go test .
.PHONY: setup samples dist test