]> git.tdb.fi Git - builder.git/blobdiff - source/sourcefile.cpp
Add install component type
[builder.git] / source / sourcefile.cpp
index a5cacce44e92b2df956c1f593bcab082aee8fba5..7425a0f132c893c0448d0954993c1bde0321262f 100644 (file)
@@ -5,9 +5,9 @@ Copyright © 2006-2009  Mikko Rasa, Mikkosoft Productions
 Distributed under the LGPL
 */
 
-#include <iostream>
 #include <msp/fs/utils.h>
 #include <msp/io/except.h>
+#include <msp/io/print.h>
 #include <msp/strings/regex.h>
 #include "builder.h"
 #include "component.h"
@@ -17,15 +17,23 @@ Distributed under the LGPL
 using namespace std;
 using namespace Msp;
 
-SourceFile::SourceFile(Builder &b, const Component *c, const FS::Path &p):
-       FileTarget(b, (c ? &c->get_package() : 0), p),
-       comp(c)
+SourceFile::SourceFile(Builder &b, const FS::Path &p):
+       FileTarget(b, 0, p),
+       comp(0)
+{ }
+
+SourceFile::SourceFile(Builder &b, const Component &c, const FS::Path &p):
+       FileTarget(b, &c.get_package(), p),
+       comp(&c)
 { }
 
 void SourceFile::find_depends()
 {
        if(!comp)
+       {
+               deps_ready=true;
                return;
+       }
 
        const SourcePackage &spkg=comp->get_package();
        string relname=FS::relative(name, spkg.get_source()).str();
@@ -49,7 +57,7 @@ void SourceFile::find_depends()
                        IO::BufferedFile in(name);
 
                        if(builder.get_verbose()>=4)
-                               cout<<"Reading includes from "<<name<<'\n';
+                               IO::print("Reading includes from %s\n", name);
 
                        Regex r_include("^[ \t]*#include[ \t]+([\"<].*)[\">]");
 
@@ -62,6 +70,7 @@ void SourceFile::find_depends()
                }
                catch(const IO::FileNotFound &)
                {
+                       // XXX WTF?
                        return;
                }
        }