From: Willy Tarreau Date: Wed, 21 Dec 2022 15:20:41 +0000 (+0100) Subject: BUILD: makefile: support LUA_CFLAGS and LUA_LDFLAGS X-Git-Tag: v2.8-dev1~37 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=b2ef365de2d9382af876bbe6cfa26df7dac03649;p=thirdparty%2Fhaproxy.git BUILD: makefile: support LUA_CFLAGS and LUA_LDFLAGS The CFLAGS and LDFLAGS appended by USE_LUA can now be overridden using LUA_CFLAGS and LUA_LDFLAGS. Note that if these flags are forced, they have to contain the optional -DHLUA_PREPEND_PATH= since this is added to CFLAGS. --- diff --git a/Makefile b/Makefile index 34f15ee7c7..20dd0405a2 100644 --- a/Makefile +++ b/Makefile @@ -601,10 +601,8 @@ endif ifneq ($(USE_LUA),) check_lua_inc = $(shell if [ -d $(2)$(1) ]; then echo $(2)$(1); fi;) LUA_INC := $(firstword $(foreach lib,lua5.4 lua54 lua5.3 lua53 lua,$(call check_lua_inc,$(lib),"/usr/include/"))) - OPTIONS_CFLAGS += $(if $(LUA_INC),-I$(LUA_INC)) check_lua_lib = $(shell echo "int main(){}" | $(CC) -o /dev/null -x c - $(2) -l$(1) 2>/dev/null && echo $(1)) - LUA_LIB = LUA_LD_FLAGS := -Wl,$(if $(EXPORT_SYMBOL),$(EXPORT_SYMBOL),--export-dynamic) $(if $(LUA_LIB),-L$(LUA_LIB)) # Try to automatically detect the Lua library if not set @@ -618,17 +616,18 @@ ifneq ($(USE_LUA),) endif ifneq ($(HLUA_PREPEND_PATH),) - OPTIONS_CFLAGS += -DHLUA_PREPEND_PATH=$(HLUA_PREPEND_PATH) + LUA_CFLAGS += -DHLUA_PREPEND_PATH=$(HLUA_PREPEND_PATH) BUILD_OPTIONS += HLUA_PREPEND_PATH=$(HLUA_PREPEND_PATH) endif # HLUA_PREPEND_PATH ifneq ($(HLUA_PREPEND_CPATH),) - OPTIONS_CFLAGS += -DHLUA_PREPEND_CPATH=$(HLUA_PREPEND_CPATH) + LUA_CFLAGS += -DHLUA_PREPEND_CPATH=$(HLUA_PREPEND_CPATH) BUILD_OPTIONS += HLUA_PREPEND_CPATH=$(HLUA_PREPEND_CPATH) endif # HLUA_PREPEND_CPATH USE_MATH = implicit - OPTIONS_LDFLAGS += $(LUA_LD_FLAGS) -l$(LUA_LIB_NAME) + LUA_CFLAGS += $(if $(LUA_INC),-I$(LUA_INC)) + LUA_LDFLAGS = $(LUA_LD_FLAGS) -l$(LUA_LIB_NAME) OPTIONS_OBJS += src/hlua.o src/hlua_fcn.o endif # USE_LUA