1 #include <msp/fs/dir.h>
2 #include <msp/fs/utils.h>
7 #include "objectfile.h"
8 #include "sourcefile.h"
9 #include "sourcepackage.h"
14 Compile::Compile(Builder &b, const ObjectFile &obj):
17 const Component &comp = obj.get_component();
19 work_dir = comp.get_package().get_source();
21 FS::Path spath = obj.get_source().get_path();
23 string ext = FS::extpart(spath.str());
25 if(ext==".cpp" || ext==".cc")
30 argv.push_back(builder.get_current_arch().get_tool(tool));
33 const BuildInfo &binfo = comp.get_build_info();
34 for(list<string>::const_iterator i=binfo.warnings.begin(); i!=binfo.warnings.end(); ++i)
35 argv.push_back("-W"+*i);
36 for(list<string>::const_iterator i=binfo.cflags.begin(); i!=binfo.cflags.end(); ++i)
38 for(list<string>::const_iterator i=binfo.incpath.begin(); i!=binfo.incpath.end(); ++i)
39 argv.push_back("-I"+*i);
40 for(list<string>::const_iterator i=binfo.defines.begin(); i!=binfo.defines.end(); ++i)
41 argv.push_back("-D"+*i);
43 FS::Path opath = obj.get_path();
45 argv.push_back(relative(opath, work_dir).str());
46 argv.push_back(relative(spath, work_dir).str());
48 if(!builder.get_dry_run())
49 FS::mkpath(FS::dirname(opath), 0755);
51 announce(comp.get_package().get_name(), tool, basename(opath));