diff --git a/build_tests/two_sources/build.rb b/build_tests/two_sources/build.rb new file mode 100644 index 0000000..a498ded --- /dev/null +++ b/build_tests/two_sources/build.rb @@ -0,0 +1,4 @@ +Rscons::Environment.new(echo: :command) do |env| + env.Object("one.o", "one.c", 'CPPFLAGS' => ['-DONE']) + env.Program('two_sources', ['one.o', 'two.c']) +end diff --git a/build_tests/two_sources/one.c b/build_tests/two_sources/one.c new file mode 100644 index 0000000..93ba280 --- /dev/null +++ b/build_tests/two_sources/one.c @@ -0,0 +1,8 @@ +#include + +#ifdef ONE +int main(int argc, char *argv[]) +{ + printf("This is a C program with two sources.\n"); +} +#endif diff --git a/build_tests/two_sources/two.c b/build_tests/two_sources/two.c new file mode 100644 index 0000000..d4d6c8c --- /dev/null +++ b/build_tests/two_sources/two.c @@ -0,0 +1,3 @@ +#ifdef ONE +#error ONE should not be defined +#endif diff --git a/spec/build_tests_spec.rb b/spec/build_tests_spec.rb index d74244a..bf447f7 100644 --- a/spec/build_tests_spec.rb +++ b/spec/build_tests_spec.rb @@ -143,4 +143,14 @@ describe Rscons do `./simple`.should == "This is a simple C++ program\n" end + it 'allows overriding construction variables for individual builder calls' do + lines = test_dir('two_sources') + lines.should == [ + 'gcc -c -o one.o -MMD -MF one.mf -DONE one.c', + 'gcc -c -o two.o -MMD -MF two.mf two.c', + 'gcc -o two_sources one.o two.o', + ] + File.exists?('two_sources').should be_true + `./two_sources`.should == "This is a C program with two sources.\n" + end end