Compare commits

...
4 Commits
Author SHA1 Message Date
josh f33be07a15 v1.9.3 2016-09-30 14:03:35 -04:00
josh c4c2d5c128 Environment#parse_flags should put -std=XXX flags in CCFLAGS, not CFLAGS 2016-09-30 14:02:30 -04:00
josh 3065dc48ec document passing multiple dependencies to env.depends() 2016-05-02 09:10:14 -04:00
josh 9ca2934695 document explicit dependencies 2016-03-02 13:33:00 -05:00
5 changed files with 25 additions and 9 deletions

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
rscons (1.9.2)
rscons (1.9.3)
json (~> 1.0)
GEM
+19
View File
@@ -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
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
* uppercase strings - the default construction variables that Rscons uses
-2
View File
@@ -618,8 +618,6 @@ module Rscons
elsif word == "-pthread"
append["CCFLAGS", [word]]
append["LDFLAGS", [word]]
elsif word =~ /^-std=/
append["CFLAGS", [word]]
elsif word =~ /^-Wa,(.*)$/
append["ASFLAGS", $1.split(",")]
elsif word =~ /^-Wl,(.*)$/
+1 -1
View File
@@ -1,4 +1,4 @@
module Rscons
# gem version
VERSION = "1.9.2"
VERSION = "1.9.3"
end
+4 -5
View File
@@ -396,24 +396,23 @@ module Rscons
describe "#parse_flags" do
it "executes the shell command and parses the returned flags when the input argument begins with !" do
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])
rv = env.parse_flags("!my_command")
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],
"CPPPATH" => %w[incdir],
"LIBS" => %w[my_lib some_lib /a/b/c/lib],
"LIBPATH" => %w[libdir],
"CPPDEFINES" => %w[one=two],
"CFLAGS" => %w[-std=c99],
"ASFLAGS" => ["asm", "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([])
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"])
end
end