291f0f20b5
The Lua modules were split between tabs and spaces because nothing pinned a style; .editorconfig is what lua-language-server reads on save, so the editor and the tree now agree. clang-format already had a config and left native/ unchanged. Embedded modules regenerate from the reformatted ui.lua.
62 lines
2.4 KiB
Makefile
62 lines
2.4 KiB
Makefile
LUA ?= lua
|
|
PYTHON ?= python3
|
|
CC ?= cc
|
|
CXX ?= c++
|
|
AR ?= ar
|
|
|
|
CONTRACTS := $(sort $(wildcard lua/api/core/*.lua lua/api/features/*.lua))
|
|
LUA_C := $(sort $(wildcard native/src/vendor/lua/*.c))
|
|
LUA_OBJECTS := $(patsubst native/src/vendor/lua/%.c,_build/lua/%.o,$(LUA_C))
|
|
LUA_LIBRARY := _build/liblua.a
|
|
LUA_SMOKE := _build/lua-smoke
|
|
RUNTIME_TEST := _build/runtime-test
|
|
LUAC32 := _build/luac32
|
|
RUNTIME_CPP := $(sort $(wildcard native/src/runtime/*.cpp native/src/bindings/core/*.cpp \
|
|
native/src/bindings/features/*.cpp) native/src/embedded_modules.cpp)
|
|
|
|
.PHONY: api test embed compiledb format
|
|
|
|
# Vendored Lua and the generated module blob are skipped via .clang-format-ignore.
|
|
format:
|
|
@clang-format -i $(shell find native -name '*.cpp' -o -name '*.h')
|
|
|
|
embed: $(LUAC32)
|
|
@$(PYTHON) tools/embed.py $(LUAC32) lua/lib native/src/embedded_modules.cpp
|
|
|
|
api:
|
|
@$(PYTHON) tools/gen_api.py
|
|
|
|
compiledb:
|
|
@bear -- $(MAKE) -B $(RUNTIME_TEST) $(LUA_SMOKE) $(LUAC32)
|
|
|
|
test: $(LUA_SMOKE) $(RUNTIME_TEST) $(LUAC32)
|
|
@printf '%-32s ' tools/test_gen_api.py; $(PYTHON) tools/test_gen_api.py
|
|
@$(PYTHON) tools/gen_api.py --check
|
|
@printf '%-32s ' generated-api; echo ok
|
|
@$(PYTHON) tools/embed.py $(LUAC32) lua/lib native/src/embedded_modules.cpp --check
|
|
@printf '%-32s ' embedded-modules; echo ok
|
|
@$(LUA) -e 'assert(_VERSION == "Lua 5.4", "tests require Lua 5.4")'
|
|
@for file in $(CONTRACTS); do $(LUA) -e "assert(loadfile('$$file'))" || exit 1; done
|
|
@printf '%-32s ' contracts; echo ok
|
|
@printf '%-32s ' lua/test/ui.lua; $(LUA) lua/test/ui.lua
|
|
@printf '%-32s ' lua/test/hints.lua; $(LUA) lua/test/hints.lua
|
|
@printf '%-32s ' native/test/lua_smoke.c; $(LUA_SMOKE) && echo ok
|
|
@printf '%-32s ' native/test/runtime_test.cpp; $(RUNTIME_TEST) && echo ok
|
|
|
|
$(LUA_SMOKE): native/test/lua_smoke.c $(LUA_LIBRARY)
|
|
@$(CC) -std=c99 -DLUA_32BITS -I native/src/vendor/lua $< $(LUA_LIBRARY) -lm -ldl -o $@
|
|
|
|
$(RUNTIME_TEST): $(RUNTIME_CPP) native/test/runtime_test.cpp $(LUA_LIBRARY)
|
|
@$(CXX) -std=c++11 -Wall -Wextra -DLUA_32BITS -I native/include -I native/src/vendor/lua \
|
|
$(RUNTIME_CPP) native/test/runtime_test.cpp $(LUA_LIBRARY) -lm -ldl -o $@
|
|
|
|
$(LUA_LIBRARY): $(LUA_OBJECTS)
|
|
@$(AR) rcs $@ $^
|
|
|
|
$(LUAC32): tools/dump.c $(LUA_LIBRARY)
|
|
@$(CC) -std=c99 -DLUA_32BITS -I native/src/vendor/lua $< $(LUA_LIBRARY) -lm -o $@
|
|
|
|
_build/lua/%.o: native/src/vendor/lua/%.c
|
|
@mkdir -p $(@D)
|
|
@$(CC) -std=c99 -DLUA_32BITS -I native/src/vendor/lua -c $< -o $@
|