summaryrefslogtreecommitdiff
path: root/configure.lua
diff options
context:
space:
mode:
Diffstat (limited to 'configure.lua')
-rw-r--r--configure.lua25
1 files changed, 21 insertions, 4 deletions
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")