forked from thousandeyes/shoelaces
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
52 lines (37 loc) · 1.05 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
GO = go
PYTHON = python3
SCDOC = scdoc
TAG_COMMIT = $(shell git rev-list --tags --max-count=1)
TAG_VERSION = $(shell git describe --tags ${TAG_COMMIT})
BUILD_DATE = $(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
LDFLAGS = "-s -w -X main.version=$(TAG_VERSION) -X main.build=$(BUILD_DATE)"
pkgs = $(shell $(GO) list ./... | grep -v /vendor/)
.PHONY: all clean upgrade docs
all:
$(GO) build
fmt:
$(GO) fmt
clean:
rm -f shoelaces docs/shoelaces.8
deps:
$(GO) build -v $(EXTRA_FLAGS) ./...
$(PYTHON) -m pip install --user pytest python-dateutil requests
upgrade: deps
go get -u ./...
go mod tidy
go mod vendor
shoelaces.8:
$(SCDOC) < docs/shoelaces.8.scd > docs/shoelaces.8
docs: shoelaces.8
test: fmt
$(GO) test -v $(pkgs) && \
./test/integ-test/integ_test.py
build:
$(GO) build -o bin/shoelaces -ldflags ${LDFLAGS}
binaries: deps linux windows macos
linux:
GOOS=linux ${GO} build -o bin/shoelaces -ldflags ${LDFLAGS}
windows:
GOOS=windows ${GO} build -o bin/shoelaces.exe -ldflags ${LDFLAGS}
macos:
GOOS=darwin ${GO} build -o bin/shoelaces -ldflags ${LDFLAGS}