Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f33be07a15 | ||
|
|
c4c2d5c128 | ||
|
|
3065dc48ec | ||
|
|
9ca2934695 | ||
|
|
3af6b6be1b | ||
|
|
0442b876a5 | ||
|
|
bab4641b6e | ||
|
|
4698fc41b9 | ||
|
|
952f423860 | ||
|
|
d2da5f7b0d | ||
|
|
ab14dc16ed |
No files matched your search
+25
-22
@@ -1,7 +1,7 @@
|
|||||||
PATH
|
PATH
|
||||||
remote: .
|
remote: .
|
||||||
specs:
|
specs:
|
||||||
rscons (1.9.0)
|
rscons (1.9.3)
|
||||||
json (~> 1.0)
|
json (~> 1.0)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
@@ -9,30 +9,30 @@ GEM
|
|||||||
specs:
|
specs:
|
||||||
diff-lcs (1.2.5)
|
diff-lcs (1.2.5)
|
||||||
docile (1.1.5)
|
docile (1.1.5)
|
||||||
json (1.8.1)
|
json (1.8.3)
|
||||||
multi_json (1.10.1)
|
rake (10.4.2)
|
||||||
rake (10.3.2)
|
rdoc (4.2.0)
|
||||||
rdoc (4.1.2)
|
|
||||||
json (~> 1.4)
|
json (~> 1.4)
|
||||||
redcarpet (3.1.2)
|
redcarpet (3.3.3)
|
||||||
rspec (3.0.0)
|
rspec (3.4.0)
|
||||||
rspec-core (~> 3.0.0)
|
rspec-core (~> 3.4.0)
|
||||||
rspec-expectations (~> 3.0.0)
|
rspec-expectations (~> 3.4.0)
|
||||||
rspec-mocks (~> 3.0.0)
|
rspec-mocks (~> 3.4.0)
|
||||||
rspec-core (3.0.1)
|
rspec-core (3.4.1)
|
||||||
rspec-support (~> 3.0.0)
|
rspec-support (~> 3.4.0)
|
||||||
rspec-expectations (3.0.1)
|
rspec-expectations (3.4.0)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.0.0)
|
rspec-support (~> 3.4.0)
|
||||||
rspec-mocks (3.0.1)
|
rspec-mocks (3.4.0)
|
||||||
rspec-support (~> 3.0.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (3.0.0)
|
rspec-support (~> 3.4.0)
|
||||||
simplecov (0.8.2)
|
rspec-support (3.4.1)
|
||||||
|
simplecov (0.11.1)
|
||||||
docile (~> 1.1.0)
|
docile (~> 1.1.0)
|
||||||
multi_json
|
json (~> 1.8)
|
||||||
simplecov-html (~> 0.8.0)
|
simplecov-html (~> 0.10.0)
|
||||||
simplecov-html (0.8.0)
|
simplecov-html (0.10.0)
|
||||||
yard (0.8.7.4)
|
yard (0.8.7.6)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
@@ -46,3 +46,6 @@ DEPENDENCIES
|
|||||||
rspec
|
rspec
|
||||||
simplecov
|
simplecov
|
||||||
yard
|
yard
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
1.10.6
|
||||||
@@ -394,6 +394,25 @@ not expected to be produced by the builder.
|
|||||||
Phony targets will still be "rebuilt" if any source or the command is out of
|
Phony targets will still be "rebuilt" if any source or the command is out of
|
||||||
date.
|
date.
|
||||||
|
|
||||||
|
### Explicit Dependencies
|
||||||
|
|
||||||
|
A target can be marked as depending on another file that Rscons would not
|
||||||
|
otherwise know about via the `Environment#depends` function. For example,
|
||||||
|
to force the linker to re-link a Program output when a linker script changes:
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
Rscons::Environment.new do |env|
|
||||||
|
env.Program("a.out", "foo.c", "LDFLAGS" => %w[-T linker_script.ld])
|
||||||
|
env.depends("a.out", "linker_script.ld")
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
|
You can pass multiple dependency files to `Environment#depends`:
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
env.depends("my_app", "config/link.ld", "README.txt", *Dir.glob("assets/**/*"))
|
||||||
|
```
|
||||||
|
|
||||||
### Construction Variable Naming
|
### Construction Variable Naming
|
||||||
|
|
||||||
* uppercase strings - the default construction variables that Rscons uses
|
* uppercase strings - the default construction variables that Rscons uses
|
||||||
@@ -406,6 +425,16 @@ http://rubydoc.info/github/holtrop/rscons/frames.
|
|||||||
|
|
||||||
## Release Notes
|
## Release Notes
|
||||||
|
|
||||||
|
### v1.9.2
|
||||||
|
|
||||||
|
- allow phony targets in conjunction with build roots
|
||||||
|
|
||||||
|
### v1.9.1
|
||||||
|
|
||||||
|
- change *SUFFIX defaults to arrays
|
||||||
|
- add various C++ file suffixes
|
||||||
|
- use ${INCPREFIX} instead of hard-coded "-I" in Preprocess builder
|
||||||
|
|
||||||
### v1.9.0
|
### v1.9.0
|
||||||
|
|
||||||
#### New Features
|
#### New Features
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ module Rscons
|
|||||||
# @return [Hash] Default construction variables for the builder.
|
# @return [Hash] Default construction variables for the builder.
|
||||||
def default_variables(env)
|
def default_variables(env)
|
||||||
{
|
{
|
||||||
'OBJSUFFIX' => '.o',
|
'OBJSUFFIX' => ['.o'],
|
||||||
'DEPFILESUFFIX' => '.mf',
|
'DEPFILESUFFIX' => '.mf',
|
||||||
|
|
||||||
'CPPDEFPREFIX' => '-D',
|
'CPPDEFPREFIX' => '-D',
|
||||||
@@ -26,7 +26,7 @@ module Rscons
|
|||||||
|
|
||||||
'AS' => '${CC}',
|
'AS' => '${CC}',
|
||||||
'ASFLAGS' => [],
|
'ASFLAGS' => [],
|
||||||
'ASSUFFIX' => '.S',
|
'ASSUFFIX' => ['.S'],
|
||||||
'ASPPPATH' => '${CPPPATH}',
|
'ASPPPATH' => '${CPPPATH}',
|
||||||
'ASPPFLAGS' => '${CPPFLAGS}',
|
'ASPPFLAGS' => '${CPPFLAGS}',
|
||||||
'ASDEPGEN' => ['-MMD', '-MF', '${_DEPFILE}'],
|
'ASDEPGEN' => ['-MMD', '-MF', '${_DEPFILE}'],
|
||||||
@@ -40,19 +40,19 @@ module Rscons
|
|||||||
|
|
||||||
'CC' => 'gcc',
|
'CC' => 'gcc',
|
||||||
'CFLAGS' => [],
|
'CFLAGS' => [],
|
||||||
'CSUFFIX' => '.c',
|
'CSUFFIX' => ['.c'],
|
||||||
'CCDEPGEN' => ['-MMD', '-MF', '${_DEPFILE}'],
|
'CCDEPGEN' => ['-MMD', '-MF', '${_DEPFILE}'],
|
||||||
'CCCMD' => ['${CC}', '-c', '-o', '${_TARGET}', '${CCDEPGEN}', '${INCPREFIX}${CPPPATH}', '${CPPFLAGS}', '${CFLAGS}', '${CCFLAGS}', '${_SOURCES}'],
|
'CCCMD' => ['${CC}', '-c', '-o', '${_TARGET}', '${CCDEPGEN}', '${INCPREFIX}${CPPPATH}', '${CPPFLAGS}', '${CFLAGS}', '${CCFLAGS}', '${_SOURCES}'],
|
||||||
|
|
||||||
'CXX' => 'g++',
|
'CXX' => 'g++',
|
||||||
'CXXFLAGS' => [],
|
'CXXFLAGS' => [],
|
||||||
'CXXSUFFIX' => '.cc',
|
'CXXSUFFIX' => ['.cc', '.cpp', '.cxx', '.C'],
|
||||||
'CXXDEPGEN' => ['-MMD', '-MF', '${_DEPFILE}'],
|
'CXXDEPGEN' => ['-MMD', '-MF', '${_DEPFILE}'],
|
||||||
'CXXCMD' =>['${CXX}', '-c', '-o', '${_TARGET}', '${CXXDEPGEN}', '${INCPREFIX}${CPPPATH}', '${CPPFLAGS}', '${CXXFLAGS}', '${CCFLAGS}', '${_SOURCES}'],
|
'CXXCMD' =>['${CXX}', '-c', '-o', '${_TARGET}', '${CXXDEPGEN}', '${INCPREFIX}${CPPPATH}', '${CPPFLAGS}', '${CXXFLAGS}', '${CCFLAGS}', '${_SOURCES}'],
|
||||||
|
|
||||||
'DC' => 'gdc',
|
'DC' => 'gdc',
|
||||||
'DFLAGS' => [],
|
'DFLAGS' => [],
|
||||||
'DSUFFIX' => '.d',
|
'DSUFFIX' => ['.d'],
|
||||||
'D_IMPORT_PATH' => [],
|
'D_IMPORT_PATH' => [],
|
||||||
'DCCMD' => ['${DC}', '-c', '-o', '${_TARGET}', '${INCPREFIX}${D_IMPORT_PATH}', '${DFLAGS}', '${_SOURCES}'],
|
'DCCMD' => ['${DC}', '-c', '-o', '${_TARGET}', '${INCPREFIX}${D_IMPORT_PATH}', '${DFLAGS}', '${_SOURCES}'],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ module Rscons
|
|||||||
{
|
{
|
||||||
"CPP_CMD" => %w[
|
"CPP_CMD" => %w[
|
||||||
${_PREPROCESS_CC} -E ${_PREPROCESS_DEPGEN}
|
${_PREPROCESS_CC} -E ${_PREPROCESS_DEPGEN}
|
||||||
-o ${_TARGET} -I${CPPPATH} ${CPPFLAGS} ${_SOURCES}],
|
-o ${_TARGET} ${INCPREFIX}${CPPPATH} ${CPPFLAGS} ${_SOURCES}],
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -509,7 +509,11 @@ module Rscons
|
|||||||
#
|
#
|
||||||
# @return [String] The expanded path.
|
# @return [String] The expanded path.
|
||||||
def expand_path(path)
|
def expand_path(path)
|
||||||
path.sub(%r{^\^(?=[\\/])}, @build_root)
|
if Rscons.phony_target?(path)
|
||||||
|
path
|
||||||
|
else
|
||||||
|
path.sub(%r{^\^(?=[\\/])}, @build_root)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Execute a command using the system shell.
|
# Execute a command using the system shell.
|
||||||
@@ -614,8 +618,6 @@ module Rscons
|
|||||||
elsif word == "-pthread"
|
elsif word == "-pthread"
|
||||||
append["CCFLAGS", [word]]
|
append["CCFLAGS", [word]]
|
||||||
append["LDFLAGS", [word]]
|
append["LDFLAGS", [word]]
|
||||||
elsif word =~ /^-std=/
|
|
||||||
append["CFLAGS", [word]]
|
|
||||||
elsif word =~ /^-Wa,(.*)$/
|
elsif word =~ /^-Wa,(.*)$/
|
||||||
append["ASFLAGS", $1.split(",")]
|
append["ASFLAGS", $1.split(",")]
|
||||||
elsif word =~ /^-Wl,(.*)$/
|
elsif word =~ /^-Wl,(.*)$/
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
module Rscons
|
module Rscons
|
||||||
# gem version
|
# gem version
|
||||||
VERSION = "1.9.0"
|
VERSION = "1.9.3"
|
||||||
end
|
end
|
||||||
+25
-22
@@ -933,33 +933,36 @@ EOF
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "phony targets" do
|
context "phony targets" do
|
||||||
it "allows specifying a Symbol as a target name and reruns the builder if the sources or command have changed" do
|
[false, true].each do |with_build_root|
|
||||||
test_dir("simple")
|
it "allows specifying a Symbol as a target name and reruns the builder if the sources or command have changed" do
|
||||||
env = Rscons::Environment.new do |env|
|
test_dir("simple")
|
||||||
env.add_builder(:Checker) do |target, sources, cache, env, vars|
|
env = Rscons::Environment.new do |env|
|
||||||
unless cache.up_to_date?(target, :Checker, sources, env)
|
env.build_root = "bld" if with_build_root
|
||||||
puts "Checker #{sources.first}" if env.echo != :off
|
env.add_builder(:Checker) do |target, sources, cache, env, vars|
|
||||||
cache.register_build(target, :Checker, sources, env)
|
unless cache.up_to_date?(target, :Checker, sources, env)
|
||||||
|
puts "Checker #{sources.first}" if env.echo != :off
|
||||||
|
cache.register_build(target, :Checker, sources, env)
|
||||||
|
end
|
||||||
|
target
|
||||||
end
|
end
|
||||||
target
|
env.Program("simple.exe", "simple.c")
|
||||||
|
env.Checker(:checker, "simple.exe")
|
||||||
end
|
end
|
||||||
env.Program("simple.exe", "simple.c")
|
expect(lines).to eq(["CC #{with_build_root ? 'bld/' : ''}simple.o", "LD simple.exe", "Checker simple.exe"])
|
||||||
env.Checker(:checker, "simple.exe")
|
|
||||||
end
|
|
||||||
expect(lines).to eq(["CC simple.o", "LD simple.exe", "Checker simple.exe"])
|
|
||||||
|
|
||||||
env.clone do |env|
|
env.clone do |env|
|
||||||
env.Checker(:checker, "simple.exe")
|
env.Checker(:checker, "simple.exe")
|
||||||
end
|
end
|
||||||
expect(lines).to eq([])
|
expect(lines).to eq([])
|
||||||
|
|
||||||
File.open("simple.exe", "w") do |fh|
|
File.open("simple.exe", "w") do |fh|
|
||||||
fh.puts "Changed simple.exe"
|
fh.puts "Changed simple.exe"
|
||||||
|
end
|
||||||
|
env.clone do |env|
|
||||||
|
env.Checker(:checker, "simple.exe")
|
||||||
|
end
|
||||||
|
expect(lines).to eq(["Checker simple.exe"])
|
||||||
end
|
end
|
||||||
env.clone do |env|
|
|
||||||
env.Checker(:checker, "simple.exe")
|
|
||||||
end
|
|
||||||
expect(lines).to eq(["Checker simple.exe"])
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -396,24 +396,23 @@ module Rscons
|
|||||||
describe "#parse_flags" do
|
describe "#parse_flags" do
|
||||||
it "executes the shell command and parses the returned flags when the input argument begins with !" do
|
it "executes the shell command and parses the returned flags when the input argument begins with !" do
|
||||||
env = Environment.new
|
env = Environment.new
|
||||||
env["CFLAGS"] = ["-g"]
|
env["CCFLAGS"] = ["-g"]
|
||||||
expect(env).to receive(:shell).with("my_command").and_return(%[-arch my_arch -Done=two -include ii -isysroot sr -Iincdir -Llibdir -lmy_lib -mno-cygwin -mwindows -pthread -std=c99 -Wa,'asm,args 1 2' -Wl,linker,"args 1 2" -Wp,cpp,args,1,2 -arbitrary +other_arbitrary some_lib /a/b/c/lib])
|
expect(env).to receive(:shell).with("my_command").and_return(%[-arch my_arch -Done=two -include ii -isysroot sr -Iincdir -Llibdir -lmy_lib -mno-cygwin -mwindows -pthread -std=c99 -Wa,'asm,args 1 2' -Wl,linker,"args 1 2" -Wp,cpp,args,1,2 -arbitrary +other_arbitrary some_lib /a/b/c/lib])
|
||||||
rv = env.parse_flags("!my_command")
|
rv = env.parse_flags("!my_command")
|
||||||
expect(rv).to eq({
|
expect(rv).to eq({
|
||||||
"CCFLAGS" => %w[-arch my_arch -include ii -isysroot sr -mno-cygwin -pthread -arbitrary +other_arbitrary],
|
"CCFLAGS" => %w[-arch my_arch -include ii -isysroot sr -mno-cygwin -pthread -std=c99 -arbitrary +other_arbitrary],
|
||||||
"LDFLAGS" => %w[-arch my_arch -isysroot sr -mno-cygwin -mwindows -pthread] + ["linker", "args 1 2"] + %w[+other_arbitrary],
|
"LDFLAGS" => %w[-arch my_arch -isysroot sr -mno-cygwin -mwindows -pthread] + ["linker", "args 1 2"] + %w[+other_arbitrary],
|
||||||
"CPPPATH" => %w[incdir],
|
"CPPPATH" => %w[incdir],
|
||||||
"LIBS" => %w[my_lib some_lib /a/b/c/lib],
|
"LIBS" => %w[my_lib some_lib /a/b/c/lib],
|
||||||
"LIBPATH" => %w[libdir],
|
"LIBPATH" => %w[libdir],
|
||||||
"CPPDEFINES" => %w[one=two],
|
"CPPDEFINES" => %w[one=two],
|
||||||
"CFLAGS" => %w[-std=c99],
|
|
||||||
"ASFLAGS" => ["asm", "args 1 2"],
|
"ASFLAGS" => ["asm", "args 1 2"],
|
||||||
"CPPFLAGS" => %w[cpp args 1 2],
|
"CPPFLAGS" => %w[cpp args 1 2],
|
||||||
})
|
})
|
||||||
expect(env["CFLAGS"]).to eq(["-g"])
|
expect(env["CCFLAGS"]).to eq(["-g"])
|
||||||
expect(env["ASFLAGS"]).to eq([])
|
expect(env["ASFLAGS"]).to eq([])
|
||||||
env.merge_flags(rv)
|
env.merge_flags(rv)
|
||||||
expect(env["CFLAGS"]).to eq(["-g", "-std=c99"])
|
expect(env["CCFLAGS"]).to eq(%w[-g -arch my_arch -include ii -isysroot sr -mno-cygwin -pthread -std=c99 -arbitrary +other_arbitrary])
|
||||||
expect(env["ASFLAGS"]).to eq(["asm", "args 1 2"])
|
expect(env["ASFLAGS"]).to eq(["asm", "args 1 2"])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in new issue
Block a user