[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    icecream/client
From:       Stephan Kulow <coolo () kde ! org>
Date:       2011-02-21 15:01:36
Message-ID: 20110221150136.72AFAAC8BF () svn ! kde ! org
[Download RAW message or body]

SVN commit 1222062 by coolo:

From: Torbjörn Svensson

As I told you on IRC, I've found a bug in icecream related to .d  
files. If you have -MD (or -MMD) and icecream should distribute the  
job, then the .d will be creaded in the source tree and that's not  
always what you want. My patch puts the .d file in the same directory  
as the GCC would have done if invoked. The trick I'm using is to put  
the -MF option in the local flags so that the .d file will be placed  
in the target tree while the pre-processed C/C++ file is still dumped  
on stdout.


 M  +20 -2     arg.cpp  


--- trunk/icecream/client/arg.cpp #1222061:1222062
@@ -106,6 +106,8 @@
     bool always_local = analyze_program(had_cc ? job.compilerName().c_str() : argv[0], job);
     bool seen_c = false;
     bool seen_s = false;
+    bool seen_mf = false;
+    bool seen_md = false;
     if( icerun ) {
         always_local = true;
         job.setLanguage( CompileJob::Lang_Custom );
@@ -121,6 +123,7 @@
                 always_local = true;
                 args.append(a, Arg_Local);
             } else if (!strcmp(a, "-MD") || !strcmp(a, "-MMD")) {
+            	  seen_md = true;
                 args.append(a, Arg_Local);
                 /* These two generate dependencies as a side effect.  They
                  * should work with the way we call cpp. */
@@ -128,11 +131,15 @@
                 args.append(a, Arg_Local);
                 /* These just modify the behaviour of other -M* options and do
                  * nothing by themselves. */
-            } else if (!strcmp(a, "-MF") || !strcmp(a, "-MT") ||
-                       !strcmp(a, "-MQ")) {
+            } else if (!strcmp(a, "-MF")) {
+        	      seen_mf = true;
                 args.append(a, Arg_Local);
                 args.append( argv[++i], Arg_Local );
                 /* as above but with extra argument */
+            } else if (!strcmp(a, "-MT") || !strcmp(a, "-MQ")) {
+                args.append(a, Arg_Local);
+                args.append( argv[++i], Arg_Local );
+                /* as above but with extra argument */
             } else if (a[1] == 'M') {
                 /* -M(anything else) causes the preprocessor to
                     produce a list of make-style dependencies on
@@ -372,7 +379,18 @@
                 if ( slash != string::npos )
                     ofile = ofile.substr( slash + 1 );
             }
+
+            if ( !always_local && seen_md && !seen_mf) {
+        	      string dfile = ofile.substr( 0, ofile.find_last_of( '.' ) ) + ".d";
+
+#if CLIENT_DEBUG
+                log_info() << "dep file: " << dfile << endl;
+#endif
+
+                args.append("-MF", Arg_Local);
+                args.append(dfile, Arg_Local);
         }
+        }
 
     } else {
         job.setInputFile( string() );
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic