]> git.tdb.fi Git - builder.git/blobdiff - source/executable.cpp
Add profile templates
[builder.git] / source / executable.cpp
index 1f23990da93ca569af5476a7032a468d597549d4..db8bd11db0b3c832790d3cbdbef4d2f717ad80fd 100644 (file)
@@ -28,8 +28,8 @@ void Executable::find_depends()
 {
        LibMode libmode=package->get_library_mode();
        
-       //XXX Duplicate libraries?
        list<const Component *> queue;
+       list<Target *> dep_libs;
        queue.push_back(&comp);
        while(!queue.empty())
        {
@@ -44,7 +44,8 @@ void Executable::find_depends()
                        {
                                if(contains(depends, lib))
                                        continue;
-                               add_depend(lib);
+
+                               dep_libs.push_front(lib);
 
                                if(dynamic_cast<Install *>(lib))
                                        lib=lib->get_depends().front();
@@ -57,6 +58,9 @@ void Executable::find_depends()
                }
        }
 
+       for(list<Target *>::iterator i=dep_libs.begin(); i!=dep_libs.end(); ++i)
+               add_depend(*i);
+
        deps_ready=true;
 }
 
@@ -72,11 +76,22 @@ we need to pass the value to the Target c'tor.
 string Executable::generate_target_name(const Component &c)
 {
        string prefix,suffix;
+       const string &arch=c.get_package().get_arch();
 
        if(c.get_type()==Component::LIBRARY)
        {
                prefix="lib";
-               suffix=".so";
+               if(arch=="win32")
+                       suffix=".dll";
+               else
+                       suffix=".so";
+       }
+       else if(c.get_type()==Component::MODULE)
+               suffix=".m";
+       else if(c.get_type()==Component::PROGRAM)
+       {
+               if(arch=="win32")
+                       suffix=".exe";
        }
 
        return (c.get_package().get_out_dir()/(prefix+c.get_name()+suffix)).str();