changeset 59:7e0547d89731

Debug builds
author Frank Benoit <benoit@tionex.de>
date Mon, 30 Mar 2009 12:09:37 +0200
parents 8a5386b204bb
children 66be6a990713
files README.txt rakefile
diffstat 2 files changed, 38 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/README.txt	Sat Mar 28 02:46:49 2009 +0100
+++ b/README.txt	Mon Mar 30 12:09:37 2009 +0200
@@ -20,3 +20,18 @@
 LIB="%@P%\..\..\..\..\tango\lib"
 DFLAGS="-I%@P%\..\..\..\..\tango" -version=Tango -defaultlib=tango-base-dmd.lib -debuglib=tango-base-dmd.lib 
 
+To show the available Rake targets use:
+$ rake -T
+
+To build for example the SWT you need:
+$ rake base swt
+
+To enable debug build (symbols for debugging):
+$ rake DEBUG=1 base swt
+Alternatively you can set the environment variable DEBUG to '1'.
+
+The example targets build a whole collection of examples.
+To build an indiviual snippet from swtsnippets, do:
+$ rake swtsnippets[Snippet107]
+
+
--- a/rakefile	Sat Mar 28 02:46:49 2009 +0100
+++ b/rakefile	Mon Mar 30 12:09:37 2009 +0200
@@ -92,12 +92,22 @@
 ##########################################################################
 # Routines
 #
-
+def isDebug
+    if ENV['DEBUG']
+        ENV['DEBUG'] == "1"
+    else
+        false
+    end
+end
 def buildTree( basedir, srcdir, resdir, dcargs=nil, libname=nil )
     if libname == nil
         libname = basedir
     end
-    puts "Building #{libname}"
+    dbg_str = "";
+    if isDebug
+        dbg_str = "Debug "
+    end
+    puts "#{dbg_str}Building #{libname}"
 
     resdir_abs = File.expand_path( File.join( basedir, resdir ))
     srcdir_abs = File.expand_path( File.join( basedir, srcdir ))
@@ -119,6 +129,10 @@
     end
     rsp.puts "-c"
     rsp.puts "-op"
+    if isDebug
+        rsp.puts "-debug"
+        rsp.puts "-g"
+    end
     Find.find( srcdir_abs ) do |path|
         if path =~ /\.d$/ then
             rsp.puts path.to_path[ srcdir_abs.size+1 .. -1 ]
@@ -135,6 +149,9 @@
         sh cmd, :verbose => false do |ok, res|
             if !ok then
                 Find.find( srcdir_abs ) do |path|
+                    if FileTest.file?(path) && path =~ /\.o(bj)?$/ then
+                        FileUtils.rm path
+                    end
                     if FileTest.file?(path) && path =~ /\.di$/ then
                         FileUtils.rm path
                     end
@@ -206,6 +223,10 @@
     rsp.puts "-I#{srcdir_abs.to_path}"
     rsp.puts "-I#{DIR_IMP.to_path}"
     rsp.puts "-J#{resdir_abs.to_path}"
+    if isDebug
+        rsp.puts "-debug"
+        rsp.puts "-g"
+    end
     if dflags.size > 0 then
         rsp.puts dflags
     end