BUILD: makefile: Fix install(1) handling for OpenBSD/NetBSD/Solaris/AIX

Add a new INSTALL variable to allow overridiing the flags passed to
install(1). install(1) on OpenBSD/NetBSD/Solaris/AIX does not support
the -v flag. With the new INSTALL variable and handling only use the
-v flag with the Linux targets.
This commit is contained in:
Brad Smith 2022-07-16 05:18:50 -04:00 committed by Willy Tarreau
parent 2200a9caef
commit bc50e0d0fb
1 changed files with 13 additions and 6 deletions

View File

@ -81,6 +81,9 @@
# DESTDIR is not set by default and is used for installation only. # DESTDIR is not set by default and is used for installation only.
# It might be useful to set DESTDIR if you want to install haproxy # It might be useful to set DESTDIR if you want to install haproxy
# in a sandbox. # in a sandbox.
# INSTALL is set to "install" by default and is used to provide the name of
# the install binary used by the install targets and any additional
# flags.
# PREFIX is set to "/usr/local" by default and is used for installation only. # PREFIX is set to "/usr/local" by default and is used for installation only.
# SBINDIR is set to "$(PREFIX)/sbin" by default and is used for installation # SBINDIR is set to "$(PREFIX)/sbin" by default and is used for installation
# only. # only.
@ -170,6 +173,7 @@ cc-nowarn = $(if $(cc-anywno),-Wno-$(1),$(shell set -e; if $(CC) -Werror -W$(1)
#### Installation options. #### Installation options.
DESTDIR = DESTDIR =
INSTALL = install
PREFIX = /usr/local PREFIX = /usr/local
SBINDIR = $(PREFIX)/sbin SBINDIR = $(PREFIX)/sbin
MANDIR = $(PREFIX)/share/man MANDIR = $(PREFIX)/share/man
@ -378,6 +382,7 @@ ifeq ($(TARGET),linux-glibc)
USE_CPU_AFFINITY USE_THREAD USE_EPOLL USE_LINUX_TPROXY \ USE_CPU_AFFINITY USE_THREAD USE_EPOLL USE_LINUX_TPROXY \
USE_ACCEPT4 USE_LINUX_SPLICE USE_PRCTL USE_THREAD_DUMP USE_NS USE_TFO \ USE_ACCEPT4 USE_LINUX_SPLICE USE_PRCTL USE_THREAD_DUMP USE_NS USE_TFO \
USE_GETADDRINFO USE_BACKTRACE) USE_GETADDRINFO USE_BACKTRACE)
INSTALL = install -v
endif endif
# For linux >= 2.6.28, glibc without new features # For linux >= 2.6.28, glibc without new features
@ -386,6 +391,7 @@ ifeq ($(TARGET),linux-glibc-legacy)
USE_POLL USE_TPROXY USE_LIBCRYPT USE_DL USE_RT USE_CRYPT_H USE_NETFILTER \ USE_POLL USE_TPROXY USE_LIBCRYPT USE_DL USE_RT USE_CRYPT_H USE_NETFILTER \
USE_CPU_AFFINITY USE_THREAD USE_EPOLL USE_LINUX_TPROXY \ USE_CPU_AFFINITY USE_THREAD USE_EPOLL USE_LINUX_TPROXY \
USE_ACCEPT4 USE_LINUX_SPLICE USE_PRCTL USE_THREAD_DUMP USE_GETADDRINFO) USE_ACCEPT4 USE_LINUX_SPLICE USE_PRCTL USE_THREAD_DUMP USE_GETADDRINFO)
INSTALL = install -v
endif endif
# For linux >= 2.6.28 and musl # For linux >= 2.6.28 and musl
@ -395,6 +401,7 @@ ifeq ($(TARGET),linux-musl)
USE_CPU_AFFINITY USE_THREAD USE_EPOLL USE_LINUX_TPROXY \ USE_CPU_AFFINITY USE_THREAD USE_EPOLL USE_LINUX_TPROXY \
USE_ACCEPT4 USE_LINUX_SPLICE USE_PRCTL USE_THREAD_DUMP USE_NS USE_TFO \ USE_ACCEPT4 USE_LINUX_SPLICE USE_PRCTL USE_THREAD_DUMP USE_NS USE_TFO \
USE_GETADDRINFO) USE_GETADDRINFO)
INSTALL = install -v
endif endif
# Solaris 10 and above # Solaris 10 and above
@ -1043,16 +1050,16 @@ src/haproxy.o: src/haproxy.c $(DEP)
-c -o $@ $< -c -o $@ $<
install-man: install-man:
$(Q)install -v -d "$(DESTDIR)$(MANDIR)"/man1 $(Q)$(INSTALL) -d "$(DESTDIR)$(MANDIR)"/man1
$(Q)install -v -m 644 doc/haproxy.1 "$(DESTDIR)$(MANDIR)"/man1 $(Q)$(INSTALL) -m 644 doc/haproxy.1 "$(DESTDIR)$(MANDIR)"/man1
EXCLUDE_DOCUMENTATION = lgpl gpl coding-style EXCLUDE_DOCUMENTATION = lgpl gpl coding-style
DOCUMENTATION = $(filter-out $(EXCLUDE_DOCUMENTATION),$(patsubst doc/%.txt,%,$(wildcard doc/*.txt))) DOCUMENTATION = $(filter-out $(EXCLUDE_DOCUMENTATION),$(patsubst doc/%.txt,%,$(wildcard doc/*.txt)))
install-doc: install-doc:
$(Q)install -v -d "$(DESTDIR)$(DOCDIR)" $(Q)$(INSTALL) -d "$(DESTDIR)$(DOCDIR)"
$(Q)for x in $(DOCUMENTATION); do \ $(Q)for x in $(DOCUMENTATION); do \
install -v -m 644 doc/$$x.txt "$(DESTDIR)$(DOCDIR)" ; \ $(INSTALL) -m 644 doc/$$x.txt "$(DESTDIR)$(DOCDIR)" ; \
done done
install-bin: install-bin:
@ -1062,8 +1069,8 @@ install-bin:
exit 1; \ exit 1; \
fi; \ fi; \
done done
$(Q)install -v -d "$(DESTDIR)$(SBINDIR)" $(Q)$(INSTALL) -d "$(DESTDIR)$(SBINDIR)"
$(Q)install -v haproxy $(EXTRA) "$(DESTDIR)$(SBINDIR)" $(Q)$(INSTALL) haproxy $(EXTRA) "$(DESTDIR)$(SBINDIR)"
install: install-bin install-man install-doc install: install-bin install-man install-doc