summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/cmBuildCommand.cxx6
-rw-r--r--Source/cmNMakeMakefileGenerator.cxx51
-rw-r--r--Source/cmNMakeMakefileGenerator.h2
-rw-r--r--Source/cmUnixMakefileGenerator.cxx25
-rw-r--r--Source/cmUnixMakefileGenerator.h2
5 files changed, 76 insertions, 10 deletions
diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx
index 18037b4..a778883 100644
--- a/Source/cmBuildCommand.cxx
+++ b/Source/cmBuildCommand.cxx
@@ -58,6 +58,7 @@ bool cmBuildCommand::InitialPass(std::vector<std::string> const& args)
std::string makecommand;
std::string makeprogram = args[1];
m_Makefile->ExpandVariablesInString(makeprogram);
+ std::string compiler = m_Makefile->GetDefinition("CMAKE_CXX_COMPILER");
if(makeprogram.find("msdev") != std::string::npos ||
makeprogram.find("MSDEV") != std::string::npos )
{
@@ -70,10 +71,11 @@ bool cmBuildCommand::InitialPass(std::vector<std::string> const& args)
}
else if(makeprogram.find("Borland") != std::string::npos ||
makeprogram.find("BORLAND") != std::string::npos ||
- makeprogram.find("borland") != std::string::npos)
+ makeprogram.find("borland") != std::string::npos ||
+ compiler.find("Borland") != std::string::npos)
{
makecommand = makeprogram;
- makecommand += " -K";
+ makecommand += " -i";
}
else
{
diff --git a/Source/cmNMakeMakefileGenerator.cxx b/Source/cmNMakeMakefileGenerator.cxx
index 0964326..00e90f6 100644
--- a/Source/cmNMakeMakefileGenerator.cxx
+++ b/Source/cmNMakeMakefileGenerator.cxx
@@ -137,7 +137,7 @@ void cmNMakeMakefileGenerator::BuildInSubDirectory(std::ostream& fout,
cmSystemTools::ConvertToWindowsSlashes(dir);
fout << "\tif not exist " << dir.c_str() << " "
<< "$(MAKE) rebuild_cache\n"
- << "\tcd \".\\" << directory << "\"\n"
+ << "\tcd .\\" << directory << "\n"
<< "\t$(MAKE) -$(MAKEFLAGS) " << target1 << "\n";
}
if(target2)
@@ -146,7 +146,7 @@ void cmNMakeMakefileGenerator::BuildInSubDirectory(std::ostream& fout,
}
std::string currentDir = m_Makefile->GetCurrentOutputDirectory();
cmSystemTools::ConvertToWindowsSlashes(currentDir);
- fout << "\tcd \"" << currentDir.c_str() << "\"\n";
+ fout << "\tcd " << currentDir.c_str() << "\n";
}
// This needs to be overriden because nmake requires commands to be quoted
@@ -235,11 +235,15 @@ OutputBuildObjectFromSource(std::ostream& fout,
bool shared)
{
std::string comment = "Build ";
- std::string objectFile = std::string(shortName) + ".obj";
+ std::string objectFile = std::string(shortName) +
+ this->GetOutputExtension(source.GetSourceExtension().c_str());
+ std::cerr << "short name objectfile " << objectFile.c_str() << " " << shortName << "\n";
+
comment += objectFile + " From ";
comment += source.GetFullPath();
std::string compileCommand;
std::string ext = source.GetSourceExtension();
+ std::cerr << "ext " << ext.c_str() << "\n";
if(ext == "c" )
{
compileCommand = "$(CMAKE_C_COMPILER) $(CMAKE_CFLAGS) ";
@@ -255,12 +259,23 @@ OutputBuildObjectFromSource(std::ostream& fout,
}
else if (ext == "rc")
{
- std::cerr << "rc file " << source.GetFullPath() << "\n";
+ compileCommand = "$(RC) /fo\"";
+ compileCommand += objectFile;
+ compileCommand += "\" ";
+ compileCommand += source.GetFullPath();
}
else if (ext == "def")
{
std::cerr << "def file " << source.GetFullPath() << "\n";
}
+ else if (ext == "ico")
+ {
+ std::cerr << "ico file " << source.GetFullPath() << "\n";
+ }
+ else if (ext == "rc2")
+ {
+ std::cerr << "rc2 file " << source.GetFullPath() << "\n";
+ }
// assume c++ if not c rc or def
else
{
@@ -348,6 +363,11 @@ void cmNMakeMakefileGenerator::OutputExecutableRule(std::ostream& fout,
command += "$(" + std::string(name) + "_SRC_OBJS) ";
command += " /Fe" + m_ExecutableOutputPath + name;
command += ".exe /link ";
+ if(t.GetType() == cmTarget::WIN32_EXECUTABLE)
+ {
+ command += " /subsystem:windows ";
+ }
+
std::strstream linklibs;
this->OutputLinkLibraries(linklibs, 0, t);
linklibs << std::ends;
@@ -412,3 +432,26 @@ void cmNMakeMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
fout << linkLibs << "$(CMAKE_STANDARD_WINDOWS_LIBRARIES) ";
}
}
+
+
+std::string cmNMakeMakefileGenerator::GetOutputExtension(const char* s)
+{
+ std::string sourceExtension = s;
+ if(sourceExtension == "def" || sourceExtension == "ico" || sourceExtension == "rc2")
+ {
+ return "";
+ }
+ if(sourceExtension == "rc")
+ {
+ return ".res";
+ }
+ return ".obj";
+}
+
+
+void cmNMakeMakefileGenerator::OutputIncludeMakefile(std::ostream& fout,
+ const char* file)
+{
+ fout << "!include " << file << "\n";
+}
+
diff --git a/Source/cmNMakeMakefileGenerator.h b/Source/cmNMakeMakefileGenerator.h
index 7249e87..eb874d0 100644
--- a/Source/cmNMakeMakefileGenerator.h
+++ b/Source/cmNMakeMakefileGenerator.h
@@ -98,6 +98,8 @@ protected:
virtual void OutputLinkLibraries(std::ostream& fout,
const char* targetLibrary,
const cmTarget &tgt);
+ virtual std::string GetOutputExtension(const char* sourceExtension);
+ virtual void OutputIncludeMakefile(std::ostream&, const char* file);
private:
bool m_QuoteNextCommand; // if this is true, OutputMakeRule
// will not quote the next commands
diff --git a/Source/cmUnixMakefileGenerator.cxx b/Source/cmUnixMakefileGenerator.cxx
index 723b964..399e6c9 100644
--- a/Source/cmUnixMakefileGenerator.cxx
+++ b/Source/cmUnixMakefileGenerator.cxx
@@ -271,10 +271,23 @@ void cmUnixMakefileGenerator::OutputMakefile(const char* file)
// only add the depend include if the depend file exists
if(cmSystemTools::FileExists(dependName.c_str()))
{
- fout << "include cmake.depends\n";
+ this->OutputIncludeMakefile(fout, "cmake.depends");
}
}
+void cmUnixMakefileGenerator::OutputIncludeMakefile(std::ostream& fout,
+ const char* file)
+{
+ fout << "include " << file << "\n";
+}
+
+
+std::string
+cmUnixMakefileGenerator::GetOutputExtension(const char* sourceExtension)
+{
+ return m_ObjectFileExtension;
+}
+
// Output the rules for any targets
@@ -345,9 +358,13 @@ void cmUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
{
if(!i->IsAHeaderFileOnly())
{
- fout << "\\\n" << i->GetSourceName()
- << m_ObjectFileExtension << " ";
- }
+ std::string outExt(this->GetOutputExtension(i->GetSourceExtension().c_str()));
+ if(outExt.size())
+ {
+ fout << "\\\n" << i->GetSourceName()
+ << outExt.c_str() << " ";
+ }
+ }
}
fout << "\n\n";
}
diff --git a/Source/cmUnixMakefileGenerator.h b/Source/cmUnixMakefileGenerator.h
index b30d6b9..abdf71e 100644
--- a/Source/cmUnixMakefileGenerator.h
+++ b/Source/cmUnixMakefileGenerator.h
@@ -151,6 +151,8 @@ protected:
const char* command2 = 0,
const char* command3 = 0,
const char* command4 = 0);
+ virtual std::string GetOutputExtension(const char* sourceExtension);
+ virtual void OutputIncludeMakefile(std::ostream&, const char* file);
void SetObjectFileExtension(const char* e) { m_ObjectFileExtension = e;}
void SetExecutableExtension(const char* e) { m_ExecutableExtension = e;}
void SetStaticLibraryExtension(const char* e) {m_StaticLibraryExtension = e;}