-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
37 lines (29 loc) · 861 Bytes
/
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
ifdef DEBUG
GOFLAGS := -gcflags="-N -l"
else
GOFLAGS :=
endif
GO ?= go
TAGS :=
LDFLAGS :=
GIT_COMMIT = $(shell git rev-parse HEAD)
GIT_SHA = $(shell git rev-parse --short HEAD)
GIT_TAG = $(shell git describe --tags --abbrev=0 --exact-match 2>/dev/null || echo "canary")
GIT_DIRTY = $(shell test -n "`git status --porcelain`" && echo "dirty" || echo "clean")
LDFLAGS += -X github.com/b4b4r07/afx/cmd.BuildSHA=${GIT_SHA}
LDFLAGS += -X github.com/b4b4r07/afx/cmd.GitTreeState=${GIT_DIRTY}
ifneq ($(GIT_TAG),)
LDFLAGS += -X github.com/b4b4r07/afx/cmd.BuildTag=${GIT_TAG}
endif
all: build
.PHONY: build
build:
$(GO) install $(GOFLAGS) -ldflags '$(LDFLAGS)'
.PHONY: test
test:
$(GO) test -v ./...
.PHONY: docs
docs:
@python3 -m pip install --upgrade pip
@python3 -m pip install -r ./docs/requirements.txt
@python3 -m mkdocs serve