Class: PreprocessinatorBareIncludesExtractor
- Defined in:
- lib/ceedling/preprocess/preprocessinator_bare_includes_extractor.rb
Overview
Parse GCC preprocessor make-rule dependencies output to extract user include directives
Constant Summary collapse
- MAKE_RULE_MATCHER =
Matcher for the first line of the make rule output
/^\S+\.o:\s+.+$/- INCLUDE_MATCHER =
Matcher for the “phony“ make rule output lines for each #include dependency (.h, .c, etc.) Capture file name before the colon
/^(\S+\.\S+):\s*$/
Class Method Summary collapse
Class Method Details
.extract_includes(make_rules) ⇒ Object
59 60 61 62 63 64 65 66 67 |
# File 'lib/ceedling/preprocess/preprocessinator_bare_includes_extractor.rb', line 59 def self.extract_includes(make_rules) # Extract the #include dependencies from the "phony" make rules, one per line includes = make_rules.scan( INCLUDE_MATCHER ) includes.flatten! # Regex results can be nested arrays becuase of paren captures includes.uniq! # Convert list of fileapth strings to list of bare Include objects return includes.map { |_include| Include.new(_include) } end |