Compare commits

..
11 Commits
Author SHA1 Message Date
josh 5beddd63ac bundle update 2019-07-02 19:46:30 -04:00
josh 4967f89a76 fix inconsistent type handling in VarSet#expand_varref - #73 2019-04-14 14:10:13 -04:00
josh 7cc68b2ce1 Remove Cache dirty-tracking
It really wasn't necessary since Cache#write is not called often.
2019-04-04 15:20:35 -04:00
josh be058dd18b avoid mkdir() race conditions - close #75 2018-12-11 22:13:33 -05:00
josh ad703a5c84 call Bundler.setup in build_tests_spec.rb 2018-12-09 21:20:16 -05:00
John Lindgren fb5d107581 Reduce recursion of VarSet#expand_varref by expanding vars earlier.
It's common for a build command to contain a reference like:

    ${INCPREFIX}${CPPPATH}

Where ${INCPREFIX} is "-I" and ${CPPPATH} is an array of include
paths.  Without this change, Rscons expands ${INCPREFIX} (and then
tries to expand "-I") repeatedly, once for each path.

This change simply makes Rscons intelligent enough to expand
${INCPREFIX} only once, then join the expanded value to each path.

In a mid-sized rake project, ruby-prof shows that the number of
calls to expand_varref is reduced from ~80,000 to ~30,000., and the
total CPU time spent in expand_varref is reduced by about 30%.

In a larger project, the improvement in real build time is small
but consistent enough to be measurable (~0.5 seconds off a total
of ~20 seconds).
2018-12-07 20:06:18 -05:00
josh d5c1a4b41a v1.17.0 2018-11-02 17:01:52 -04:00
josh 3f63bf5d13 update CHANGELOG.md for v1.17.0 2018-11-02 17:01:21 -04:00
josh ce47bd3599 remove makefile target name check when parsing dependencies - close #57 2018-11-02 14:23:47 -04:00
michael.metivier 68cab5e24d Environment.expand_varref has the same allowed parameter types and returns as Varset.expand_varref 2018-11-02 08:52:23 -04:00
michael.metivier f92dd62ebd Allow construction variable expansion on _true_ and _false_ literals 2018-11-02 00:03:54 -04:00
227 changed files with 3241 additions and 4965 deletions

No files matched your search

