diff options
| author | hathach <[email protected]> | 2012-12-27 02:52:40 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2012-12-27 02:52:40 +0700 |
| commit | bc735bbe2239cbe08973adf99124cf18d4ef24c8 (patch) | |
| tree | 27213c897922f5c43c9622eb125d3e88f7b108fa /tests/vendor/ceedling/lib/makefile.rb | |
| parent | f4fa62e032a33c444cb2794eb4851d65aaad0978 (diff) | |
- add ceedling/cmock/unity as testing framework and support
- unified makefile project for the whole repos
- new separate project for tests
Diffstat (limited to 'tests/vendor/ceedling/lib/makefile.rb')
| -rw-r--r-- | tests/vendor/ceedling/lib/makefile.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/vendor/ceedling/lib/makefile.rb b/tests/vendor/ceedling/lib/makefile.rb new file mode 100644 index 000000000..c3d7496d2 --- /dev/null +++ b/tests/vendor/ceedling/lib/makefile.rb @@ -0,0 +1,46 @@ + +# modified version of Rake's provided make-style dependency loader +# customizations: +# (1) handles windows drives in paths -- colons don't confuse task demarcation +# (2) handles spaces in directory paths + +module Rake + + # Makefile loader to be used with the import file loader. + class MakefileLoader + + # Load the makefile dependencies in +fn+. + def load(fn) + open(fn) do |mf| + lines = mf.read + lines.gsub!(/#[^\n]*\n/m, "") # remove comments + lines.gsub!(/\\\n/, ' ') # string together line continuations into single line + lines.split("\n").each do |line| + process_line(line) + end + end + end + + private + + # Process one logical line of makefile data. + def process_line(line) + # split on presence of task demaractor followed by space (i.e don't get confused by a colon in a win path) + file_tasks, args = line.split(/:\s/) + + return if args.nil? + + # split at non-escaped space boundary between files (i.e. escaped spaces in paths are left alone) + dependents = args.split(/\b\s+/) + # replace escaped spaces and clean up any extra whitespace + dependents.map! { |path| path.gsub(/\\ /, ' ').strip } + + file_tasks.strip.split.each do |file_task| + file file_task => dependents + end + end + end + + # Install the handler + Rake.application.add_loader('mf', MakefileLoader.new) +end |
