comparison rakefile @ 59:7e0547d89731

Debug builds
author Frank Benoit <benoit@tionex.de>
date Mon, 30 Mar 2009 12:09:37 +0200
parents e2ca9bdc80f2
children 66be6a990713
comparison
equal deleted inserted replaced
58:8a5386b204bb 59:7e0547d89731
90 90
91 91
92 ########################################################################## 92 ##########################################################################
93 # Routines 93 # Routines
94 # 94 #
95 95 def isDebug
96 if ENV['DEBUG']
97 ENV['DEBUG'] == "1"
98 else
99 false
100 end
101 end
96 def buildTree( basedir, srcdir, resdir, dcargs=nil, libname=nil ) 102 def buildTree( basedir, srcdir, resdir, dcargs=nil, libname=nil )
97 if libname == nil 103 if libname == nil
98 libname = basedir 104 libname = basedir
99 end 105 end
100 puts "Building #{libname}" 106 dbg_str = "";
107 if isDebug
108 dbg_str = "Debug "
109 end
110 puts "#{dbg_str}Building #{libname}"
101 111
102 resdir_abs = File.expand_path( File.join( basedir, resdir )) 112 resdir_abs = File.expand_path( File.join( basedir, resdir ))
103 srcdir_abs = File.expand_path( File.join( basedir, srcdir )) 113 srcdir_abs = File.expand_path( File.join( basedir, srcdir ))
104 114
105 FileUtils.mkdir_p DIR_IMP 115 FileUtils.mkdir_p DIR_IMP
117 ALL_RESDIRS.each do | dir | 127 ALL_RESDIRS.each do | dir |
118 rsp.puts "-J#{File.expand_path(dir).to_path}" 128 rsp.puts "-J#{File.expand_path(dir).to_path}"
119 end 129 end
120 rsp.puts "-c" 130 rsp.puts "-c"
121 rsp.puts "-op" 131 rsp.puts "-op"
132 if isDebug
133 rsp.puts "-debug"
134 rsp.puts "-g"
135 end
122 Find.find( srcdir_abs ) do |path| 136 Find.find( srcdir_abs ) do |path|
123 if path =~ /\.d$/ then 137 if path =~ /\.d$/ then
124 rsp.puts path.to_path[ srcdir_abs.size+1 .. -1 ] 138 rsp.puts path.to_path[ srcdir_abs.size+1 .. -1 ]
125 end 139 end
126 end 140 end
133 cmd = "cat #{FILE_RSP.to_path} | xargs #{PROG_DMD}" 147 cmd = "cat #{FILE_RSP.to_path} | xargs #{PROG_DMD}"
134 end 148 end
135 sh cmd, :verbose => false do |ok, res| 149 sh cmd, :verbose => false do |ok, res|
136 if !ok then 150 if !ok then
137 Find.find( srcdir_abs ) do |path| 151 Find.find( srcdir_abs ) do |path|
152 if FileTest.file?(path) && path =~ /\.o(bj)?$/ then
153 FileUtils.rm path
154 end
138 if FileTest.file?(path) && path =~ /\.di$/ then 155 if FileTest.file?(path) && path =~ /\.di$/ then
139 FileUtils.rm path 156 FileUtils.rm path
140 end 157 end
141 end 158 end
142 159
204 221
205 rsp = File.new( FILE_RSP, "w+" ) 222 rsp = File.new( FILE_RSP, "w+" )
206 rsp.puts "-I#{srcdir_abs.to_path}" 223 rsp.puts "-I#{srcdir_abs.to_path}"
207 rsp.puts "-I#{DIR_IMP.to_path}" 224 rsp.puts "-I#{DIR_IMP.to_path}"
208 rsp.puts "-J#{resdir_abs.to_path}" 225 rsp.puts "-J#{resdir_abs.to_path}"
226 if isDebug
227 rsp.puts "-debug"
228 rsp.puts "-g"
229 end
209 if dflags.size > 0 then 230 if dflags.size > 0 then
210 rsp.puts dflags 231 rsp.puts dflags
211 end 232 end
212 ALL_RESDIRS.each do | dir | 233 ALL_RESDIRS.each do | dir |
213 rsp.puts "-J#{File.expand_path(dir).to_path}" 234 rsp.puts "-J#{File.expand_path(dir).to_path}"