2020-09-12 17:31:23 -04:00
|
|
|
GITV != git describe --tags
|
|
|
|
GITC != git rev-parse --verify HEAD
|
2020-09-18 14:00:50 -04:00
|
|
|
SRC != find . -type f -name '*.go' ! -name '*_test.go'
|
|
|
|
TEST != find . -type f -name '*_test.go'
|
2020-09-02 13:51:48 -04:00
|
|
|
|
2020-09-12 17:31:23 -04:00
|
|
|
PREFIX ?= /usr/local
|
|
|
|
VERSION ?= $(GITV)
|
|
|
|
COMMIT ?= $(GITC)
|
|
|
|
BUILDER ?= Makefile
|
2020-09-02 13:51:48 -04:00
|
|
|
|
2020-09-12 17:31:23 -04:00
|
|
|
GO := go
|
|
|
|
INSTALL := install
|
|
|
|
RM := rm
|
2020-09-02 11:05:14 -04:00
|
|
|
|
2020-09-12 17:31:23 -04:00
|
|
|
amfora: go.mod go.sum $(SRC)
|
2020-09-12 19:35:12 -04: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 11:05:14 -04:00
|
|
|
|
2020-09-12 17:31:23 -04:00
|
|
|
.PHONY: clean
|
2020-09-02 11:05:14 -04:00
|
|
|
clean:
|
2020-09-12 17:31:23 -04:00
|
|
|
$(RM) -f amfora
|
|
|
|
|
|
|
|
.PHONY: install
|
|
|
|
install: amfora amfora.desktop
|
2021-12-08 09:52:39 -05:00
|
|
|
$(INSTALL) -d $(DESTDIR)$(PREFIX)/bin/
|
|
|
|
$(INSTALL) -m 755 amfora $(DESTDIR)$(PREFIX)/bin/amfora
|
|
|
|
$(INSTALL) -d $(DESTDIR)$(PREFIX)/share/applications/
|
|
|
|
$(INSTALL) -m 644 amfora.desktop $(DESTDIR)$(PREFIX)/share/applications/amfora.desktop
|
2020-09-02 11:05:14 -04:00
|
|
|
|
2020-09-12 17:31:23 -04:00
|
|
|
.PHONY: uninstall
|
2020-09-02 11:05:14 -04:00
|
|
|
uninstall:
|
2021-12-08 09:52:39 -05:00
|
|
|
$(RM) -f $(DESTDIR)$(PREFIX)/bin/amfora
|
|
|
|
$(RM) -f $(DESTDIR)$(PREFIX)/share/applications/amfora.desktop
|
2020-09-02 11:05:14 -04:00
|
|
|
|
2020-09-12 17:31:23 -04:00
|
|
|
# Development helpers
|
2021-04-13 16:45:44 -04:00
|
|
|
|
2020-09-12 17:31:23 -04:00
|
|
|
.PHONY: fmt
|
2020-09-02 11:05:14 -04:00
|
|
|
fmt:
|
2021-03-13 11:44:04 -05:00
|
|
|
$(GO) fmt ./...
|
2021-04-13 16:45:44 -04:00
|
|
|
|
|
|
|
.PHONY: gen
|
|
|
|
gen:
|
|
|
|
$(GO) generate ./...
|