-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
40 lines (31 loc) · 968 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
38
39
40
# Build config
BUILD_FILES = $(shell go list -f '{{range .GoFiles}}{{$$.Dir}}/{{.}} {{end}}' ./...)
DATE=$(shell date -u "+%a %b %d %T %Y")
TUG_COMMIT ?= $(shell git rev-parse --short HEAD)
TUG_VERSION ?= dev
LDFLAGS = -s -w
LDFLAGS += -X "github.com/b4nst/turbogit/cmd.BuildDate=$(DATE)"
LDFLAGS += -X "github.com/b4nst/turbogit/cmd.Commit=$(TUG_COMMIT)"
LDFLAGS += -X "github.com/b4nst/turbogit/cmd.Version=$(TUG_VERSION)"
# Go config
BUILD_ARGS=-trimpath -tags=static -ldflags='$(LDFLAGS)'
GOCMD=go
GOBUILD=$(GOCMD) build $(BUILD_ARGS)
GOTEST=$(GOCMD) test -tags=static
GORUN=$(GOCMD) run -tags=static
dist/bin/tug: $(BUILD_FILES)
$(GOBUILD) -o "$@" ./main.go
build: libgit2 dist/bin/tug
.PHONY: build
libgit2:
$(MAKE) -C ./git2go install-static
test: $(BUILD_FILES)
$(GOTEST) ./... -coverprofile c.out
.PHONY: test
doc: libgit2
$(GORUN) scripts/gen-doc.go
cd dist/doc; doctave build --release
.PHONY: doc
clean:
rm -rf bin dist c.out
.PHONY: clean