1 #include <msp/path/utils.h>
6 #include "objectfile.h"
12 Compile::Compile(Builder &b, const ObjectFile &obj):
15 const Component &comp=obj.get_component();
17 const TargetList &deps=obj.get_depends();
18 Path::Path spath=deps.front()->get_name();
20 string ext=Path::splitext(spath.str()).ext;
22 if(ext==".cpp" || ext==".cc")
27 argv.push_back(builder.get_tool(tool, obj.get_package()->get_arch()));
30 const BuildInfo &binfo=comp.get_build_info();
31 for(list<string>::const_iterator i=binfo.cflags.begin(); i!=binfo.cflags.end(); ++i)
33 for(list<string>::const_iterator i=binfo.incpath.begin(); i!=binfo.incpath.end(); ++i)
34 argv.push_back("-I"+*i);
35 for(list<string>::const_iterator i=binfo.defines.begin(); i!=binfo.defines.end(); ++i)
36 argv.push_back("-D"+*i);
38 Path::Path opath=obj.get_name();
40 argv.push_back(opath.str());
41 argv.push_back(spath.str());
43 if(!builder.get_dry_run())
44 Path::mkpath(opath.subpath(0, opath.size()-1), 0755);
46 announce(comp.get_package().get_name(), tool, relative(opath, comp.get_package().get_source()).str());