soju/Makefile

35 lines
860 B
Makefile
Raw Normal View History

GO ?= go
RM ?= rm
SCDOC ?= scdoc
GOFLAGS ?=
PREFIX ?= /usr/local
BINDIR ?= bin
MANDIR ?= share/man
2023-02-06 07:16:55 -05:00
SYSCONFDIR ?= etc
config_path := $(DESTDIR)/$(SYSCONFDIR)/soju/config
goflags := $(GOFLAGS) \
-ldflags="-X 'git.sr.ht/~emersion/soju/config.DefaultPath=$(config_path)'"
2020-03-19 10:11:43 -04:00
2020-03-27 14:23:41 -04:00
all: soju sojuctl doc/soju.1
2020-03-19 10:11:43 -04:00
soju:
2023-02-06 07:16:55 -05:00
$(GO) build $(goflags) ./cmd/soju
2020-03-19 10:11:43 -04:00
sojuctl:
2023-02-06 07:16:55 -05:00
$(GO) build $(goflags) ./cmd/sojuctl
2020-03-27 14:23:41 -04:00
doc/soju.1: doc/soju.1.scd
$(SCDOC) <doc/soju.1.scd >doc/soju.1
2020-03-19 10:11:43 -04:00
clean:
$(RM) -f soju sojuctl doc/soju.1
install:
2020-03-19 10:11:43 -04:00
mkdir -p $(DESTDIR)$(PREFIX)/$(BINDIR)
mkdir -p $(DESTDIR)$(PREFIX)/$(MANDIR)/man1
2023-02-06 07:16:55 -05:00
mkdir -p $(DESTDIR)/$(SYSCONFDIR)/soju
2021-04-21 10:39:51 -04:00
mkdir -p $(DESTDIR)/var/lib/soju
2020-03-19 10:11:43 -04:00
cp -f soju sojuctl $(DESTDIR)$(PREFIX)/$(BINDIR)
2020-03-27 14:23:41 -04:00
cp -f doc/soju.1 $(DESTDIR)$(PREFIX)/$(MANDIR)/man1
2023-02-06 07:16:55 -05:00
[ -f $(config_path) ] || cp -f config.in $(config_path)
.PHONY: soju sojuctl clean install