soju/Makefile
palm93 478bd2077b build: fix binaries not being built
Without -o, when multiple packages are built, go build discards the
resulting binaries.
2023-02-11 23:28:29 +01:00

38 lines
1.0 KiB
Makefile

GO ?= go
RM ?= rm
SCDOC ?= scdoc
GOFLAGS ?=
PREFIX ?= /usr/local
BINDIR ?= bin
MANDIR ?= share/man
SYSCONFDIR ?= /etc
RUNDIR ?= /run
sharedstatedir := /var/lib
config_path := $(SYSCONFDIR)/soju/config
admin_socket_path := $(RUNDIR)/soju/admin
goflags := $(GOFLAGS) -ldflags=" \
-X 'git.sr.ht/~emersion/soju/config.DefaultPath=$(config_path)' \
-X 'git.sr.ht/~emersion/soju.DefaultUnixAdminPath=$(admin_socket_path)'"
all: soju sojudb sojuctl doc/soju.1
soju:
$(GO) build $(goflags) -o . ./cmd/soju ./cmd/sojudb ./cmd/sojuctl
sojudb sojuctl: soju
doc/soju.1: doc/soju.1.scd
$(SCDOC) <doc/soju.1.scd >doc/soju.1
clean:
$(RM) -f soju sojudb sojuctl doc/soju.1
install:
mkdir -p $(DESTDIR)$(PREFIX)/$(BINDIR)
mkdir -p $(DESTDIR)$(PREFIX)/$(MANDIR)/man1
mkdir -p $(DESTDIR)$(SYSCONFDIR)/soju
mkdir -p $(DESTDIR)$(sharedstatedir)/soju
cp -f soju sojudb sojuctl $(DESTDIR)$(PREFIX)/$(BINDIR)
cp -f doc/soju.1 $(DESTDIR)$(PREFIX)/$(MANDIR)/man1
[ -f $(DESTDIR)$(config_path) ] || cp -f config.in $(DESTDIR)$(config_path)
.PHONY: soju sojudb sojuctl clean install