leslie-tsang commented on a change in pull request #5248:
URL: https://github.com/apache/apisix/pull/5248#discussion_r733266710



##########
File path: Makefile
##########
@@ -147,24 +148,20 @@ help:
 ### deps : Installation dependencies
 .PHONY: deps
 deps: runtime
-ifeq ($(LUAROCKS_VER),luarocks 3.)
-       mkdir -p ~/.luarocks
-ifeq ($(shell whoami),root)
-       $(LUAROCKS) config variables.OPENSSL_LIBDIR $(addprefix 
$(OPENSSL_PREFIX), /lib)
-       $(LUAROCKS) config variables.OPENSSL_INCDIR $(addprefix 
$(OPENSSL_PREFIX), /include)
-else
-       $(LUAROCKS) config --local variables.OPENSSL_LIBDIR $(addprefix 
$(OPENSSL_PREFIX), /lib)
-       $(LUAROCKS) config --local variables.OPENSSL_INCDIR $(addprefix 
$(OPENSSL_PREFIX), /include)
-endif
-       $(LUAROCKS) install rockspec/apisix-master-0.rockspec --tree=deps 
--only-deps --local $(LUAROCKS_SERVER_OPT)
-else
-       @echo "WARN: You're not using LuaRocks 3.x, please add the following 
items to your LuaRocks config file:"
-       @echo "variables = {"
-       @echo "    OPENSSL_LIBDIR=$(addprefix $(OPENSSL_PREFIX), /lib)"
-       @echo "    OPENSSL_INCDIR=$(addprefix $(OPENSSL_PREFIX), /include)"
-       @echo "}"
-       $(LUAROCKS) install rockspec/apisix-master-0.rockspec --tree=deps 
--only-deps --local $(LUAROCKS_SERVER_OPT)
-endif
+       $(eval ENV_LUAROCKS_VER := $(shell $(ENV_LUAROCKS) --version | grep -E 
-o "luarocks [0-9]+."))
+       @if [ '$(ENV_LUAROCKS_VER)' = 'luarocks 3.' ]; then \
+               mkdir -p ~/.luarocks; \
+               $(ENV_LUAROCKS) config $(ENV_LUAROCKS_FLAG_LOCAL) 
variables.OPENSSL_LIBDIR $(addprefix $(ENV_OPENSSL_PREFIX), /lib); \
+               $(ENV_LUAROCKS) config $(ENV_LUAROCKS_FLAG_LOCAL) 
variables.OPENSSL_INCDIR $(addprefix $(ENV_OPENSSL_PREFIX), /include); \
+               $(ENV_LUAROCKS) install rockspec/apisix-master-0.rockspec 
--tree=deps --only-deps --local $(ENV_LUAROCKS_SERVER_OPT); \
+       else \
+               echo "WARN: You're not using LuaRocks 3.x, please add the 
following items to your LuaRocks config file:"; \

Review comment:
       Ref to [GNU Make 
manual](https://www.gnu.org/software/make/manual/html_node/Syntax-of-Functions.html#Syntax-of-Functions#:~:text=Commas%20and%20unmatched%20parentheses).




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to