BUILD: makefile: work around another bug in make 3.80

GNU make 3.80 has an issue with calls to functions inside an if block,
which is just what we recently introduced to simplify the targets
declaration. The fix is easy, it simply consists in assigning the
command to a variable inside the if block and evaluating this command
after the block. This also makes the code slightly more readable so we
can keep compatibility with 3.80 for now.

No backport is needed.
This commit is contained in:
Willy Tarreau 2019-03-29 20:55:54 +01:00
parent 509a009c5d
commit 57c99ec18e
1 changed files with 18 additions and 15 deletions

View File

@ -298,44 +298,44 @@ USE_POLL = default
# generic system target has nothing specific # generic system target has nothing specific
ifeq ($(TARGET),generic) ifeq ($(TARGET),generic)
$(call default_opts,USE_POLL USE_TPROXY) set_target_defaults = $(call default_opts,USE_POLL USE_TPROXY)
endif endif
# Haiku # Haiku
ifeq ($(TARGET),haiku) ifeq ($(TARGET),haiku)
TARGET_LDFLAGS = -lnetwork TARGET_LDFLAGS = -lnetwork
$(call default_opts,USE_POLL USE_TPROXY) set_target_defaults = $(call default_opts,USE_POLL USE_TPROXY)
endif endif
# Linux 2.2 # Linux 2.2
ifeq ($(TARGET),linux22) ifeq ($(TARGET),linux22)
$(call default_opts, \ set_target_defaults = $(call default_opts, \
USE_POLL USE_TPROXY USE_LIBCRYPT USE_DL USE_RT) USE_POLL USE_TPROXY USE_LIBCRYPT USE_DL USE_RT)
endif endif
# Standard Linux 2.4 with netfilter but without epoll() # Standard Linux 2.4 with netfilter but without epoll()
ifeq ($(TARGET),linux24) ifeq ($(TARGET),linux24)
$(call default_opts, \ set_target_defaults = $(call default_opts, \
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)
endif endif
# Enhanced Linux 2.4 with netfilter and epoll() patch > 0.21 # Enhanced Linux 2.4 with netfilter and epoll() patch > 0.21
ifeq ($(TARGET),linux24e) ifeq ($(TARGET),linux24e)
$(call default_opts, \ set_target_defaults = $(call default_opts, \
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_EPOLL USE_MY_EPOLL) USE_EPOLL USE_MY_EPOLL)
endif endif
# Standard Linux 2.6 with netfilter and standard epoll() # Standard Linux 2.6 with netfilter and standard epoll()
ifeq ($(TARGET),linux26) ifeq ($(TARGET),linux26)
$(call default_opts, \ set_target_defaults = $(call default_opts, \
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_EPOLL USE_FUTEX) USE_EPOLL USE_FUTEX)
endif endif
# Standard Linux >= 2.6.28 with netfilter, epoll, tproxy and splice # Standard Linux >= 2.6.28 with netfilter, epoll, tproxy and splice
ifeq ($(TARGET),linux2628) ifeq ($(TARGET),linux2628)
$(call default_opts, \ set_target_defaults = $(call default_opts, \
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_FUTEX USE_LINUX_TPROXY \ USE_CPU_AFFINITY USE_THREAD USE_EPOLL USE_FUTEX USE_LINUX_TPROXY \
USE_ACCEPT4 USE_LINUX_SPLICE ASSUME_SPLICE_WORKS) USE_ACCEPT4 USE_LINUX_SPLICE ASSUME_SPLICE_WORKS)
@ -344,7 +344,7 @@ endif
# Solaris 8 and above # Solaris 8 and above
ifeq ($(TARGET),solaris) ifeq ($(TARGET),solaris)
# We also enable getaddrinfo() which works since solaris 8. # We also enable getaddrinfo() which works since solaris 8.
$(call default_opts, \ set_target_defaults = $(call default_opts, \
USE_POLL USE_TPROXY USE_LIBCRYPT USE_CRYPT_H USE_GETADDRINFO USE_THREAD) USE_POLL USE_TPROXY USE_LIBCRYPT USE_CRYPT_H USE_GETADDRINFO USE_THREAD)
TARGET_CFLAGS = -fomit-frame-pointer -DFD_SETSIZE=65536 -D_REENTRANT -D_XOPEN_SOURCE=500 -D__EXTENSIONS__ TARGET_CFLAGS = -fomit-frame-pointer -DFD_SETSIZE=65536 -D_REENTRANT -D_XOPEN_SOURCE=500 -D__EXTENSIONS__
TARGET_LDFLAGS = -lnsl -lsocket TARGET_LDFLAGS = -lnsl -lsocket
@ -352,33 +352,33 @@ endif
# FreeBSD 5 and above # FreeBSD 5 and above
ifeq ($(TARGET),freebsd) ifeq ($(TARGET),freebsd)
$(call default_opts, \ set_target_defaults = $(call default_opts, \
USE_POLL USE_TPROXY USE_LIBCRYPT USE_THREAD USE_CPU_AFFINITY USE_KQUEUE \ USE_POLL USE_TPROXY USE_LIBCRYPT USE_THREAD USE_CPU_AFFINITY USE_KQUEUE \
USE_CLOSEFROM) USE_CLOSEFROM)
endif endif
# Mac OS/X # Mac OS/X
ifeq ($(TARGET),osx) ifeq ($(TARGET),osx)
$(call default_opts, \ set_target_defaults = $(call default_opts, \
USE_POLL USE_TPROXY USE_KQUEUE) USE_POLL USE_TPROXY USE_KQUEUE)
EXPORT_SYMBOL = -export_dynamic EXPORT_SYMBOL = -export_dynamic
endif endif
# OpenBSD 5.7 and above # OpenBSD 5.7 and above
ifeq ($(TARGET),openbsd) ifeq ($(TARGET),openbsd)
$(call default_opts, \ set_target_defaults = $(call default_opts, \
USE_POLL USE_TPROXY USE_THREAD USE_KQUEUE USE_ACCEPT4) USE_POLL USE_TPROXY USE_THREAD USE_KQUEUE USE_ACCEPT4)
endif endif
# NetBSD # NetBSD
ifeq ($(TARGET),netbsd) ifeq ($(TARGET),netbsd)
$(call default_opts, \ set_target_defaults = $(call default_opts, \
USE_POLL USE_TPROXY USE_KQUEUE) USE_POLL USE_TPROXY USE_KQUEUE)
endif endif
# AIX 5.1 only # AIX 5.1 only
ifeq ($(TARGET),aix51) ifeq ($(TARGET),aix51)
$(call default_opts, \ set_target_defaults = $(call default_opts, \
USE_POLL USE_LIBCRYPT) USE_POLL USE_LIBCRYPT)
TARGET_CFLAGS = -Dss_family=__ss_family TARGET_CFLAGS = -Dss_family=__ss_family
DEBUG_CFLAGS = DEBUG_CFLAGS =
@ -386,7 +386,7 @@ endif
# AIX 5.2 and above # AIX 5.2 and above
ifeq ($(TARGET),aix52) ifeq ($(TARGET),aix52)
$(call default_opts, \ set_target_defaults = $(call default_opts, \
USE_POLL USE_LIBCRYPT) USE_POLL USE_LIBCRYPT)
TARGET_CFLAGS = -D_MSGQSUPPORT TARGET_CFLAGS = -D_MSGQSUPPORT
DEBUG_CFLAGS = DEBUG_CFLAGS =
@ -394,11 +394,14 @@ endif
# Cygwin # Cygwin
ifeq ($(TARGET),cygwin) ifeq ($(TARGET),cygwin)
$(call default_opts,USE_POLL USE_TPROXY) set_target_defaults = $(call default_opts,USE_POLL USE_TPROXY)
# Cygwin adds IPv6 support only in version 1.7 (in beta right now). # Cygwin adds IPv6 support only in version 1.7 (in beta right now).
TARGET_CFLAGS = $(if $(filter 1.5.%, $(shell uname -r)), -DUSE_IPV6 -DAF_INET6=23 -DINET6_ADDRSTRLEN=46, ) TARGET_CFLAGS = $(if $(filter 1.5.%, $(shell uname -r)), -DUSE_IPV6 -DAF_INET6=23 -DINET6_ADDRSTRLEN=46, )
endif endif
# set the default settings according to the target above
$(set_target_defaults)
#### Determine version, sub-version and release date. #### Determine version, sub-version and release date.
# If GIT is found, and IGNOREGIT is not set, VERSION, SUBVERS and VERDATE are # If GIT is found, and IGNOREGIT is not set, VERSION, SUBVERS and VERDATE are
# extracted from the last commit. Otherwise, use the contents of the files # extracted from the last commit. Otherwise, use the contents of the files