interpreters: lua: replace awk command with shell script

This commit is contained in:
Michael Mogenson 2022-03-23 09:47:29 -06:00 committed by Xiang Xiao
parent d364d7a810
commit 4043522daf

View File

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