ENH: Do not try to handle unimplemented target types yet. Fixes for projects with subdirectories.
This commit is contained in:
parent
cc5c136cb8
commit
72e125ca1f
@ -45,8 +45,15 @@ void cmLocalUnixMakefileGenerator2::Generate(bool fromTheTop)
|
|||||||
const cmTargets& targets = m_Makefile->GetTargets();
|
const cmTargets& targets = m_Makefile->GetTargets();
|
||||||
for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t)
|
for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t)
|
||||||
{
|
{
|
||||||
|
// TODO: Dispatch generation of each target type.
|
||||||
|
if((t->second.GetType() == cmTarget::EXECUTABLE) ||
|
||||||
|
(t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
|
||||||
|
(t->second.GetType() == cmTarget::SHARED_LIBRARY) ||
|
||||||
|
(t->second.GetType() == cmTarget::MODULE_LIBRARY))
|
||||||
|
{
|
||||||
this->GenerateTargetRuleFile(t->second);
|
this->GenerateTargetRuleFile(t->second);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Generate the main makefile.
|
// Generate the main makefile.
|
||||||
this->GenerateMakefile();
|
this->GenerateMakefile();
|
||||||
@ -131,6 +138,12 @@ void cmLocalUnixMakefileGenerator2::GenerateMakefile()
|
|||||||
std::vector<std::string> commands;
|
std::vector<std::string> commands;
|
||||||
for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t)
|
for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t)
|
||||||
{
|
{
|
||||||
|
// TODO: Dispatch generation of each target type.
|
||||||
|
if((t->second.GetType() == cmTarget::EXECUTABLE) ||
|
||||||
|
(t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
|
||||||
|
(t->second.GetType() == cmTarget::SHARED_LIBRARY) ||
|
||||||
|
(t->second.GetType() == cmTarget::MODULE_LIBRARY))
|
||||||
|
{
|
||||||
if(t->second.IsInAll())
|
if(t->second.IsInAll())
|
||||||
{
|
{
|
||||||
std::string dep = this->GetTargetDirectory(t->second);
|
std::string dep = this->GetTargetDirectory(t->second);
|
||||||
@ -140,6 +153,7 @@ void cmLocalUnixMakefileGenerator2::GenerateMakefile()
|
|||||||
depends.push_back(dep);
|
depends.push_back(dep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this->OutputMakeRule(makefileStream, "all dependencies", "all.depends",
|
this->OutputMakeRule(makefileStream, "all dependencies", "all.depends",
|
||||||
depends, commands);
|
depends, commands);
|
||||||
}
|
}
|
||||||
@ -150,11 +164,18 @@ void cmLocalUnixMakefileGenerator2::GenerateMakefile()
|
|||||||
std::vector<std::string> commands;
|
std::vector<std::string> commands;
|
||||||
for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t)
|
for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t)
|
||||||
{
|
{
|
||||||
|
// TODO: Dispatch generation of each target type.
|
||||||
|
if((t->second.GetType() == cmTarget::EXECUTABLE) ||
|
||||||
|
(t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
|
||||||
|
(t->second.GetType() == cmTarget::SHARED_LIBRARY) ||
|
||||||
|
(t->second.GetType() == cmTarget::MODULE_LIBRARY))
|
||||||
|
{
|
||||||
if(t->second.IsInAll())
|
if(t->second.IsInAll())
|
||||||
{
|
{
|
||||||
depends.push_back(t->first+".requires");
|
depends.push_back(t->first+".requires");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this->OutputMakeRule(makefileStream, "all", "all",
|
this->OutputMakeRule(makefileStream, "all", "all",
|
||||||
depends, commands);
|
depends, commands);
|
||||||
}
|
}
|
||||||
@ -164,6 +185,12 @@ void cmLocalUnixMakefileGenerator2::GenerateMakefile()
|
|||||||
<< "# Include target rule files.\n";
|
<< "# Include target rule files.\n";
|
||||||
for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t)
|
for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t)
|
||||||
{
|
{
|
||||||
|
// TODO: Dispatch generation of each target type.
|
||||||
|
if((t->second.GetType() == cmTarget::EXECUTABLE) ||
|
||||||
|
(t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
|
||||||
|
(t->second.GetType() == cmTarget::SHARED_LIBRARY) ||
|
||||||
|
(t->second.GetType() == cmTarget::MODULE_LIBRARY))
|
||||||
|
{
|
||||||
std::string ruleFileName = this->GetTargetDirectory(t->second);
|
std::string ruleFileName = this->GetTargetDirectory(t->second);
|
||||||
ruleFileName += "/";
|
ruleFileName += "/";
|
||||||
ruleFileName += t->first;
|
ruleFileName += t->first;
|
||||||
@ -173,6 +200,7 @@ void cmLocalUnixMakefileGenerator2::GenerateMakefile()
|
|||||||
<< this->ConvertToOutputForExisting(ruleFileName.c_str()).c_str()
|
<< this->ConvertToOutputForExisting(ruleFileName.c_str()).c_str()
|
||||||
<< "\n";
|
<< "\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Write jump-and-build rules that were recorded in the map.
|
// Write jump-and-build rules that were recorded in the map.
|
||||||
this->WriteJumpAndBuildRules(makefileStream);
|
this->WriteJumpAndBuildRules(makefileStream);
|
||||||
@ -238,7 +266,7 @@ cmLocalUnixMakefileGenerator2
|
|||||||
{
|
{
|
||||||
// Create a directory for this target.
|
// Create a directory for this target.
|
||||||
std::string dir = this->GetTargetDirectory(target);
|
std::string dir = this->GetTargetDirectory(target);
|
||||||
cmSystemTools::MakeDirectory(dir.c_str());
|
cmSystemTools::MakeDirectory(this->ConvertToFullPath(dir).c_str());
|
||||||
|
|
||||||
// First generate the object rule files. Save a list of all object
|
// First generate the object rule files. Save a list of all object
|
||||||
// files for this target.
|
// files for this target.
|
||||||
@ -264,9 +292,10 @@ cmLocalUnixMakefileGenerator2
|
|||||||
depFileName += "/";
|
depFileName += "/";
|
||||||
depFileName += target.GetName();
|
depFileName += target.GetName();
|
||||||
depFileName += ".depends.make";
|
depFileName += ".depends.make";
|
||||||
if(!cmSystemTools::FileExists(depFileName.c_str()))
|
std::string depFileNameFull = this->ConvertToFullPath(depFileName);
|
||||||
|
if(!cmSystemTools::FileExists(depFileNameFull.c_str()))
|
||||||
{
|
{
|
||||||
std::ofstream depFileStream(depFileName.c_str());
|
std::ofstream depFileStream(depFileNameFull.c_str());
|
||||||
this->WriteDisclaimer(depFileStream);
|
this->WriteDisclaimer(depFileStream);
|
||||||
depFileStream
|
depFileStream
|
||||||
<< "# Empty dependencies file for target " << target.GetName() << ".\n"
|
<< "# Empty dependencies file for target " << target.GetName() << ".\n"
|
||||||
@ -279,7 +308,8 @@ cmLocalUnixMakefileGenerator2
|
|||||||
ruleFileName += "/";
|
ruleFileName += "/";
|
||||||
ruleFileName += target.GetName();
|
ruleFileName += target.GetName();
|
||||||
ruleFileName += ".make";
|
ruleFileName += ".make";
|
||||||
cmGeneratedFileStream ruleFile(ruleFileName.c_str());
|
std::string ruleFileNameFull = this->ConvertToFullPath(ruleFileName);
|
||||||
|
cmGeneratedFileStream ruleFile(ruleFileNameFull.c_str());
|
||||||
std::ostream& ruleFileStream = ruleFile.GetStream();
|
std::ostream& ruleFileStream = ruleFile.GetStream();
|
||||||
if(!ruleFileStream)
|
if(!ruleFileStream)
|
||||||
{
|
{
|
||||||
@ -402,14 +432,15 @@ cmLocalUnixMakefileGenerator2
|
|||||||
// Create the directory containing the object file. This may be a
|
// Create the directory containing the object file. This may be a
|
||||||
// subdirectory under the target's directory.
|
// subdirectory under the target's directory.
|
||||||
std::string dir = cmSystemTools::GetFilenamePath(obj.c_str());
|
std::string dir = cmSystemTools::GetFilenamePath(obj.c_str());
|
||||||
cmSystemTools::MakeDirectory(dir.c_str());
|
cmSystemTools::MakeDirectory(this->ConvertToFullPath(dir).c_str());
|
||||||
|
|
||||||
// If there is no dependencies file, create an empty one.
|
// If there is no dependencies file, create an empty one.
|
||||||
std::string depFileName = obj;
|
std::string depFileName = obj;
|
||||||
depFileName += ".depends.make";
|
depFileName += ".depends.make";
|
||||||
if(!cmSystemTools::FileExists(depFileName.c_str()))
|
std::string depFileNameFull = this->ConvertToFullPath(depFileName);
|
||||||
|
if(!cmSystemTools::FileExists(depFileNameFull.c_str()))
|
||||||
{
|
{
|
||||||
std::ofstream depFileStream(depFileName.c_str());
|
std::ofstream depFileStream(depFileNameFull.c_str());
|
||||||
this->WriteDisclaimer(depFileStream);
|
this->WriteDisclaimer(depFileStream);
|
||||||
depFileStream
|
depFileStream
|
||||||
<< "# Empty dependencies file for object file " << obj.c_str() << ".\n"
|
<< "# Empty dependencies file for object file " << obj.c_str() << ".\n"
|
||||||
@ -420,7 +451,8 @@ cmLocalUnixMakefileGenerator2
|
|||||||
// because the rules may depend on this file itself.
|
// because the rules may depend on this file itself.
|
||||||
std::string ruleFileName = obj;
|
std::string ruleFileName = obj;
|
||||||
ruleFileName += ".make";
|
ruleFileName += ".make";
|
||||||
cmGeneratedFileStream ruleFile(ruleFileName.c_str());
|
std::string ruleFileNameFull = this->ConvertToFullPath(ruleFileName);
|
||||||
|
cmGeneratedFileStream ruleFile(ruleFileNameFull.c_str());
|
||||||
std::ostream& ruleFileStream = ruleFile.GetStream();
|
std::ostream& ruleFileStream = ruleFile.GetStream();
|
||||||
if(!ruleFileStream)
|
if(!ruleFileStream)
|
||||||
{
|
{
|
||||||
@ -1030,6 +1062,17 @@ cmLocalUnixMakefileGenerator2
|
|||||||
->GetLanguageFromExtension(source.GetSourceExtension().c_str()));
|
->GetLanguageFromExtension(source.GetSourceExtension().c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
std::string
|
||||||
|
cmLocalUnixMakefileGenerator2
|
||||||
|
::ConvertToFullPath(const std::string& localPath)
|
||||||
|
{
|
||||||
|
std::string dir = m_Makefile->GetCurrentOutputDirectory();
|
||||||
|
dir += "/";
|
||||||
|
dir += localPath;
|
||||||
|
return dir;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmLocalUnixMakefileGenerator2::AddLanguageFlags(std::string& flags,
|
void cmLocalUnixMakefileGenerator2::AddLanguageFlags(std::string& flags,
|
||||||
const char* lang)
|
const char* lang)
|
||||||
|
@ -85,6 +85,7 @@ protected:
|
|||||||
std::string GetObjectFileName(const cmTarget& target,
|
std::string GetObjectFileName(const cmTarget& target,
|
||||||
const cmSourceFile& source);
|
const cmSourceFile& source);
|
||||||
const char* GetSourceFileLanguage(const cmSourceFile& source);
|
const char* GetSourceFileLanguage(const cmSourceFile& source);
|
||||||
|
std::string ConvertToFullPath(const std::string& localPath);
|
||||||
|
|
||||||
void AddLanguageFlags(std::string& flags, const char* lang);
|
void AddLanguageFlags(std::string& flags, const char* lang);
|
||||||
void AddSharedFlags(std::string& flags, const char* lang, bool shared);
|
void AddSharedFlags(std::string& flags, const char* lang, bool shared);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user