Skip to content

Commit

Permalink
Rename C output file to bypass implicit Makefile build rule. Fixes #23.
Browse files Browse the repository at this point in the history
  • Loading branch information
ers35 committed May 23, 2020
1 parent fe34c35 commit bdaf8b8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*.lua.c
*.luastatic.c
*.o
*.a
lua
Expand Down
13 changes: 6 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,10 @@ run_test_5_3: bom bom_shebang init
./test/init_

clean:
rm -f *.lua.c luastatic
rm -f *.luastatic.c luastatic
find test/ -type f -executable | xargs rm -f
find test/ -type f -name *.lua.c | xargs rm -f
find test/ -type f -name *.luac.c | xargs rm -f
find test/ -type f -name *.luac | xargs rm -f
find test/ -type f -name *.o | xargs rm -f
find test/ -type f -name *.a | xargs rm -f
find test/ -type f -name *.so | xargs rm -f
find test/ -type f -name "*.luastatic.c" | xargs rm -f
find test/ -type f -name "*.luac" | xargs rm -f
find test/ -type f -name "*.o" | xargs rm -f
find test/ -type f -name "*.a" | xargs rm -f
find test/ -type f -name "*.so" | xargs rm -f
5 changes: 3 additions & 2 deletions luastatic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ local mainlua = lua_source_files[1]
Generate a C program containing the Lua source files that uses the Lua C API to
initialize any Lua libraries and run the program.
--]]
local outfile = io.open(mainlua.path .. ".c", "w+")
local outfilename = mainlua.basename_noextension .. ".luastatic.c"
local outfile = io.open(outfilename, "w+")
local function out(...)
outfile:write(...)
end
Expand Down Expand Up @@ -432,7 +433,7 @@ end
local compile_command = table.concat({
CC,
"-Os",
mainlua.path .. ".c",
outfilename,
-- Link with Lua modules first to avoid linking errors.
table.concat(module_link_libraries, " "),
table.concat(dep_library_files, " "),
Expand Down

0 comments on commit bdaf8b8

Please sign in to comment.