]> git.tdb.fi Git - builder.git/blobdiff - source/gnucompiler.cpp
Implement PackageManager::get_package
[builder.git] / source / gnucompiler.cpp
index e2c5c0e71a494e7bb11079a5be0f76725f135b93..a3052df1a6d4a4b2041ec5940e75239d4f6ffccf 100644 (file)
@@ -20,6 +20,8 @@ GnuCompiler::GnuCompiler(Builder &b, const Architecture &a, const string &t, con
        if(architecture->is_cross())
                command = format("%s-%s", architecture->get_cross_prefix(), command);
        executable = builder.get_vfs().find_binary(command);
+       if(!executable)
+               builder.problem(string(), format("Can't find executable %s for tool %s", command, tag));
 
        if(architecture->is_native())
                system_path.push_back("/usr/include");
@@ -37,6 +39,25 @@ Target *GnuCompiler::create_target(const list<Target *> &sources, const string &
        return obj;
 }
 
+string GnuCompiler::create_build_signature(const BuildInfo &binfo) const
+{
+       string result = FS::basename(executable->get_path());
+       if(!architecture->get_cpu().empty())
+       {
+               result += ",m";
+               result += architecture->get_cpu();
+       }
+       result += ',';
+       if(binfo.debug)
+               result += 'g';
+       if(binfo.optimize)
+       {
+               result += 'O';
+               result += (binfo.optimize>0 ? '0'+binfo.optimize : 's');
+       }
+       return result;
+}
+
 Task *GnuCompiler::run(const Target &target) const
 {
        const ObjectFile &object = dynamic_cast<const ObjectFile &>(target);
@@ -60,7 +81,6 @@ Task *GnuCompiler::run(const Target &target) const
                        argv.push_back("-pedantic");
                        argv.push_back("-Wno-long-long");
                        argv.push_back("-Wshadow");
-                       argv.push_back("-Winline");
                        if(tag=="CC")
                        {
                                argv.push_back("-Wc++-compat");
@@ -74,6 +94,7 @@ Task *GnuCompiler::run(const Target &target) const
                        argv.push_back("-Wfloat-equal");
                        argv.push_back("-Wconversion");
                        argv.push_back("-Wwrite-strings");
+                       argv.push_back("-Winline");
                }
                if(binfo.fatal_warnings)
                        argv.push_back("-Werror");
@@ -117,8 +138,5 @@ Task *GnuCompiler::run(const Target &target) const
        argv.push_back(relative(obj_path, work_dir).str());
        argv.push_back(relative(src_path, work_dir).str());
 
-       if(!builder.get_dry_run())
-               FS::mkpath(FS::dirname(obj_path), 0755);
-
        return new ExternalTask(argv, work_dir);
 }