Makefile: fix DESTDIR and PREFIX concatenation

Commits 77374e8 and b5f530a changed handling of the `DESTDIR` and `PREFIX`
variables, and introduced a `MANDIR` variable.

However, in those commits, the variables are concatenated with a directory
separator (`/`); `$DESTDIR/$PREFIX`. The `$PREFIX` variable (and consequently,
the `MANDIR` variable) already should have a leading `/` (absolute path), so
there should be no need to add it. In addition, adding the `/`, would not allow
either an empty path to be passed (well, it would result in `//` in the path),
or for `$PREFIX` to be used with a relative path (with an empty `$PREFIX`).

This patch removes the directory separator.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2021-06-25 14:12:56 +02:00
parent e1f28659bc
commit 2019a1e68f
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C

View File

@ -255,8 +255,8 @@ man/%: docs/man/%.md FORCE
go-md2man -in "$<" -out "$@"
define installmanpage
$(INSTALL) -d $(DESTDIR)/$(MANDIR)/man$(2);
gzip -c $(1) >$(DESTDIR)/$(MANDIR)/man$(2)/$(3).gz;
$(INSTALL) -d $(DESTDIR)$(MANDIR)/man$(2);
gzip -c $(1) >$(DESTDIR)$(MANDIR)/man$(2)/$(3).gz;
endef
install-man: man
@ -351,12 +351,12 @@ clean-test: ## clean up debris from previously failed tests
install: ## install binaries
@echo "$(WHALE) $@ $(BINARIES)"
@$(INSTALL) -d $(DESTDIR)/$(PREFIX)/bin
@$(INSTALL) $(BINARIES) $(DESTDIR)/$(PREFIX)/bin
@$(INSTALL) -d $(DESTDIR)$(PREFIX)/bin
@$(INSTALL) $(BINARIES) $(DESTDIR)$(PREFIX)/bin
uninstall:
@echo "$(WHALE) $@"
@rm -f $(addprefix $(DESTDIR)/$(PREFIX)/bin/,$(notdir $(BINARIES)))
@rm -f $(addprefix $(DESTDIR)$(PREFIX)/bin/,$(notdir $(BINARIES)))
ifeq ($(GOOS),windows)
install-deps: