soju/Makefile

42 lines
1.2 KiB
Makefile
Raw Permalink Normal View History

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