makefile: add variable with command list

This commit is contained in:
Simon Ser 2023-03-15 18:36:04 +01:00
parent c183d938ff
commit 2ce370d627

View File

@ -14,9 +14,10 @@ admin_socket_path := $(RUNDIR)/soju/admin
goflags := $(GOFLAGS) -ldflags=" \ goflags := $(GOFLAGS) -ldflags=" \
-X 'git.sr.ht/~emersion/soju/config.DefaultPath=$(config_path)' \ -X 'git.sr.ht/~emersion/soju/config.DefaultPath=$(config_path)' \
-X 'git.sr.ht/~emersion/soju/config.DefaultUnixAdminPath=$(admin_socket_path)'" -X 'git.sr.ht/~emersion/soju/config.DefaultUnixAdminPath=$(admin_socket_path)'"
commands := soju sojuctl sojudb
man_pages := doc/soju.1 doc/sojuctl.1 man_pages := doc/soju.1 doc/sojuctl.1
all: soju sojudb sojuctl $(man_pages) all: $(commands) $(man_pages)
soju: soju:
$(GO) build $(goflags) -o . ./cmd/soju ./cmd/sojudb ./cmd/sojuctl $(GO) build $(goflags) -o . ./cmd/soju ./cmd/sojudb ./cmd/sojuctl
@ -27,13 +28,13 @@ doc/sojuctl.1: doc/sojuctl.1.scd
$(SCDOC) <doc/sojuctl.1.scd >doc/sojuctl.1 $(SCDOC) <doc/sojuctl.1.scd >doc/sojuctl.1
clean: clean:
$(RM) -f soju sojudb sojuctl doc/soju.1 $(RM) -f $(commands) doc/soju.1
install: install:
mkdir -p $(DESTDIR)$(PREFIX)/$(BINDIR) mkdir -p $(DESTDIR)$(PREFIX)/$(BINDIR)
mkdir -p $(DESTDIR)$(PREFIX)/$(MANDIR)/man1 mkdir -p $(DESTDIR)$(PREFIX)/$(MANDIR)/man1
mkdir -p $(DESTDIR)$(SYSCONFDIR)/soju mkdir -p $(DESTDIR)$(SYSCONFDIR)/soju
mkdir -p $(DESTDIR)$(sharedstatedir)/soju mkdir -p $(DESTDIR)$(sharedstatedir)/soju
cp -f soju sojudb sojuctl $(DESTDIR)$(PREFIX)/$(BINDIR) cp -f $(commands) $(DESTDIR)$(PREFIX)/$(BINDIR)
cp -f $(man_pages) $(DESTDIR)$(PREFIX)/$(MANDIR)/man1 cp -f $(man_pages) $(DESTDIR)$(PREFIX)/$(MANDIR)/man1
[ -f $(DESTDIR)$(config_path) ] || cp -f config.in $(DESTDIR)$(config_path) [ -f $(DESTDIR)$(config_path) ] || cp -f config.in $(DESTDIR)$(config_path)