soju/Makefile

38 lines
968 B
Makefile
Raw 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 04:16:55 -08:00
2023-02-06 06:19:08 -08:00
sharedstatedir := /var/lib
config_path := $(DESTDIR)$(SYSCONFDIR)/soju/config
2023-02-06 04:16:55 -08:00
goflags := $(GOFLAGS) \
-ldflags="-X 'git.sr.ht/~emersion/soju/config.DefaultPath=$(config_path)'"
2020-03-19 07:11:43 -07:00
all: soju sojudb sojuctl doc/soju.1
2020-03-19 07:11:43 -07:00
soju:
2023-02-06 04:16:55 -08:00
$(GO) build $(goflags) ./cmd/soju
sojudb:
$(GO) build $(goflags) ./cmd/sojudb
sojuctl:
$(GO) build $(goflags) ./cmd/sojuctl
2020-03-27 11:23:41 -07:00
doc/soju.1: doc/soju.1.scd
$(SCDOC) <doc/soju.1.scd >doc/soju.1
2020-03-19 07:11:43 -07:00
clean:
$(RM) -f soju sojudb sojuctl doc/soju.1
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 soju sojudb sojuctl $(DESTDIR)$(PREFIX)/$(BINDIR)
2020-03-27 11:23:41 -07:00
cp -f doc/soju.1 $(DESTDIR)$(PREFIX)/$(MANDIR)/man1
2023-02-06 04:16:55 -08:00
[ -f $(config_path) ] || cp -f config.in $(config_path)
.PHONY: soju sojudb sojuctl clean install