mirror of
https://git.sr.ht/~adnano/kiln
synced 2024-11-08 14:19:20 +01:00
47 lines
803 B
Makefile
47 lines
803 B
Makefile
.POSIX:
|
|
.SUFFIXES:
|
|
.SUFFIXES: .1.scd .1
|
|
|
|
_git_version=$(shell git describe --tags --dirty 2>/dev/null)
|
|
ifeq ($(strip $(_git_version)),)
|
|
VERSION=0.1.0
|
|
else
|
|
VERSION=$(_git_version)
|
|
endif
|
|
|
|
PREFIX?=/usr/local
|
|
BINDIR?=$(PREFIX)/bin
|
|
MANDIR?=$(PREFIX)/share/man
|
|
|
|
GO?=go
|
|
GOFLAGS?=
|
|
GOSRC!=find . -name '*.go'
|
|
GOSRC+=go.mod go.sum
|
|
|
|
all: kiln docs
|
|
|
|
docs: docs/kiln.1
|
|
|
|
.1.scd.1:
|
|
scdoc < $< > $@
|
|
|
|
kiln: $(GOSRC)
|
|
$(GO) build $(GOFLAGS) \
|
|
-ldflags "-X main.Version=$(VERSION)" \
|
|
-o $@
|
|
|
|
clean:
|
|
$(RM) kiln
|
|
$(RM) docs/kiln.1
|
|
|
|
install: all
|
|
mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
|
|
install -m755 kiln $(DESTDIR)$(BINDIR)/kiln
|
|
install -m755 docs/kiln.1 $(MANDIR)/man1/kiln.1
|
|
|
|
uninstall:
|
|
$(RM) $(DESTDIR)$(BINDIR)/kiln
|
|
$(RM) $(DESTDIR)$(MANDIR)/man1/kiln.1
|
|
|
|
.PHONY: all docs clean install uninstall
|