You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/03/23 16:18:36 UTC

[incubator-nuttx-apps] branch master updated: interpreters: lua: replace awk command with shell script

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 4043522  interpreters: lua: replace awk command with shell script
4043522 is described below

commit 4043522dafa120360a06df5eed99ff657a79c9d4
Author: Michael Mogenson <mi...@gmail.com>
AuthorDate: Wed Mar 23 09:47:29 2022 -0600

    interpreters: lua: replace awk command with shell script
---
 interpreters/lua/Makefile | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/interpreters/lua/Makefile b/interpreters/lua/Makefile
index 246bf58..9903a65 100644
--- a/interpreters/lua/Makefile
+++ b/interpreters/lua/Makefile
@@ -84,9 +84,11 @@ CSRCS += $(CORELIBS_SRCS)
 
 register::
 	# collect core module names from defines in lualib.h
-	$(Q) awk '{ if (match($$0,/LUA_[A-Z]+LIBNAME\s"([a-z]+)"$$/,m)) \
-		printf "{ \"%s\", luaopen_%s },\n", m[1], m[1] > "registry$(DELIM)"m[1]".bdat" }' \
-		$(LUA_SRC)$(DELIM)lualib.h
+	$(Q) while read -r line; do \
+		name=$$(expr "$$line" : '#define LUA_[[:upper:]]\+LIBNAME[[:space:]]\+"\([[:lower:]]\+\)"'); \
+		if [ ! -z $$name ]; then \
+			printf '{ "%s", luaopen_%s },\n' $$name $$name > registry$(DELIM)$$name.bdat; \
+		fi done < $(LUA_SRC)$(DELIM)lualib.h
 endif
 
 # Lua builtin module registry