BUILD: makefile: remove the special case of the SSL option

By creating USE_SSL and enabling it when USE_OPENSSL is set, we can
get rid of the special case that was made with it regarding cflags
collect and when resetting options. The option doesn't need to be
manually set, though in the future it might prove useful if other
non-openssl API are supported.
This commit is contained in:
Willy Tarreau 2022-12-23 15:01:54 +01:00
parent 2b8d0978f3
commit 6a2cd33509
2 changed files with 4 additions and 3 deletions

View File

@ -298,7 +298,7 @@ use_opts = USE_EPOLL USE_KQUEUE USE_NETFILTER \
USE_THREAD USE_PTHREAD_EMULATION USE_BACKTRACE \
USE_STATIC_PCRE USE_STATIC_PCRE2 USE_TPROXY USE_LINUX_TPROXY \
USE_LINUX_SPLICE USE_LIBCRYPT USE_CRYPT_H USE_ENGINE \
USE_GETADDRINFO USE_OPENSSL USE_OPENSSL_WOLFSSL USE_LUA \
USE_GETADDRINFO USE_OPENSSL USE_OPENSSL_WOLFSSL USE_SSL USE_LUA \
USE_ACCEPT4 USE_CLOSEFROM USE_ZLIB USE_SLZ USE_CPU_AFFINITY \
USE_TFO USE_NS USE_DL USE_RT USE_LIBATOMIC USE_MATH \
USE_DEVICEATLAS USE_51DEGREES \
@ -578,6 +578,7 @@ ifneq ($(USE_OPENSSL),)
SSL_CFLAGS := $(if $(SSL_INC),-I$(SSL_INC))
SSL_LDFLAGS := $(if $(SSL_LIB),-L$(SSL_LIB)) -lssl -lcrypto
endif
USE_SSL := $(if $(USE_SSL),$(USE_SSL),implicit)
OPTIONS_OBJS += src/ssl_sock.o src/ssl_ckch.o src/ssl_sample.o src/ssl_crtlist.o src/cfgparse-ssl.o src/ssl_utils.o src/jwt.o src/ssl_ocsp.o
endif

View File

@ -36,7 +36,7 @@ disabled_opts = $(foreach opt,$(patsubst USE_%,%,$(use_opts)),$(if $(USE_$(opt
reset_opt_vars = $(foreach name,INC LIB CFLAGS LDFLAGS SRC,$(eval $(1)_$(name)=))
# preset all variables for all supported build options among use_opts
reset_opts_vars = $(foreach opt,$(patsubst USE_%,%,$(use_opts)) SSL,$(call reset_opt_vars,$(opt)))
reset_opts_vars = $(foreach opt,$(patsubst USE_%,%,$(use_opts)),$(call reset_opt_vars,$(opt)))
# append $(1)_{C,LD}FLAGS into OPTIONS_{C,LD}FLAGS if not empty
define collect_opt_flags =
@ -49,4 +49,4 @@ define collect_opt_flags =
endef
# collect all known USE_foo's foo_{C,LD}FLAGS into OPTIONS_{C,LD}FLAGS
collect_opts_flags = $(foreach opt,$(patsubst USE_%,%,$(use_opts)) SSL,$(eval $(call collect_opt_flags,$(opt))))
collect_opts_flags = $(foreach opt,$(patsubst USE_%,%,$(use_opts)),$(eval $(call collect_opt_flags,$(opt))))