From d31b4725d27977c96b1ee51b26936e31c2178c40 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Mon, 29 May 2017 11:03:01 -0400 Subject: [PATCH] add LEXSUFFIX, YACCSUFFIX construction variables - close #31 --- lib/rscons/builders/cfile.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/rscons/builders/cfile.rb b/lib/rscons/builders/cfile.rb index b935337..e8c061f 100644 --- a/lib/rscons/builders/cfile.rb +++ b/lib/rscons/builders/cfile.rb @@ -18,9 +18,11 @@ module Rscons "YACC" => "bison", "YACC_FLAGS" => ["-d"], "YACC_CMD" => ["${YACC}", "${YACC_FLAGS}", "-o", "${_TARGET}", "${_SOURCES}"], + "YACCSUFFIX" => [".y", ".yy"], "LEX" => "flex", "LEX_FLAGS" => [], "LEX_CMD" => ["${LEX}", "${LEX_FLAGS}", "-o", "${_TARGET}", "${_SOURCES}"], + "LEXSUFFIX" => [".l", ".ll"], } end @@ -41,9 +43,9 @@ module Rscons }) cmd = case - when sources.first.end_with?(".l", ".ll") + when sources.first.end_with?(*env.expand_varref("${LEXSUFFIX}")) "LEX" - when sources.first.end_with?(".y", ".yy") + when sources.first.end_with?(*env.expand_varref("${YACCSUFFIX}")) "YACC" else raise "Unknown source file #{sources.first.inspect} for CFile builder"