]> git.tdb.fi Git - builder.git/blobdiff - source/compile.cpp
Make warnings configurable through build_info and command line
[builder.git] / source / compile.cpp
index 53802639dae7786675aff8e9ff994582bed2334b..c98353ba04cc6726dc171c9a84bf30380a70aee0 100644 (file)
@@ -21,6 +21,8 @@ Compile::Compile(Builder &b, const ObjectFile &obj):
 {
        const Component &comp=obj.get_component();
 
+       work_dir=comp.get_package().get_source();
+
        const TargetList &deps=obj.get_depends();
        Path spath=deps.front()->get_name();
 
@@ -35,6 +37,8 @@ Compile::Compile(Builder &b, const ObjectFile &obj):
        argv.push_back("-c");
 
        const BuildInfo &binfo=comp.get_build_info();
+       for(list<string>::const_iterator i=binfo.warnings.begin(); i!=binfo.warnings.end(); ++i)
+               argv.push_back("-W"+*i);
        for(list<string>::const_iterator i=binfo.cflags.begin(); i!=binfo.cflags.end(); ++i)
                argv.push_back(*i);
        for(list<string>::const_iterator i=binfo.incpath.begin(); i!=binfo.incpath.end(); ++i)
@@ -44,13 +48,13 @@ Compile::Compile(Builder &b, const ObjectFile &obj):
 
        Path opath=obj.get_name();
        argv.push_back("-o");
-       argv.push_back(opath.str());
-       argv.push_back(spath.str());
+       argv.push_back(relative(opath, work_dir).str());
+       argv.push_back(relative(spath, work_dir).str());
 
        if(!builder.get_dry_run())
                mkpath(opath.subpath(0, opath.size()-1), 0755);
 
-       announce(comp.get_package().get_name(), tool, relative(opath, comp.get_package().get_source()).str());
+       announce(comp.get_package().get_name(), tool, relative(opath, work_dir).str());
 
        launch();
 }