Allow lemon output directory to be chosen
@@ -6,18 +6,20 @@ local path = require "tundra.path"
DefRule {
Name = "Lemon",
- Command = "lemon $(<)",
+ Command = "lemon -d$(OUTDIR) $(<)",
ConfigInvariant = true,
Blueprint = {
Source = { Required = true, Type = "string" },
+ OutputDir = { Required = false, Type = "string" },
},
Setup = function (env, data)
local src = data.Source
local base_name = path.drop_suffix(src)
- local gen_c = base_name .. '.c'
- local gen_h = base_name .. '.h'
+ env:set('OUTDIR', data.OutputDir or '.')
+ local gen_c = '$(OUTDIR)$(SEP)' .. base_name .. '.c'
+ local gen_h = '$(OUTDIR)$(SEP)' .. base_name .. '.h'
local gen_out = base_name .. '.out'
return {
InputFiles = { src },
