From 9c3935c2b012154ae0478c8dc2cabefed3380573 Mon Sep 17 00:00:00 2001 From: quou Date: Sat, 22 Feb 2025 17:59:09 +1100 Subject: makefile dependencies for shader includes --- configure.lua | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'configure.lua') diff --git a/configure.lua b/configure.lua index 3fa6f17..9bfe342 100644 --- a/configure.lua +++ b/configure.lua @@ -81,6 +81,7 @@ end function build_unix() local compiler_c = nil local compiler_cpp = nil + local compiler_prep = nil local ar = nil if os.execute("gcc --version") then compiler_c = "gcc" @@ -92,13 +93,20 @@ function build_unix() if os.execute("ar --version") then ar = "ar" end + if os.execute("cpp --version") then + compiler_prep = "cpp" + end if not compiler_c or not compiler_cpp then print("didn't find a valid compiler :(") os.exit(2) end - print("c compiler: " .. compiler_c) - print("c++ compiler: " .. compiler_cpp) - print("ar: " .. ar) + if not compiler_prep then + print("didn't find a C preprocessor") + end + print("c compiler: " .. compiler_c) + print("c++ compiler: " .. compiler_cpp) + print("c preprocessor: " .. compiler_prep) + print("ar: " .. ar) local outfile = io.open("Makefile", "w") if not outfile then @@ -200,12 +208,20 @@ function build_unix() local function shaders(stype, dtype, tool, tab) for _, fname in ipairs(tab) do outfile:write(string.format( - "data/%s.%s: intermediate/%s.%s %s | data\n\t./%s intermediate/%s.%s data/%s.%s\n", + "data/%s.%s: intermediate/%s.%s %s | data\n" .. + "\t%s -MMD -MF data/%s.d -MT data/%s.%s -Iintermediate intermediate/%s.%s > /dev/null\n" .. + "\t./%s intermediate/%s.%s data/%s.%s\n", fname, dtype, fname, stype, tool, + compiler_prep, + fname, + fname, + dtype, + fname, + stype, tool, fname, stype, @@ -213,6 +229,7 @@ function build_unix() dtype )) all_shaders[#all_shaders + 1] = "data/" .. fname .. "." .. dtype + all_deps[#all_deps + 1] = "data/" .. fname .. ".d" all_assets[#all_assets + 1] = fname .. "." .. dtype end outfile:write("\n") -- cgit v1.2.3-54-g00ecf