X-Git-Url: http://git.tdb.fi/?p=builder.git;a=blobdiff_plain;f=source%2Flib%2Fsourcegenerator.cpp;fp=source%2Flib%2Fsourcegenerator.cpp;h=10567758681876da038a447be8e9eb9f77a4c743;hp=d30a2bc67fdefa3687e6c18193b0c9eaae504c7c;hb=6ce67e1469bf62156ddf64e33644851f9064c6ed;hpb=17783446dddb1a60c5174031c97b13e4d1bc1f8e diff --git a/source/lib/sourcegenerator.cpp b/source/lib/sourcegenerator.cpp index d30a2bc..1056775 100644 --- a/source/lib/sourcegenerator.cpp +++ b/source/lib/sourcegenerator.cpp @@ -1,5 +1,6 @@ #include #include +#include #include "builder.h" #include "executable.h" #include "sourcegenerator.h" @@ -30,21 +31,20 @@ Target *SourceGenerator::create_target(const vector &sources, const st TemplateFile &tmpl = dynamic_cast(*sources.front()); const Component *comp = tmpl.get_component(); - const SourcePackage *pkg = tmpl.get_package(); - FS::Path subdir; + string subdir = "generated"; string base; if(processing_unit==COMPONENT) base = comp->get_name(); else { - subdir = FS::dirname(FS::relative(tmpl.get_path(), pkg->get_source_directory())); + string flat_dir = comp->flatten_source_path(FS::dirname(tmpl.get_path())); if(processing_unit==ONE_FILE) - base = FS::basepart(FS::basename(tmpl.get_path())); - else if(processing_unit==DIRECTORY) { - base = FS::basename(subdir); - subdir = FS::dirname(subdir); + append(subdir, "_", flat_dir); + base = FS::basepart(FS::basename(tmpl.get_path())); } + else if(processing_unit==DIRECTORY) + base = flat_dir; } Target *primary = 0; @@ -53,7 +53,7 @@ Target *SourceGenerator::create_target(const vector &sources, const st Tool *tool = builder.get_toolchain().get_tool_for_suffix(s, true); if(tool) { - FS::Path fn = pkg->get_temp_directory()/"generated"/subdir/(base+s); + FS::Path fn = comp->get_temp_directory()/subdir/(base+s); Target *target = tool->create_source(*comp, fn); target->set_tool(*this); for(Target *t: sources)