From 2019a1e68f7488bdc0975062cbbd933b53595714 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 25 Jun 2021 14:12:56 +0200 Subject: [PATCH] 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 --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index f53c10ab7..a6e3c6323 100644 --- a/Makefile +++ b/Makefile @@ -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: