2022-02-08 15:10:19 +00:00
|
|
|
GO ?= go
|
|
|
|
RM ?= rm
|
|
|
|
SCDOC ?= scdoc
|
|
|
|
GOFLAGS ?=
|
|
|
|
PREFIX ?= /usr/local
|
|
|
|
BINDIR ?= bin
|
|
|
|
MANDIR ?= share/man
|
2023-02-06 14:19:08 +00:00
|
|
|
SYSCONFDIR ?= /etc
|
2023-02-06 14:23:14 +00:00
|
|
|
RUNDIR ?= /run
|
2023-02-06 12:16:55 +00:00
|
|
|
|
2023-02-06 14:19:08 +00:00
|
|
|
sharedstatedir := /var/lib
|
2023-02-06 14:23:54 +00:00
|
|
|
config_path := $(SYSCONFDIR)/soju/config
|
2023-02-06 14:23:14 +00:00
|
|
|
admin_socket_path := $(RUNDIR)/soju/admin
|
|
|
|
goflags := $(GOFLAGS) -ldflags=" \
|
|
|
|
-X 'git.sr.ht/~emersion/soju/config.DefaultPath=$(config_path)' \
|
2023-03-15 16:46:52 +00:00
|
|
|
-X 'git.sr.ht/~emersion/soju/config.DefaultUnixAdminPath=$(admin_socket_path)'"
|
2023-03-15 17:36:04 +00:00
|
|
|
commands := soju sojuctl sojudb
|
2023-03-15 17:34:50 +00:00
|
|
|
man_pages := doc/soju.1 doc/sojuctl.1
|
2020-03-19 14:11:43 +00:00
|
|
|
|
2023-03-15 17:36:04 +00:00
|
|
|
all: $(commands) $(man_pages)
|
2020-03-19 14:11:43 +00:00
|
|
|
|
|
|
|
soju:
|
2023-02-11 22:28:29 +00:00
|
|
|
$(GO) build $(goflags) -o . ./cmd/soju ./cmd/sojudb ./cmd/sojuctl
|
2023-02-06 14:26:10 +00:00
|
|
|
sojudb sojuctl: soju
|
2020-03-27 18:23:41 +00:00
|
|
|
doc/soju.1: doc/soju.1.scd
|
|
|
|
$(SCDOC) <doc/soju.1.scd >doc/soju.1
|
2023-03-15 17:34:50 +00:00
|
|
|
doc/sojuctl.1: doc/sojuctl.1.scd
|
|
|
|
$(SCDOC) <doc/sojuctl.1.scd >doc/sojuctl.1
|
2020-03-19 14:11:43 +00:00
|
|
|
|
|
|
|
clean:
|
2023-10-21 16:21:06 +00:00
|
|
|
$(RM) -f $(commands) $(man_pages)
|
2021-05-25 12:55:21 +00:00
|
|
|
install:
|
2020-03-19 14:11:43 +00:00
|
|
|
mkdir -p $(DESTDIR)$(PREFIX)/$(BINDIR)
|
|
|
|
mkdir -p $(DESTDIR)$(PREFIX)/$(MANDIR)/man1
|
2023-02-06 14:19:08 +00:00
|
|
|
mkdir -p $(DESTDIR)$(SYSCONFDIR)/soju
|
|
|
|
mkdir -p $(DESTDIR)$(sharedstatedir)/soju
|
2023-03-15 17:36:04 +00:00
|
|
|
cp -f $(commands) $(DESTDIR)$(PREFIX)/$(BINDIR)
|
2023-03-15 17:34:50 +00:00
|
|
|
cp -f $(man_pages) $(DESTDIR)$(PREFIX)/$(MANDIR)/man1
|
2023-02-06 14:23:54 +00:00
|
|
|
[ -f $(DESTDIR)$(config_path) ] || cp -f config.in $(DESTDIR)$(config_path)
|
2021-04-27 15:51:46 +00:00
|
|
|
|
2023-01-20 14:56:04 +00:00
|
|
|
.PHONY: soju sojudb sojuctl clean install
|