mk: syntax cleanup

Avoid multiline strings. Use dlv --build-flags.

Signed-off-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
Robin Jarry 2022-01-21 20:57:42 +01:00
parent e97e0d8ab1
commit 44f81c87e4

View file

@ -10,6 +10,9 @@ SHAREDIR?=$(PREFIX)/share/aerc
MANDIR?=$(PREFIX)/share/man MANDIR?=$(PREFIX)/share/man
GO?=go GO?=go
GOFLAGS?= GOFLAGS?=
LDFLAGS:=-X main.Prefix=$(PREFIX)
LDFLAGS+=-X main.ShareDir=$(SHAREDIR)
LDFLAGS+=-X main.Version=$(VERSION)
GOSRC:=$(shell find * -name '*.go') GOSRC:=$(shell find * -name '*.go')
GOSRC+=go.mod go.sum GOSRC+=go.mod go.sum
@ -30,11 +33,7 @@ DOCS := \
all: aerc aerc.conf $(DOCS) all: aerc aerc.conf $(DOCS)
aerc: $(GOSRC) aerc: $(GOSRC)
$(GO) build $(GOFLAGS) \ $(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $@
-ldflags "-X main.Prefix=$(PREFIX) \
-X main.ShareDir=$(SHAREDIR) \
-X main.Version=$(VERSION)" \
-o $@
.PHONY: fmt .PHONY: fmt
fmt: fmt:
@ -52,8 +51,8 @@ aerc.conf: config/aerc.conf.in
sed -e 's:@SHAREDIR@:$(SHAREDIR):g' > $@ < config/aerc.conf.in sed -e 's:@SHAREDIR@:$(SHAREDIR):g' > $@ < config/aerc.conf.in
debug: $(GOSRC) debug: $(GOSRC)
GOFLAGS="-tags=notmuch" \ dlv debug --build-flags="$(GOFLAGS)" --headless \
dlv debug --headless --listen localhost:4747 &>/dev/null --listen localhost:4747 >/dev/null 2>&1
.1.scd.1: .1.scd.1:
scdoc < $< > $@ scdoc < $< > $@
@ -98,10 +97,7 @@ install: $(DOCS) aerc aerc.conf
install -m644 templates/forward_as_body $(DESTDIR)$(SHAREDIR)/templates/forward_as_body install -m644 templates/forward_as_body $(DESTDIR)$(SHAREDIR)/templates/forward_as_body
install -m644 config/default_styleset $(DESTDIR)$(SHAREDIR)/stylesets/default install -m644 config/default_styleset $(DESTDIR)$(SHAREDIR)/stylesets/default
RMDIR_IF_EMPTY:=sh -c '\ RMDIR_IF_EMPTY:=sh -c '! [ -d $$0 ] || ls -1qA $$0 | grep -q . || rmdir $$0'
if test -d $$0 && ! ls -1qA $$0 | grep -q . ; then \
rmdir $$0; \
fi'
uninstall: uninstall:
$(RM) $(DESTDIR)$(BINDIR)/aerc $(RM) $(DESTDIR)$(BINDIR)/aerc