2020-11-02 02:51:43 +01:00
|
|
|
.POSIX:
|
|
|
|
.SUFFIXES:
|
2020-11-11 01:34:05 +01:00
|
|
|
.SUFFIXES: .1 .1.scd
|
2020-11-02 02:51:43 +01:00
|
|
|
|
|
|
|
VERSION=0.0.0
|
|
|
|
|
|
|
|
PREFIX?=/usr/local
|
2020-11-11 01:34:05 +01:00
|
|
|
MANDIR?=$(PREFIX)/share/man
|
2020-11-02 02:51:43 +01:00
|
|
|
|
2020-11-11 01:34:05 +01:00
|
|
|
VPATH=doc
|
2020-11-02 02:51:43 +01:00
|
|
|
GO?=go
|
|
|
|
GOFLAGS?=
|
|
|
|
GOSRC!=find . -name '*.go'
|
|
|
|
GOSRC+=go.mod go.sum
|
|
|
|
|
2020-11-11 01:34:05 +01:00
|
|
|
DOCS := \
|
|
|
|
kiln.1
|
|
|
|
|
|
|
|
all: kiln doc
|
|
|
|
|
|
|
|
doc: $(DOCS)
|
|
|
|
|
|
|
|
.1.scd.1:
|
|
|
|
scdoc < $< > $@
|
2020-11-02 02:51:43 +01:00
|
|
|
|
|
|
|
kiln: $(GOSRC)
|
|
|
|
$(GO) build $(GOFLAGS) \
|
|
|
|
-ldflags "-X main.Prefix=$(PREFIX) \
|
|
|
|
-X main.ShareDir=$(SHAREDIR) \
|
|
|
|
-X main.Version=$(VERSION)" \
|
|
|
|
-o $@
|
|
|
|
|
|
|
|
clean:
|
2020-11-11 01:34:05 +01:00
|
|
|
$(RM) kiln
|
|
|
|
$(RM) $(DOCS)
|
2020-11-02 02:51:43 +01:00
|
|
|
|
|
|
|
install: all
|
2020-11-11 01:34:05 +01:00
|
|
|
mkdir -p $(DESTDIR)$(PREFIX)/bin $(DESTDIR)$(MANDIR)/man1
|
2020-11-02 02:51:43 +01:00
|
|
|
install -m755 kiln $(DESTDIR)$(PREFIX)/bin
|
2020-11-11 01:34:05 +01:00
|
|
|
install -m755 kiln.1 $(MANDIR)/man1/kiln.1
|
2020-11-02 02:51:43 +01:00
|
|
|
|
|
|
|
uninstall:
|
|
|
|
$(RM) $(DESTDIR)$(PREFIX)/bin/kiln
|
2020-11-11 01:34:05 +01:00
|
|
|
$(RM) $(DESTDIR)$(MANDIR)/man1/kiln.1
|
2020-11-02 02:51:43 +01:00
|
|
|
|
2020-11-11 01:34:05 +01:00
|
|
|
.PHONY: all doc clean install uninstall
|