/// <summary>
        /// Creates a configuration target.
        /// </summary>
        private void createConfigurationTarget(ProjectConfigurationInfo_CPP configurationInfo)
        {
            // For example:
            //
            //   .PHONY: Debug
            //   Debug: debug/main.o debug/math.o debug/utility.o
            //       g++ debug/main.o debug/math.o debug/utility.o -o output/hello.exe

            // The target name...
            m_file.WriteLine("# Builds the {0} configuration...", configurationInfo.Name);
            m_file.WriteLine(".PHONY: {0}", configurationInfo.Name);

            // The targets that this target depends on...
            var dependencies = new List<string>();

            dependencies.Add("create_folders");

            // Is there a pre-build event for this configuration?
            if (configurationInfo.PreBuildEvent != "")
            {
                string preBuildTargetName = getPreBuildTargetName(configurationInfo);
                dependencies.Add(preBuildTargetName);
            }

            // We add any custom build targets as dependencies...
            foreach (CustomBuildRuleInfo_CPP ruleInfo in configurationInfo.getCustomBuildRuleInfos())
            {
                string ruleTargetName = getCustomRuleTargetName(configurationInfo, ruleInfo);
                dependencies.Add(ruleTargetName);
            }

            // The object files the target depends on...
            string intermediateFolder = getIntermediateFolder(configurationInfo);
            var objectFiles = new List<string>();
            foreach (string filename in m_projectInfo.getFiles())
            {
                string path = String.Format("{0}/{1}.o", intermediateFolder, Path.GetFileNameWithoutExtension(filename));
                objectFiles.Add(path);
                dependencies.Add(path);
            }

            // We write the dependencies...
            m_file.WriteLine("{0}: {1}", configurationInfo.Name, Utils.join(" ", dependencies));

            // We find variables needed for the link step...
            string outputFolder = getOutputFolder(configurationInfo);

            // The link step...
            switch (m_projectInfo.ProjectType)
            {
                // Creates a C++ executable...
                case ProjectInfo_CPP.ProjectTypeEnum.CPP_EXECUTABLE:
                    {
                        m_file.WriteLine("\t$(CPP_COMPILER) {0} $({1}) $({2}) -Wl,-rpath,./ -o {3}/{4}.exe",
                            Utils.join(" ", objectFiles),
                            getLibraryPathVariableName(configurationInfo),
                            getLibrariesVariableName(configurationInfo),
                            outputFolder,
                            m_projectInfo.Name);
                        break;
                    }

                // Creates a static library...
                case ProjectInfo_CPP.ProjectTypeEnum.CPP_STATIC_LIBRARY:
                    {
                        m_file.WriteLine("\tar rcs {0}/lib{1}.a {2} $({3})",
                            outputFolder,
                            m_projectInfo.Name,
                            Utils.join(" ", objectFiles),
                            getImplicitlyLinkedObjectsVariableName(configurationInfo));
                        break;
                    }

                // Creates a DLL (shared-objects) library...
                case ProjectInfo_CPP.ProjectTypeEnum.CPP_DLL:
                    {
                        string dllName, pic;
                        if (MakeItSoConfig.Instance.IsCygwinBuild == true)
                        {
                            dllName = String.Format("lib{0}.dll", m_projectInfo.Name);
                            pic = "";
                        }
                        else
                        {
                            dllName = String.Format("lib{0}.so", m_projectInfo.Name);
                            pic = "-fPIC";
                        }

                        m_file.WriteLine("\t$(CPP_COMPILER) {0} -shared -Wl,-soname,{1} -o {2}/{1} {3} $({4}) $({5}) $({6})",
                            pic,
                            dllName,
                            outputFolder,
                            Utils.join(" ", objectFiles),
                            getImplicitlyLinkedObjectsVariableName(configurationInfo),
                            getLibraryPathVariableName(configurationInfo),
                            getLibrariesVariableName(configurationInfo));
                        break;
                    }
            }

            // The post-build step, if there is one...
            if (configurationInfo.PostBuildEvent != "")
            {
                m_file.WriteLine("\t" + configurationInfo.PostBuildEvent);
            }

            m_file.WriteLine("");
        }
 /// <summary>
 /// We create targets to build any custom build rules associated with 
 /// this configuration.
 /// </summary>
 private void createCustomBuildRuleTargets(ProjectConfigurationInfo_CPP configuration)
 {
     foreach(CustomBuildRuleInfo_CPP ruleInfo in configuration.getCustomBuildRuleInfos())
     {
         createCustomBuildRuleTarget(configuration, ruleInfo);
     }
 }
        /// <summary>
        /// Creates a configuration target.
        /// </summary>
        private void createConfigurationTarget(ProjectConfigurationInfo_CPP configurationInfo)
        {
            // For example:
            //
            //   .PHONY: Debug
            //   Debug: debug/main.o debug/math.o debug/utility.o
            //       g++ debug/main.o debug/math.o debug/utility.o -o output/hello.exe

            // The target name...
            m_file.WriteLine("# Builds the {0} configuration...", configurationInfo.Name);
            m_file.WriteLine(".PHONY: {0}", configurationInfo.Name);

            // The targets that this target depends on...
            string dependencies = "create_folders ";

            // Is there a pre-build event for this configuration?
            if (configurationInfo.PreBuildEvent != "")
            {
                string preBuildTargetName = getPreBuildTargetName(configurationInfo);
                dependencies += (preBuildTargetName + " ");
            }

            // We add any custom build targets as dependencies...
            foreach (CustomBuildRuleInfo_CPP ruleInfo in configurationInfo.getCustomBuildRuleInfos())
            {
                string ruleTargetName = getCustomRuleTargetName(configurationInfo, ruleInfo);
                dependencies += (ruleTargetName + " ");
            }

            var projectSettings = MakeItSoConfig.Instance.getProjectConfig(m_projectInfo.Name);

            // The object files the target depends on...
            string intermediateFolder = getIntermediateFolder(configurationInfo);
            string objectFiles = "";
            foreach (string filename in m_projectInfo.getFiles())
            {
                if (!projectSettings.filesOrDirectoriesShouldBeRemoved(filename))
                {
                    string path = String.Format("{0}/{1}", intermediateFolder, filename);
                    if (filename.StartsWith(".."))
                    {
                        var tmp = filename.Replace("../", "");
                        path = String.Format("{0}/{1}", intermediateFolder, tmp);
                    }
                    string objectPath = Path.ChangeExtension(path, ".o");
                    objectFiles += (objectPath + " ");
                    dependencies += (objectPath + " ");
                }
            }

            // We write the dependencies...
            m_file.WriteLine("{0}: {1}", configurationInfo.Name, dependencies);

            // We find variables needed for the link step...
            string outputFolder = getOutputFolder(configurationInfo);
            string implicitlyLinkedObjectFiles = String.Format("$({0})", getImplicitlyLinkedObjectsVariableName(configurationInfo));

            // The link step...
            #if false
            switch (m_projectInfo.ProjectType)
            {
                // Creates a C++ executable...
                case ProjectInfo_CPP.ProjectTypeEnum.CPP_EXECUTABLE:
                    string libraryPath = getLibraryPathVariableName(configurationInfo);
                    string libraries = getLibrariesVariableName(configurationInfo);
                    m_file.WriteLine("\tg++ {0} $({1}) $({2}) -Wl,-rpath,./ -o {3}/{4}.exe", objectFiles, libraryPath, libraries, outputFolder, m_projectInfo.Name);
                    break;

                // Creates a static library...
                case ProjectInfo_CPP.ProjectTypeEnum.CPP_STATIC_LIBRARY:
                    // We use the Target Name as the output file name if it exists
                    if (configurationInfo.TargetName != "")
                        m_file.WriteLine("\tar rcs {0}/lib{1}.a {2} {3}", outputFolder, configurationInfo.TargetName, objectFiles, implicitlyLinkedObjectFiles);
                    else
                        m_file.WriteLine("\tar rcs {0}/lib{1}.a {2} {3}", outputFolder, m_projectInfo.Name, objectFiles, implicitlyLinkedObjectFiles);
                    break;

                // Creates a DLL (shared-objects) library...
                case ProjectInfo_CPP.ProjectTypeEnum.CPP_DLL:
                    string dllName, pic;
                    if(MakeItSoConfig.Instance.IsCygwinBuild == true)
                    {
                        dllName = String.Format("lib{0}.dll", m_projectInfo.Name);
                        pic = "";
                    }
                    else
                    {
                        dllName = String.Format("lib{0}.so", m_projectInfo.Name);
                        pic = "-fPIC";
                    }

                    m_file.WriteLine("\tg++ {0} -shared -Wl,-soname,{1} -o {2}/{1} {3} {4}", pic, dllName, outputFolder, objectFiles, implicitlyLinkedObjectFiles);
                    break;
            }
            #else
            switch (m_projectInfo.ProjectType)
            {
                // Creates a C++ executable...
                case ProjectInfo_CPP.ProjectTypeEnum.CPP_EXECUTABLE:
                    string libraryPath = getLibraryPathVariableName(configurationInfo);
                    string libraries = getLibrariesVariableName(configurationInfo);
                    string exeName = getBuildExportName(configurationInfo);
                    m_file.WriteLine("\tg++ {0} $({1}) $({2}) -Wl,-rpath,./ -o {3}/{4}", objectFiles, libraryPath, libraries, outputFolder, exeName);
                    break;

                // Creates a static library...
                case ProjectInfo_CPP.ProjectTypeEnum.CPP_STATIC_LIBRARY:
                    // We use the Target Name as the output file name if it exists
                    var libName = getBuildExportName(configurationInfo);
                    m_file.WriteLine("\tar rcs {0}/{1} {2} {3}", outputFolder, libName, objectFiles, implicitlyLinkedObjectFiles);
                    break;

                // Creates a DLL (shared-objects) library...
                case ProjectInfo_CPP.ProjectTypeEnum.CPP_DLL:
                    string dllName = getBuildExportName(configurationInfo);
                    string pic;
                    if(MakeItSoConfig.Instance.IsCygwinBuild == true)
                    {
                        pic = "";
                    }
                    else
                    {
                        pic = "-fPIC";
                    }

                    m_file.WriteLine("\tg++ {0} -shared -Wl,-soname,{1} -o {2}/{1} {3} {4}", pic, dllName, outputFolder, objectFiles, implicitlyLinkedObjectFiles);
                    break;
            }
            #endif

            // The post-build step, if there is one...
            if (configurationInfo.PostBuildEvent != "")
            {
                m_file.WriteLine("\t" + configurationInfo.PostBuildEvent);
            }

            m_file.WriteLine("");
        }