diff options
| -rw-r--r-- | bam.lua | 2 | ||||
| -rw-r--r-- | configure.lua | 49 |
2 files changed, 31 insertions, 20 deletions
diff --git a/bam.lua b/bam.lua index f86e94e9..90a268fd 100644 --- a/bam.lua +++ b/bam.lua @@ -11,7 +11,7 @@ config:Add(OptTestCompileC("stackprotector", "int main(){return 0;}", "-fstack-p config:Add(OptLibrary("zlib", "zlib.h", false)) config:Add(SDL.OptFind("sdl", true)) config:Add(FreeType.OptFind("freetype", true)) -config:Finalize("config.bam") +config:Finalize("config.lua") -- data compiler function Script(name) diff --git a/configure.lua b/configure.lua index 9df4b82d..993ed51a 100644 --- a/configure.lua +++ b/configure.lua @@ -75,6 +75,12 @@ function NewConfig(on_configured_callback) local options_func = loadfile(filename) local options_table = {} + if not options_func then + print("auto configuration", options_func) + self:Config(filename) + options_func = loadfile(filename) + end + if options_func then -- Setup the options tables for k,v in pairs(self.options) do @@ -114,6 +120,28 @@ function NewConfig(on_configured_callback) os.exit(1) end end + + config.Config = function(self, filename) + print("") + print("configuration:") + if _bam_targets[1] == "print" then + self:Load(filename) + self:Print() + print("") + print("notes:") + self:OnConfigured() + print("") + else + self:Autodetect() + print("") + print("notes:") + if self:OnConfigured() then + self:Save(filename) + end + print("") + end + + end config.Autodetect = function(self) for k,v in pairs(self.options) do @@ -138,25 +166,8 @@ function NewConfig(on_configured_callback) self:PrintHelp() os.exit(0) end - - print("") - print("configuration:") - if _bam_targets[1] == "print" then - self:Load(filename) - self:Print() - print("") - print("notes:") - self:OnConfigured() - print("") - else - self:Autodetect() - print("") - print("notes:") - if self:OnConfigured() then - self:Save(filename) - end - print("") - end + + self:Config(filename) os.exit(0) end |