Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
Rake: How do I Override Var's Used by a Rule?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Brock Rycenga, post: 4622106"] All: For our rakefile system, we would like to have the ability to build either a "debug" version of our code, or a "release" version. My plan is to have 2 separate high-level tasks, where one of them invokes the other - except with overridden variables. I wish I knew how to do this. ;-) Please help. Here are my tasks (edited for brevity): ============================= task :debug_build => [:build_depend, :build_obj] do # handle the linking end task :release_build do # Invoke the debug_build task, but override the following var's: # C_OPTIMIZE_LVL="-o2" # C_DEBUG="" end ============================= My .c -> .obj rule looks like this: ============================= rule ".#{OBJ_EXT}" => lambda{|objfile| find_source(objfile)} do |t| sh "#{COMPILER} #{C_OPTS} #{C_DEBUG} #{C_OPTIMIZE_LVL} #{C_OBJ_DIR} #{C_INC_PATHS} #{C_FLAGS} #{C_TARGET} #{t.source}" end ============================= So the only difference between the debug_build and release_build tasks is the compile line. NOTE: I currently read those variables (COMPILER, C_OPTS, etc.) from another rakefile. Any suggestions? Am I going about this the wrong way? Thanks, Brock [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
Rake: How do I Override Var's Used by a Rule?
Top