2020-11-02 01:51:43 +00:00
|
|
|
.POSIX:
|
|
|
|
.SUFFIXES:
|
2021-04-20 20:57:05 +00:00
|
|
|
.SUFFIXES: .1.scd .1
|
2020-11-02 01:51:43 +00:00
|
|
|
|
2021-04-20 20:44:29 +00:00
|
|
|
_git_version=$(shell git describe --tags --dirty 2>/dev/null)
|
|
|
|
ifeq ($(strip $(_git_version)),)
|
|
|
|
VERSION=0.1.0
|
|
|
|
else
|
|
|
|
VERSION=$(_git_version)
|
|
|
|
endif
|
2020-11-02 01:51:43 +00:00
|
|
|
|
|
|
|
PREFIX?=/usr/local
|
2020-11-20 17:07:38 +00:00
|
|
|
BINDIR?=$(PREFIX)/bin
|
2020-11-11 00:34:05 +00:00
|
|
|
MANDIR?=$(PREFIX)/share/man
|
2020-11-02 01:51:43 +00:00
|
|
|
|
|
|
|
GO?=go
|
|
|
|
GOFLAGS?=
|
|
|
|
GOSRC!=find . -name '*.go'
|
|
|
|
GOSRC+=go.mod go.sum
|
|
|
|
|
2021-04-20 20:57:05 +00:00
|
|
|
all: kiln docs
|
2020-11-11 00:34:05 +00:00
|
|
|
|
2021-04-20 20:57:05 +00:00
|
|
|
docs: docs/kiln.1
|
2020-11-11 00:34:05 +00:00
|
|
|
|
|
|
|
.1.scd.1:
|
|
|
|
scdoc < $< > $@
|
2020-11-02 01:51:43 +00:00
|
|
|
|
|
|
|
kiln: $(GOSRC)
|
|
|
|
$(GO) build $(GOFLAGS) \
|
2021-04-12 04:31:55 +00:00
|
|
|
-ldflags "-X main.Version=$(VERSION)" \
|
2020-11-02 01:51:43 +00:00
|
|
|
-o $@
|
|
|
|
|
|
|
|
clean:
|
2020-11-11 00:34:05 +00:00
|
|
|
$(RM) kiln
|
|
|
|
$(RM) $(DOCS)
|
2020-11-02 01:51:43 +00:00
|
|
|
|
|
|
|
install: all
|
2020-11-20 17:07:38 +00:00
|
|
|
mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
|
|
|
|
install -m755 kiln $(DESTDIR)$(BINDIR)/kiln
|
2021-04-20 20:57:05 +00:00
|
|
|
install -m755 docs/kiln.1 $(MANDIR)/man1/kiln.1
|
2020-11-02 01:51:43 +00:00
|
|
|
|
|
|
|
uninstall:
|
2020-11-20 17:07:38 +00:00
|
|
|
$(RM) $(DESTDIR)$(BINDIR)/kiln
|
2020-11-11 00:34:05 +00:00
|
|
|
$(RM) $(DESTDIR)$(MANDIR)/man1/kiln.1
|
2020-11-02 01:51:43 +00:00
|
|
|
|
2021-04-20 20:57:05 +00:00
|
|
|
.PHONY: all docs clean install uninstall
|