-2
View File
@@ -3,7 +3,5 @@
/_yardoc/
/build_test_run/
/coverage/
/dist/
/doc/
/pkg/
/test/
+2 -6
View File
@@ -1,8 +1,4 @@
source 'https://rubygems.org'
gem "json"
gem "rspec"
gem "rake"
gem "simplecov"
gem "yard"
gem "rdoc"
# Specify your gem's dependencies in rscons.gemspec
gemspec
+24 -18
View File
@@ -1,42 +1,48 @@
PATH
remote: .
specs:
rscons (1.17.0)
json (>= 1.8, < 3.0)
GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.3)
docile (1.1.5)
json (2.1.0)
rake (12.3.1)
rdoc (5.1.0)
rspec (3.6.0)
rspec-core (~> 3.6.0)
rspec-expectations (~> 3.6.0)
rspec-mocks (~> 3.6.0)
rspec-core (3.6.0)
rspec-support (~> 3.6.0)
rspec-expectations (3.6.0)
docile (1.3.2)
json (2.2.0)
rake (12.3.2)
rdoc (6.1.1)
rspec (3.8.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-core (3.8.2)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.4)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.6.0)
rspec-mocks (3.6.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.6.0)
rspec-support (3.6.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.2)
simplecov (0.15.0)
docile (~> 1.1.0)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
yard (0.9.12)
yard (0.9.20)
PLATFORMS
ruby
x86-mingw32
DEPENDENCIES
json
rake
rdoc
rscons!
rspec
simplecov
yard
BUNDLED WITH
1.16.2
1.17.3
+4 -4
View File
@@ -1,13 +1,13 @@
# Rscons
Rscons (https://github.com/holtrop/rscons) is a software construction framework
inspired by SCons and waf but implemented in Ruby.
inspired by SCons and implemented in Ruby.
[![Gem Version](https://badge.fury.io/rb/rscons.png)](http://badge.fury.io/rb/rscons)
## Installation
Rscons is distributed as a standalone Ruby script named ``rscons``. This file
(containing the complete rscons build system) can be checked into your project
and versioned along with your project.
$ gem install rscons
## Usage
+3 -20
View File
@@ -5,17 +5,13 @@ rescue Bundler::BundlerError => e
raise LoadError.new("Unable to setup Bundler; you might need to `bundle install`: #{e.message}")
end
require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "yard"
require "rake/clean"
require "fileutils"
CLEAN.include %w[build_test_run .yardoc doc coverage test]
CLOBBER.include %w[dist pkg]
task :build_dist do
sh "ruby rb/build_dist.rb"
end
CLEAN.include %w[build_test_run .yardoc doc coverage]
CLOBBER.include %w[pkg]
RSpec::Core::RakeTask.new(:spec, :example_string) do |task, args|
if args.example_string
@@ -23,19 +19,6 @@ RSpec::Core::RakeTask.new(:spec, :example_string) do |task, args|
task.rspec_opts = %W[-e "#{args.example_string}" -f documentation]
end
end
task :spec => :build_dist
# dspec task is useful to test the distributable release script, but is not
# useful for coverage information.
desc "Dist Specs"
task :dspec, [:example_string] => :build_dist do |task, args|
FileUtils.mkdir_p("test")
FileUtils.cp("dist/rscons", "test/rscons.rb")
ENV["dist_specs"] = "1"
Rake::Task["spec"].invoke(args.example_string)
ENV.delete("dist_specs")
FileUtils.rm_f(Dir.glob(".rscons-*"))
end
YARD::Rake::YardocTask.new do |yard|
yard.files = ['lib/**/*.rb']
+1 -3
View File
@@ -2,6 +2,4 @@
require "rscons/cli"
if __FILE__ == $0
Rscons::Cli.run(ARGV)
end
Rscons::Cli.run(ARGV)
+5
View File
@@ -0,0 +1,5 @@
Rscons::Environment.new do |env|
env.append('CPPPATH' => Rscons.glob('src/**'))
env.build_dir(%r{^src/([^/]+)/}, 'build_\\1/')
env.Program('build_dir.exe', Rscons.glob('src/**/*.c'))
end
@@ -0,0 +1,22 @@
class MyObject < Rscons::Builder
def run(target, sources, cache, env, vars)
env.run_builder(env.builders["Object"], target, sources, cache, vars)
end
end
Rscons::Environment.new(echo: :command) do |env|
env.add_builder(MyObject.new)
env.append('CPPPATH' => Rscons.glob('src/**'))
env.add_build_hook do |build_op|
if build_op[:builder].name == "MyObject" && build_op[:sources].first =~ %r{one\.c}
build_op[:vars]["CFLAGS"] << "-O1"
build_op[:sources] = ['src/two/two.c']
elsif build_op[:builder].name == "MyObject" && build_op[:target] =~ %r{two\.o}
new_vars = build_op[:vars].clone
new_vars["CFLAGS"] << "-O2"
build_op[:vars] = new_vars
end
end
env.MyObject('one.o', 'src/one/one.c')
env.MyObject('two.o', 'src/two/two.c')
end
@@ -0,0 +1,6 @@
env = Rscons::Environment.new do |env|
env.append('CPPPATH' => Rscons.glob('src/**/*/'))
env.build_dir("src", "build")
env.build_root = "build_root"
env.Program('build_dir.exe', Rscons.glob('src/**/*.c'))
end
+12
View File
@@ -0,0 +1,12 @@
Rscons::Environment.new(echo: :command) do |env|
env.append('CPPPATH' => Rscons.glob('src/**/*/'))
env.build_dir(%r{^src/([^/]+)/}, 'build_\\1/')
env.add_build_hook do |build_op|
if build_op[:target] =~ %r{build_one/.*\.o}
build_op[:vars]["CFLAGS"] << "-O1"
elsif build_op[:target] =~ %r{build_two/.*\.o}
build_op[:vars]["CFLAGS"] << "-O2"
end
end
env.Program('build_hook.exe', Rscons.glob('src/**/*.c'))
end
+8
View File
@@ -0,0 +1,8 @@
Rscons::Environment.new(echo: :command) do |env|
env.append('CPPPATH' => Rscons.glob('src/**').sort)
env.build_root = "build_root"
FileUtils.mkdir_p(env.build_root)
FileUtils.mv("src/one/one.c", "build_root")
env.Object("^/one.o", "^/one.c")
env.Program("build_dir.exe", Rscons.glob('src/**/*.c') + ["^/one.o"])
end
+3
View File
@@ -0,0 +1,3 @@
Rscons::Environment.new do |env|
env.Copy("inst.exe", "copy.rb")
end
+6
View File
@@ -0,0 +1,6 @@
Rscons::Environment.new do |env|
env["CSUFFIX"] = %w[.yargh .c]
env["CFLAGS"] += %w[-x c]
env["CPPPATH"] += Rscons.glob("src/**")
env.Program("build_dir.exe", Rscons.glob("src/**/*.{c,yargh}"))
end
@@ -0,0 +1,5 @@
Rscons::Environment.new do |env|
env.echo = :command
env.Install("inst.exe", "install.rb")
end
@@ -0,0 +1,13 @@
class MyBuilder < Rscons::Builder
def run(options)
env, target = options.values_at(:env, :target)
env.print_builder_run_message("MyBuilder #{target}", "MyBuilder #{target} command")
target
end
end
Rscons::Environment.new do |env|
env.echo = :command
env.add_builder(MyBuilder.new)
env.MyBuilder("foo")
end
+3
View File
@@ -0,0 +1,3 @@
Rscons::Environment.new do |env|
env.Install("inst.exe", "install.rb")
end
@@ -0,0 +1,9 @@
Rscons::Environment.new do |env|
env.Directory("inst")
env.Install("inst", "install_directory.rb")
env.Install("noexist/src", "src")
env.Directory("exist/src")
env.Install("exist/src", "src")
end
@@ -0,0 +1,5 @@
Rscons::Environment.new do |env|
env["CPPPATH"] << "src/two"
env.Object("one.o", "src/one/one.c")
env.Object("one.o", "src/two/two.c")
end
@@ -0,0 +1,6 @@
Rscons::Environment.new do |env|
env.append('CPPPATH' => Rscons.glob('src/**'))
env.build_dir("src2", "build")
env.build_root = "build_root"
env.Program('build_dir.exe', Rscons.glob('src/**/*.c'))
end
@@ -0,0 +1,10 @@
Rscons::Environment.new do |env|
env["CPPPATH"] << "src/two"
env.Object("one.o", "src/one/one.c")
env.add_post_build_hook do |build_op|
if build_op[:target] == "one.o"
env["MODULE"] = "two"
env.Object("${MODULE}.o", "src/${MODULE}/${MODULE}.c")
end
end
end
+6
View File
@@ -0,0 +1,6 @@
Rscons::Environment.new do |env|
env.append("CPPPATH" => Rscons.glob("src/**"))
env.build_dir("src/one/", "build_one/")
env.build_dir("src/two", "build_two")
env.Program("build_dir.exe", Rscons.glob("src/**/*.c"))
end
File renamed without changes.
File renamed without changes.
File renamed without changes.
-6
View File
@@ -1,6 +0,0 @@
build do
Environment.new do |env|
env.CFile("lexer.c", "lexer.l")
env.CFile("parser.c", "parser.y")
end
end
+4
View File
@@ -0,0 +1,4 @@
Rscons::Environment.new do |env|
env.CFile("lexer.c", "lexer.l")
env.CFile("parser.c", "parser.y")
end
+1 -3
View File
@@ -1,5 +1,3 @@
build do
Environment.new do |env|
Rscons::Environment.new do |env|
env.CFile("file.c", "foo.bar")
end
end
-12
View File
@@ -1,12 +0,0 @@
build do
debug = Environment.new(echo: :command) do |env|
env['CFLAGS'] = '-O2'
env['CPPFLAGS'] = '-DSTRING="Debug Version"'
env.Program('program-debug.exe', Dir['src/*.c'])
end
release = debug.clone do |env|
env["CPPFLAGS"] = '-DSTRING="Release Version"'
env.Program('program-release.exe', Dir['src/*.c'])
end
end
+12
View File
@@ -0,0 +1,12 @@
debug = Rscons::Environment.new(echo: :command) do |env|
env.build_dir('src', 'debug')
env['CFLAGS'] = '-O2'
env['CPPFLAGS'] = '-DSTRING="Debug Version"'
env.Program('program-debug.exe', Dir['src/*.c'])
end
release = debug.clone do |env|
env["CPPFLAGS"] = '-DSTRING="Release Version"'
env.build_dir('src', 'release')
env.Program('program-release.exe', Dir['src/*.c'])
end
+10 -11
View File
@@ -1,16 +1,15 @@
build do
env1 = Environment.new(echo: :command) do |env|
env1 = Rscons::Environment.new(echo: :command) do |env|
env.build_dir('src', 'build')
env['CFLAGS'] = '-O2'
env.add_build_hook do |builder|
builder.vars['CPPFLAGS'] = '-DSTRING="Hello"'
env.add_build_hook do |build_op|
build_op[:vars]['CPPFLAGS'] = '-DSTRING="Hello"'
end
env.add_post_build_hook do |builder|
$stdout.puts "post #{builder.target}"
env.add_post_build_hook do |build_op|
$stdout.puts "post #{build_op[:target]}"
end
env.Program('program.exe', Dir['src/*.c'])
end
env2 = env1.clone do |env|
env.Program('program2.exe', Dir['src/*.c'])
end
end
env2 = env1.clone do |env|
env.Program('program2.exe', Dir['src/*.c'])
end
-3
View File
@@ -1,3 +0,0 @@
configure do
check_c_compiler "nope.nope"
end
-1
View File
@@ -1 +0,0 @@
autoconf false
-10
View File
@@ -1,10 +0,0 @@
configure do
check_c_compiler
check_c_header "stdio.h"
end
build do
Environment.new do |env|
env.Program("simple.exe", "simple.c")
end
end
@@ -1,3 +0,0 @@
configure do
check_c_compiler
end
@@ -1,3 +0,0 @@
configure do
check_c_compiler "mycompiler"
end
@@ -1,3 +0,0 @@
configure do
check_c_compiler "gcc", "clang"
end
@@ -1,3 +0,0 @@
configure do
check_c_header "not___found.h"
end
@@ -1,3 +0,0 @@
configure do
check_c_header "not___found.h", fail: false
end
@@ -1,9 +0,0 @@
configure do
check_c_header "not___found.h", fail: false, set_define: "HAVE_NOT___FOUND_H"
end
build do
Environment.new(echo: :command) do |env|
env.Object("simple.o", "simple.c")
end
end
@@ -1,3 +0,0 @@
configure do
check_c_header "string.h"
end
@@ -1,9 +0,0 @@
configure do
check_c_header "string.h", set_define: "HAVE_STRING_H"
end
build do
Environment.new(echo: :command) do |env|
env.Object("simple.o", "simple.c")
end
end
-9
View File
@@ -1,9 +0,0 @@
configure do
check_cfg program: "my-config"
end
build do
Environment.new(echo: :command) do |env|
env.Program("myconfigtest", "simple.c")
end
end
@@ -1,9 +0,0 @@
configure do
check_cfg package: "mypackage"
end
build do
Environment.new(echo: :command) do |env|
env.Program("myconfigtest", "simple.c")
end
end
-15
View File
@@ -1,15 +0,0 @@
configure do
check_cfg package: "mypackage", use: "myp"
end
build do
Environment.new(echo: :command) do |env|
env.Copy("myconfigtest1.c", "simple.c")
env.Program("myconfigtest1.exe", "myconfigtest1.c")
end
Environment.new(echo: :command, use: "myp") do |env|
env.Copy("myconfigtest2.c", "simple.c")
env.Program("myconfigtest2.exe", "myconfigtest2.c")
end
end
@@ -1,3 +0,0 @@
configure do
check_cxx_compiler
end
@@ -1,3 +0,0 @@
configure do
check_cxx_compiler "mycompiler"
end
@@ -1,3 +0,0 @@
configure do
check_cxx_compiler "g++", "clang++"
end
@@ -1,3 +0,0 @@
configure do
check_cxx_header "not___found.h"
end
@@ -1,3 +0,0 @@
configure do
check_cxx_header "not___found.h", fail: false
end
@@ -1,3 +0,0 @@
configure do
check_cxx_header "string.h"
end
@@ -1,3 +0,0 @@
configure do
check_d_compiler
end
@@ -1,3 +0,0 @@
configure do
check_d_compiler "mycompiler"
end
@@ -1,3 +0,0 @@
configure do
check_d_compiler "gdc", "ldc2"
end
@@ -1,3 +0,0 @@
configure do
check_d_import "not.found"
end
@@ -1,3 +0,0 @@
configure do
check_d_import "not.found", fail: false
end
@@ -1,3 +0,0 @@
configure do
check_d_import "std.stdio"
end
@@ -1,3 +0,0 @@
configure do
check_lib "mfoofoo"
end
@@ -1,3 +0,0 @@
configure do
check_lib "mfoofoo", fail: false
end
@@ -1,9 +0,0 @@
configure do
check_lib "m"
end
build do
Environment.new(echo: :command) do |env|
env.Program("simple.exe", "simple.c")
end
end
-15
View File
@@ -1,15 +0,0 @@
configure do
check_lib "m", use: :m
end
build do
Environment.new(echo: :command) do |env|
env.Copy("test1.c", "simple.c")
env.Program("test2.exe", "test1.c")
end
Environment.new(echo: :command, use: %w[m]) do |env|
env.Copy("test2.c", "simple.c")
env.Program("test2.exe", "test2.c")
end
end
@@ -1,10 +0,0 @@
configure do
check_lib "m", use: false
end
build do
Environment.new(echo: :command) do |env|
env.Copy("test1.c", "simple.c")
env.Program("test2.exe", "test1.c")
end
end
@@ -1,3 +0,0 @@
configure do
check_program "program-that-is-not-found"
end
@@ -1,3 +0,0 @@
configure do
check_program "program-that-is-not-found", fail: false
end
@@ -1,3 +0,0 @@
configure do
check_program "find"
end
@@ -1,3 +0,0 @@
Environment.new do |env|
env.Object("simple.o", "simple.cc")
end
-13
View File
@@ -1,13 +0,0 @@
project_name "configure test"
autoconf false
configure do
check_c_compiler
check_cxx_compiler
check_d_compiler
check_cfg package: "mypackage"
check_c_header "stdio.h"
check_cxx_header "iostream"
check_d_import "std.stdio"
check_lib "m"
check_program "ls"
end
@@ -1,10 +0,0 @@
configure do
check_c_header "math.h", set_define: "HAVE_MATH_H"
check_c_header "stdio.h", set_define: "HAVE_STDIO_H"
end
build do
Environment.new(echo: :command) do |env|
env.Object("simple.o", "simple.c")
end
end
-1
View File
@@ -1 +0,0 @@
check_c_compiler "gcc"
-6
View File
@@ -1,6 +0,0 @@
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("This is a simple C program\n");
}
-18
View File
@@ -1,18 +0,0 @@
class MySource < Rscons::Builder
def run(options)
File.open(@target, 'w') do |fh|
fh.puts <<EOF
#define THE_VALUE 5678
EOF
end
true
end
end
build do
Environment.new do |env|
env.add_builder(MySource)
env.MySource('inc.h', [])
env.Program('program.exe', Dir['*.c'])
end
end
+16
View File
@@ -0,0 +1,16 @@
class MySource < Rscons::Builder
def run(target, sources, cache, env, vars)
File.open(target, 'w') do |fh|
fh.puts <<EOF
#define THE_VALUE 5678
EOF
end
target
end
end
Rscons::Environment.new do |env|
env.add_builder(MySource.new)
env.MySource('inc.h', [])
env.Program('program.exe', Dir['*.c'])
end
+1 -3
View File
@@ -1,5 +1,4 @@
build do
Environment.new do |env|
Rscons::Environment.new do |env|
env.Command("inc.c",
[],
"CMD" => %w[ruby gen.rb ${_TARGET}],
@@ -8,5 +7,4 @@ build do
env["inc_c"] = "inc.c"
env.build_after("${build_root}/program.o", "${inc_c}")
env.Program("program.exe", ["program.c", "inc.c"])
end
end
+5 -7
View File
@@ -1,20 +1,18 @@
class MySource < Rscons::Builder
def run(options)
File.open(@target, 'w') do |fh|
def run(target, sources, cache, env, vars)
File.open(target, 'w') do |fh|
fh.puts <<EOF
#define THE_VALUE 678
EOF
end
true
target
end
end
build do
env = Environment.new do |env|
env = Rscons::Environment.new do |env|
env["hdr"] = "inc.h"
env["src"] = "program.c"
env.add_builder(MySource)
env.add_builder(MySource.new)
env.MySource('${hdr}')
env.Program('program.exe', "${src}")
end
end
+8 -10
View File
@@ -1,17 +1,16 @@
class MySource < Rscons::Builder
def run(options)
File.open(@target, 'w') do |fh|
def run(target, sources, cache, env, vars)
File.open(target, 'w') do |fh|
fh.puts <<EOF
#define THE_VALUE #{@env.expand_varref("${the_value}")}
#define THE_VALUE #{env.expand_varref("${the_value}")}
EOF
end
true
target
end
end
build do
e1 = Environment.new do |env|
env.add_builder(MySource)
e1 = Rscons::Environment.new do |env|
env.add_builder(MySource.new)
env["one"] = "5"
env[:cfg] = {val: "9"}
env["two"] = lambda do |args|
@@ -20,11 +19,10 @@ build do
env["the_value"] = lambda do |args|
"${one}${two}78"
end
end
end
e1.clone do |env|
e1.clone do |env|
env[:cfg][:val] = "6"
env.MySource('inc.h', [])
env.Program('program.exe', Dir['*.c'])
end
end
@@ -1,8 +0,0 @@
build do
Environment.new do |env|
env.add_builder(:MyBuilder) do |options|
"hi"
end
env.MyBuilder("foo")
end
end
@@ -1,8 +0,0 @@
build do
Environment.new do |env|
env.add_builder(:MyBuilder) do |options|
wait_for(1)
end
env.MyBuilder("foo")
end
end
+8 -10
View File
@@ -1,21 +1,19 @@
class CHGen < Rscons::Builder
def run(options)
c_fname = @target
h_fname = @target.sub(/\.c$/, ".h")
unless @cache.up_to_date?([c_fname, h_fname], "", @sources, @env)
def run(target, sources, cache, env, vars)
c_fname = target
h_fname = target.sub(/\.c$/, ".h")
unless cache.up_to_date?([c_fname, h_fname], "", sources, env)
puts "CHGen #{c_fname}"
File.open(c_fname, "w") {|fh| fh.puts "int THE_VALUE = 42;"}
File.open(h_fname, "w") {|fh| fh.puts "extern int THE_VALUE;"}
@cache.register_build([c_fname, h_fname], "", @sources, @env)
cache.register_build([c_fname, h_fname], "", sources, env)
end
true
target
end
end
build do
Environment.new do |env|
env.add_builder(CHGen)
Rscons::Environment.new do |env|
env.add_builder(CHGen.new)
env.CHGen("inc.c", ["program.c"])
env.Program("program.exe", %w[program.c inc.c])
end
end
+1 -3
View File
@@ -1,5 +1,4 @@
build do
Environment.new do |env|
Rscons::Environment.new do |env|
env["build_root"] = env.build_root
env["inc_h"] = "inc.h"
@@ -12,5 +11,4 @@ build do
"CMD" => %w[ruby gen.rb ${_TARGET}],
"CMD_DESC" => "Generating")
env.produces("inc.c", "inc.h")
end
end
@@ -1,21 +0,0 @@
class MyBuilder < Rscons::Builder
def run(options)
if @thread
true
else
print_run_message("#{name} #{target}", nil)
@thread = Thread.new do
sleep 2
FileUtils.touch(@target)
end
wait_for(@thread)
end
end
end
build do
Environment.new do |env|
env.add_builder(MyBuilder)
env.MyBuilder("foo")
end
end
-5
View File
@@ -1,5 +0,0 @@
build do
Environment.new(echo: :command) do |env|
env.Program("hello-d.exe", glob("*.d"))
end
end
+3
View File
@@ -0,0 +1,3 @@
Rscons::Environment.new(echo: :command) do |env|
env.Program("hello-d.exe", Rscons.glob("*.d"))
end
-7
View File
@@ -1,7 +0,0 @@
build do
Environment.new(echo: :command) do |env|
env.Object("main.o", "main.d")
env.Object("mod.o", "mod.d")
env.Program("hello-d.exe", ["main.o", "mod.o"])
end
end
-5
View File
@@ -1,5 +0,0 @@
build do
Environment.new do |env|
env.Program("test.exe", glob("*.c"), direct: true)
end
end
-7
View File
@@ -1,7 +0,0 @@
build do
Environment.new do |env|
lib = env.SharedLibrary("mylib", ["two.c", "three.c"], direct: true)
program = env.Program("test.exe", "main.c", "LIBS" => ["mylib"], "LIBPATH" => ["."])
env.depends(program, lib)
end
end
-7
View File
@@ -1,7 +0,0 @@
#include "two.h"
int main(int argc, char * argv[])
{
two();
return 0;
}
-7
View File
@@ -1,7 +0,0 @@
#include "three.h"
#include <stdio.h>
void three(void)
{
printf("three\n");
}
-1
View File
@@ -1 +0,0 @@
void three(void);
-7
View File
@@ -1,7 +0,0 @@
#include "two.h"
#include "three.h"
void two(void)
{
three();
}
-1
View File
@@ -1 +0,0 @@
void two(void);
-5
View File
@@ -1,5 +0,0 @@
build do
Environment.new do |env|
env.Program('header.exe', Dir['*.c'])
end
end
+3
View File
@@ -0,0 +1,3 @@
Rscons::Environment.new do |env|
env.Program('header.exe', Dir['*.c'])
end
-17
View File
@@ -1,17 +0,0 @@
build do
Environment.new do |env|
require 'json'
require 'yaml'
env.add_builder(:JsonToYaml) do |params|
unless @cache.up_to_date?(@target, :JsonToYaml, @sources, @env)
@cache.mkdir_p(File.dirname(@target))
File.open(@target, 'w') do |f|
f.write(YAML.dump(JSON.load(IO.read(@sources.first))))
end
@cache.register_build(@target, :JsonToYaml, @sources, @env)
end
true
end
env.JsonToYaml('foo.yml', 'foo.json')
end
end
+15
View File
@@ -0,0 +1,15 @@
Rscons::Environment.new do |env|
require 'json'
require 'yaml'
env.add_builder(:JsonToYaml) do |target, sources, cache, env, vars|
unless cache.up_to_date?(target, :JsonToYaml, sources, env)
cache.mkdir_p(File.dirname(target))
File.open(target, 'w') do |f|
f.write(YAML.dump(JSON.load(IO.read(sources.first))))
end
cache.register_build(target, :JsonToYaml, sources, env)
end
target
end
env.JsonToYaml('foo.yml', 'foo.json')
end
-6
View File
@@ -1,6 +0,0 @@
build do
Environment.new(echo: :command) do |env|
env.Program('library.exe', ['lib.a', 'three.c'])
env.Library("lib.a", ['one.c', 'two.c'], 'CPPFLAGS' => ['-Dmake_lib'])
end
end
+4
View File
@@ -0,0 +1,4 @@
Rscons::Environment.new(echo: :command) do |env|
env.Program('library.exe', ['lib.a', 'three.c'])
env.Library("lib.a", ['one.c', 'two.c'], 'CPPFLAGS' => ['-Dmake_lib'])
end
@@ -1,7 +0,0 @@
build do
Environment.new do |env|
env.Program("library.exe", ["lib.a", "three.c"])
env.Object("two.o", "two.c")
env.Library("lib.a", ["one.c", "two.o"], 'CPPFLAGS' => ['-Dmake_lib'])
end
end
+2 -4
View File
@@ -1,6 +1,4 @@
build do
Environment.new(echo: :command) do |env|
Rscons::Environment.new(echo: :command) do |env|
env["ARCMD"] = %w[ar rcf ${_TARGET} ${_SOURCES}]
env.Library("lib.a", glob("*.c"))
end
env.Library("lib.a", Rscons.glob("*.c"))
end
-5
View File
@@ -1,5 +0,0 @@
build do
Environment.new do |env|
env.Preprocess("pp", "foo.h")
end
end
+3
View File
@@ -0,0 +1,3 @@
Rscons::Environment.new do |env|
env.Preprocess("pp", "foo.h")
end
-13
View File
@@ -1,13 +0,0 @@
build do
Environment.new do |env|
env["CPPPATH"] << "src/lib"
libmine = env.SharedLibrary("mine", glob("src/lib/*.c"))
env.Program("test-shared.exe",
glob("src/*.c"),
"LIBPATH" => %w[.],
"LIBS" => %w[mine])
env.build_after("test-shared.exe", libmine)
env.Program("test-static.exe",
glob("src/**/*.c"))
end
end
Loaded 100 of 227 files, more files were not shown because too many files have changed in this diff. Show more