add LEXSUFFIX, YACCSUFFIX construction variables - close #31

This commit is contained in:
Josh Holtrop 2017-05-29 11:03:01 -04:00
parent 6f242a1c64
commit d31b4725d2

View File

@ -18,9 +18,11 @@ module Rscons
"YACC" => "bison", "YACC" => "bison",
"YACC_FLAGS" => ["-d"], "YACC_FLAGS" => ["-d"],
"YACC_CMD" => ["${YACC}", "${YACC_FLAGS}", "-o", "${_TARGET}", "${_SOURCES}"], "YACC_CMD" => ["${YACC}", "${YACC_FLAGS}", "-o", "${_TARGET}", "${_SOURCES}"],
"YACCSUFFIX" => [".y", ".yy"],
"LEX" => "flex", "LEX" => "flex",
"LEX_FLAGS" => [], "LEX_FLAGS" => [],
"LEX_CMD" => ["${LEX}", "${LEX_FLAGS}", "-o", "${_TARGET}", "${_SOURCES}"], "LEX_CMD" => ["${LEX}", "${LEX_FLAGS}", "-o", "${_TARGET}", "${_SOURCES}"],
"LEXSUFFIX" => [".l", ".ll"],
} }
end end
@ -41,9 +43,9 @@ module Rscons
}) })
cmd = cmd =
case case
when sources.first.end_with?(".l", ".ll") when sources.first.end_with?(*env.expand_varref("${LEXSUFFIX}"))
"LEX" "LEX"
when sources.first.end_with?(".y", ".yy") when sources.first.end_with?(*env.expand_varref("${YACCSUFFIX}"))
"YACC" "YACC"
else else
raise "Unknown source file #{sources.first.inspect} for CFile builder" raise "Unknown source file #{sources.first.inspect} for CFile builder"