]> git.tdb.fi Git - builder.git/blobdiff - source/builder.cpp
Fix compile errors on 64-bit systems
[builder.git] / source / builder.cpp
index 9db904a8d805af19a323f6d68ffe319b7343d819..5fb918c512a8e3ce7fc95b023a2dcc2a43a55108 100644 (file)
@@ -124,7 +124,7 @@ Builder::Builder(int argc, char **argv):
        const vector<string> &args=getopt.get_args();
        for(vector<string>::const_iterator i=args.begin(); i!=args.end(); ++i)
        {
-               unsigned equal=i->find('=');
+               string::size_type equal=i->find('=');
                if(equal!=string::npos)
                        cmdline_options.insert(StringMap::value_type(i->substr(0, equal), i->substr(equal+1)));
                else
@@ -152,7 +152,7 @@ Builder::Builder(int argc, char **argv):
        native_arch->set_tool("AR",  "ar");
 
        load_build_file((FS::get_sys_data_dir(argv[0], "builder")/"builderrc").str());
-       load_build_file((FS::get_home_dir()/".builderrc").str());
+       load_build_file((FS::get_user_data_dir("builder")/"rc").str());
 
        if(arch.empty())
                current_arch=native_arch;
@@ -258,19 +258,19 @@ int Builder::main()
                        if(dynamic_cast<SourcePackage *>(*i))
                                IO::print("*");
                        unsigned count=0;
-                       unsigned ood_count=0;
+                       unsigned to_be_built=0;
                        for(TargetMap::iterator j=targets.begin(); j!=targets.end(); ++j)
                                if(j->second->get_package()==*i)
                                {
                                        ++count;
                                        if(j->second->get_rebuild())
-                                               ++ood_count;
+                                               ++to_be_built;
                                }
                        if(count)
                        {
                                IO::print(" (%d targets", count);
-                               if(ood_count)
-                                       IO::print(", %d out-of-date", ood_count);
+                               if(to_be_built)
+                                       IO::print(", %d to be built", to_be_built);
                                IO::print(")");
                        }
                        IO::print("\n");
@@ -285,7 +285,8 @@ int Builder::main()
                IO::print(IO::cerr, "The following problems were detected:\n");
                for(ProblemList::iterator i=problems.begin(); i!=problems.end(); ++i)
                        IO::print(IO::cerr, "  %s: %s\n", i->package, i->descr);
-               IO::print(IO::cerr, "Please fix them and try again.\n");
+               if(!analyzer)
+                       IO::print(IO::cerr, "Please fix them and try again.\n");
                return 1;
        }
 
@@ -386,7 +387,7 @@ Target *Builder::get_header(const string &include, const FS::Path &from, const l
                cxx_ver=Regex("[0-9]\\.[0-9.]+").match(run_command(argv))[0].str;
                while(!cxx_ver.empty() && !FS::is_dir(FS::Path("/usr/include/c++")/cxx_ver))
                {
-                       unsigned dot=cxx_ver.rfind('.');
+                       string::size_type dot=cxx_ver.rfind('.');
                        if(dot==string::npos)
                                break;
                        cxx_ver.erase(dot);
@@ -640,18 +641,7 @@ int Builder::create_targets()
                cmdline->add_depend(tgt);
        }
 
-       /* If world is to be built, prepare cmdline.  If not, add cmdline to world
-       and prepare world.  I don't really like this, but it keeps the graph
-       acyclic.
-       
-       XXX Could we skip preparing targets we are not interested in? */
-       if(build_world)
-               cmdline->prepare();
-       else
-       {
-               world->add_depend(cmdline);
-               world->prepare();
-       }
+       cmdline->prepare();
 
        for(PackageMap::iterator i=packages.begin(); i!=packages.end(); ++i)
                if(SourcePackage *spkg=dynamic_cast<SourcePackage *>(i->second))
@@ -660,7 +650,7 @@ int Builder::create_targets()
        return 0;
 }
 
-Target *Builder::get_header(const Msp::FS::Path &fn)
+Target *Builder::get_header(const FS::Path &fn)
 {
        Target *tgt=get_target(fn.str());
        if(tgt) return tgt;
@@ -727,7 +717,11 @@ int Builder::do_build()
 {
        Target *cmdline=get_target("cmdline");
 
-       unsigned total=cmdline->count_rebuild();
+       unsigned total=0;
+       for(map<string, Target *>::const_iterator i=targets.begin(); i!=targets.end(); ++i)
+               if(i->second->is_buildable() && i->second->get_rebuild())
+                       ++total;
+
        if(!total)
        {
                IO::print("Already up to date\n");
@@ -805,7 +799,7 @@ int Builder::do_clean()
                Target *tgt=queue.front();
                queue.erase(queue.begin());
 
-               if(tgt->get_buildable() && (tgt->get_package()==main_pkg || clean>=2))
+               if(tgt->is_buildable() && (tgt->get_package()==main_pkg || clean>=2))
                        clean_tgts.insert(tgt);
 
                const TargetList &deps=tgt->get_depends();