2020-09-13 00:31:23 +03:00
|
|
|
GITV != git describe --tags
|
|
|
|
GITC != git rev-parse --verify HEAD
|
2020-09-18 21:00:50 +03:00
|
|
|
SRC != find . -type f -name '*.go' ! -name '*_test.go'
|
|
|
|
TEST != find . -type f -name '*_test.go'
|
2020-09-02 20:51:48 +03:00
|
|
|
|
2020-09-13 00:31:23 +03:00
|
|
|
PREFIX ?= /usr/local
|
|
|
|
VERSION ?= $(GITV)
|
|
|
|
COMMIT ?= $(GITC)
|
|
|
|
BUILDER ?= Makefile
|
2020-09-02 20:51:48 +03:00
|
|
|
|
2020-09-13 00:31:23 +03:00
|
|
|
GO := go
|
|
|
|
INSTALL := install
|
|
|
|
RM := rm
|
2020-09-02 18:05:14 +03:00
|
|
|
|
2020-09-13 00:31:23 +03:00
|
|
|
amfora: go.mod go.sum $(SRC)
|
2020-09-13 02:35:12 +03:00
|
|
|
GO111MODULE=on CGO_ENABLED=0 $(GO) build -o $@ -ldflags="-s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.builtBy=$(BUILDER)"
|
2020-09-02 18:05:14 +03:00
|
|
|
|
2020-09-13 00:31:23 +03:00
|
|
|
.PHONY: clean
|
2020-09-02 18:05:14 +03:00
|
|
|
clean:
|
2020-09-13 00:31:23 +03:00
|
|
|
$(RM) -f amfora
|
|
|
|
|
|
|
|
.PHONY: install
|
|
|
|
install: amfora amfora.desktop
|
|
|
|
install -Dm 755 amfora $(PREFIX)/bin/amfora
|
|
|
|
install -Dm 644 amfora.desktop $(PREFIX)/share/applications/amfora.desktop
|
2020-09-02 18:05:14 +03:00
|
|
|
|
2020-09-13 00:31:23 +03:00
|
|
|
.PHONY: uninstall
|
2020-09-02 18:05:14 +03:00
|
|
|
uninstall:
|
2020-09-13 00:31:23 +03:00
|
|
|
$(RM) -f $(PREFIX)/bin/amfora
|
|
|
|
$(RM) -f $(PREFIX)/share/applications/amfora.desktop
|
2020-09-02 18:05:14 +03:00
|
|
|
|
2020-09-13 00:31:23 +03:00
|
|
|
# Development helpers
|
|
|
|
.PHONY: fmt
|
2020-09-02 18:05:14 +03:00
|
|
|
fmt:
|
|
|
|
go fmt ./...
|