void\r
MingwBackend::Process ()\r
{\r
+ DetectPCHSupport();\r
+\r
CreateMakefile ();\r
GenerateHeader ();\r
GenerateGlobalVariables ();\r
GenerateAllTarget ();\r
GenerateInitTarget ();\r
+ GenerateXmlBuildFilesMacro();\r
for ( size_t i = 0; i < ProjectNode.modules.size (); i++ )\r
{\r
Module& module = *ProjectNode.modules[i];\r
fprintf ( fMakefile, "bin2res = tools" SSEP "bin2res" SSEP "bin2res" EXEPOSTFIX "\n" );\r
fprintf ( fMakefile, "cabman = tools" SSEP "cabman" SSEP "cabman" EXEPOSTFIX "\n" );\r
fprintf ( fMakefile, "cdmake = tools" SSEP "cdmake" SSEP "cdmake" EXEPOSTFIX "\n" );\r
+ fprintf ( fMakefile, "rsym = tools" SSEP "rsym" EXEPOSTFIX "\n" );\r
+ fprintf ( fMakefile, "wrc = tools" SSEP "wrc" SSEP "wrc" EXEPOSTFIX "\n" );\r
fprintf ( fMakefile, "\n" );\r
GenerateGlobalCFlagsAndProperties (\r
"=",\r
"\n" );\r
}\r
\r
+void\r
+MingwBackend::GenerateXmlBuildFilesMacro() const\r
+{\r
+ fprintf ( fMakefile,\r
+ "XMLBUILDFILES = %s \\\n",\r
+ ProjectNode.GetProjectFilename ().c_str () );\r
+ string xmlbuildFilenames;\r
+ int numberOfExistingFiles = 0;\r
+ for ( size_t i = 0; i < ProjectNode.xmlbuildfiles.size (); i++ )\r
+ {\r
+ XMLInclude& xmlbuildfile = *ProjectNode.xmlbuildfiles[i];\r
+ if ( !xmlbuildfile.fileExists )\r
+ continue;\r
+ numberOfExistingFiles++;\r
+ if ( xmlbuildFilenames.length () > 0 )\r
+ xmlbuildFilenames += " ";\r
+ xmlbuildFilenames += NormalizeFilename ( xmlbuildfile.topIncludeFilename );\r
+ if ( numberOfExistingFiles % 5 == 4 || i == ProjectNode.xmlbuildfiles.size () - 1 )\r
+ {\r
+ fprintf ( fMakefile,\r
+ "\t%s",\r
+ xmlbuildFilenames.c_str ());\r
+ if ( i == ProjectNode.xmlbuildfiles.size () - 1 )\r
+ {\r
+ fprintf ( fMakefile,\r
+ "\n" );\r
+ }\r
+ else\r
+ {\r
+ fprintf ( fMakefile,\r
+ " \\\n",\r
+ xmlbuildFilenames.c_str () );\r
+ }\r
+ xmlbuildFilenames.resize ( 0 );\r
+ }\r
+ numberOfExistingFiles++;\r
+ }\r
+ fprintf ( fMakefile,\r
+ "\n" );\r
+}\r
+\r
void\r
MingwBackend::CheckAutomaticDependencies ()\r
{\r
{\r
return string("$(ROS_INTERMEDIATE)") + NormalizeFilename ( targetFilename );\r
}\r
+\r
+void\r
+MingwBackend::DetectPCHSupport()\r
+{\r
+ string path = "tools" SSEP "rbuild" SSEP "backend" SSEP "mingw" SSEP "pch_detection.h";\r
+ system ( ssprintf("gcc -c %s", path.c_str()).c_str() );\r
+ path += ".gch";\r
+\r
+ FILE* f = fopen ( path.c_str(), "rb" );\r
+ if ( f )\r
+ {\r
+ use_pch = true;\r
+ fclose(f);\r
+ unlink ( path.c_str() );\r
+ }\r
+ else\r
+ use_pch = false;\r
+\r
+ // TODO FIXME - eventually check for ROS_USE_PCH env var and\r
+ // allow that to override use_pch if true\r
+}\r