summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 72b5abf)
raw | patch | inline | side by side (parent: 72b5abf)
author | ishmal <ishmal@users.sourceforge.net> | |
Tue, 20 Jun 2006 21:23:20 +0000 (21:23 +0000) | ||
committer | ishmal <ishmal@users.sourceforge.net> | |
Tue, 20 Jun 2006 21:23:20 +0000 (21:23 +0000) |
src/deptool.cpp | patch | blob | history |
diff --git a/src/deptool.cpp b/src/deptool.cpp
index cf58a7902544fd723e9fdfc84871b866f51049a4..a5e4f9058d7fcd703e20017948fe9bca8b33b889 100644 (file)
--- a/src/deptool.cpp
+++ b/src/deptool.cpp
/**
*
*/
- bool saveDepFile();
+ bool saveDepFile(bool doXml);
/**
*
return false;
if (!generateDependencies())
return false;
- saveDepFile();
+ saveDepFile(false);
saveRefFile(true);
return true;
}
* This is the main product. This file lists the Include directives,
* the Object list, and the dependency list.
*/
-bool DepTool::saveDepFile()
+bool DepTool::saveDepFile(bool doXml)
{
time_t tim;
time(&tim);
{
trace("cannot open 'make.dep' for writing");
}
- fprintf(f, "########################################################\n");
- fprintf(f, "## File: make.dep\n");
- fprintf(f, "## Generated by DepTool at :%s", ctime(&tim));
- fprintf(f, "########################################################\n");
+ if (doXml)
+ {
+ fprintf(f, "<?xml version='1.0'?>\n");
+ fprintf(f, "<deptool>\n");
+ fprintf(f, "\n");
+ fprintf(f, "<!--\n");
+ fprintf(f, "########################################################\n");
+ fprintf(f, "## File: make.dep\n");
+ fprintf(f, "## Generated by DepTool at :%s", ctime(&tim));
+ fprintf(f, "########################################################\n");
+ fprintf(f, "-->\n");
- fprintf(f, "\n\n");
+ fprintf(f, "\n\n");
- fprintf(f, "########################################################\n");
- fprintf(f, "## I N C L U D E\n");
- fprintf(f, "########################################################\n");
- fprintf(f, "DEPTOOL_INCLUDE =");
+ fprintf(f, "\n");
+ fprintf(f, "<!--\n");
+ fprintf(f, "########################################################\n");
+ fprintf(f, "## I N C L U D E\n");
+ fprintf(f, "########################################################\n");
+ fprintf(f, "-->\n");
+ fprintf(f, "<includes>\n");
- std::vector<String>::iterator inciter;
- for (inciter=directories.begin() ; inciter!=directories.end() ; inciter++)
- {
- fprintf(f, " \\\n");
- String dirname = *inciter;
- fprintf(f, "-I%s", dirname.c_str());
- }
+ std::vector<String>::iterator inciter;
+ for (inciter=directories.begin() ; inciter!=directories.end() ; inciter++)
+ {
+ String dirname = *inciter;
+ fprintf(f, " <inc name='%s'/>\n", dirname.c_str());
+ }
- fprintf(f, "\n\n\n");
- fprintf(f, "########################################################\n");
- fprintf(f, "## O B J E C T S\n");
- fprintf(f, "########################################################\n");
- fprintf(f, "DEPTOOL_OBJECTS =");
+ fprintf(f, "</includes>\n");
+ fprintf(f, "\n\n\n");
+ fprintf(f, "<!--\n");
+ fprintf(f, "########################################################\n");
+ fprintf(f, "## O B J E C T S\n");
+ fprintf(f, "########################################################\n");
+ fprintf(f, "-->\n");
+ fprintf(f, "<objects>\n");
- std::map<String, FileRec *>::iterator oiter;
- for (oiter=allFiles.begin() ; oiter!=allFiles.end() ; oiter++)
- {
- FileRec *frec = oiter->second;
- if (frec->type == FileRec::CFILE)
+ std::map<String, FileRec *>::iterator oiter;
+ for (oiter=allFiles.begin() ; oiter!=allFiles.end() ; oiter++)
{
- fprintf(f, " \\\n");
- String fname = frec->path;
- if (fname.size()>0)
- fname.append("/");
- fname.append(frec->baseName);
- fname.append(".o");
- fprintf(f, "%s", fname.c_str());
+ FileRec *frec = oiter->second;
+ if (frec->type == FileRec::CFILE)
+ {
+ String fname = frec->path;
+ if (fname.size()>0)
+ fname.append("/");
+ fname.append(frec->baseName);
+ fname.append(".o");
+ fprintf(f, " <obj name='%s'/>\n", fname.c_str());
+ }
}
- }
- fprintf(f, "\n\n\n");
- fprintf(f, "########################################################\n");
- fprintf(f, "## D E P E N D E N C I E S\n");
- fprintf(f, "########################################################\n");
- std::map<String, FileRec *>::iterator iter;
- for (iter=depFiles.begin() ; iter!=depFiles.end() ; iter++)
+ fprintf(f, "</objects>\n");
+ fprintf(f, "\n\n\n");
+ fprintf(f, "<!--\n");
+ fprintf(f, "########################################################\n");
+ fprintf(f, "## D E P E N D E N C I E S\n");
+ fprintf(f, "########################################################\n");
+ fprintf(f, "-->\n");
+ fprintf(f, "<dependencies>\n\n");
+ std::map<String, FileRec *>::iterator iter;
+ for (iter=depFiles.begin() ; iter!=depFiles.end() ; iter++)
+ {
+ FileRec *frec = iter->second;
+ if (frec->type == FileRec::OFILE)
+ {
+ String fname = iter->first;
+ fprintf(f, "<file name='%s'>\n", fname.c_str());
+ std::map<String, FileRec *>::iterator citer;
+ for (citer=frec->files.begin() ; citer!=frec->files.end() ; citer++)
+ {
+ String cfname = citer->first;
+ fprintf(f, " <dep name='%s'/>\n", cfname.c_str());
+ }
+ fprintf(f, "</file>\n\n");
+ }
+ }
+
+ fprintf(f, "</dependencies>\n");
+ fprintf(f, "\n\n\n");
+ fprintf(f, "</deptool>\n");
+ fprintf(f, "<!--\n");
+ fprintf(f, "########################################################\n");
+ fprintf(f, "## E N D\n");
+ fprintf(f, "########################################################\n");
+ fprintf(f, "-->\n");
+ }
+ else // ######### !XML
{
- FileRec *frec = iter->second;
- if (frec->type == FileRec::OFILE)
+ fprintf(f, "########################################################\n");
+ fprintf(f, "## File: make.dep\n");
+ fprintf(f, "## Generated by DepTool at :%s", ctime(&tim));
+ fprintf(f, "########################################################\n");
+
+ fprintf(f, "\n\n");
+
+ fprintf(f, "########################################################\n");
+ fprintf(f, "## I N C L U D E\n");
+ fprintf(f, "########################################################\n");
+ fprintf(f, "DEPTOOL_INCLUDE =");
+
+ std::vector<String>::iterator inciter;
+ for (inciter=directories.begin() ; inciter!=directories.end() ; inciter++)
+ {
+ fprintf(f, " \\\n");
+ String dirname = *inciter;
+ fprintf(f, "-I%s", dirname.c_str());
+ }
+
+ fprintf(f, "\n\n\n");
+ fprintf(f, "########################################################\n");
+ fprintf(f, "## O B J E C T S\n");
+ fprintf(f, "########################################################\n");
+ fprintf(f, "DEPTOOL_OBJECTS =");
+
+ std::map<String, FileRec *>::iterator oiter;
+ for (oiter=allFiles.begin() ; oiter!=allFiles.end() ; oiter++)
{
- String fname = iter->first;
- fprintf(f, "%s:", fname.c_str());
- std::map<String, FileRec *>::iterator citer;
- for (citer=frec->files.begin() ; citer!=frec->files.end() ; citer++)
+ FileRec *frec = oiter->second;
+ if (frec->type == FileRec::CFILE)
{
- String cfname = citer->first;
fprintf(f, " \\\n");
- fprintf(f, "\t%s", cfname.c_str());
+ String fname = frec->path;
+ if (fname.size()>0)
+ fname.append("/");
+ fname.append(frec->baseName);
+ fname.append(".o");
+ fprintf(f, "%s", fname.c_str());
}
- fprintf(f, "\n\n\n");
}
- }
- fprintf(f, "\n\n\n");
- fprintf(f, "########################################################\n");
- fprintf(f, "## E N D\n");
- fprintf(f, "########################################################\n");
+
+ fprintf(f, "\n\n\n");
+ fprintf(f, "########################################################\n");
+ fprintf(f, "## D E P E N D E N C I E S\n");
+ fprintf(f, "########################################################\n");
+ std::map<String, FileRec *>::iterator iter;
+ for (iter=depFiles.begin() ; iter!=depFiles.end() ; iter++)
+ {
+ FileRec *frec = iter->second;
+ if (frec->type == FileRec::OFILE)
+ {
+ String fname = iter->first;
+ fprintf(f, "%s:", fname.c_str());
+ std::map<String, FileRec *>::iterator citer;
+ for (citer=frec->files.begin() ; citer!=frec->files.end() ; citer++)
+ {
+ String cfname = citer->first;
+ fprintf(f, " \\\n");
+ fprintf(f, "\t%s", cfname.c_str());
+ }
+ fprintf(f, "\n\n\n");
+ }
+ }
+
+ fprintf(f, "\n\n\n");
+ fprintf(f, "########################################################\n");
+ fprintf(f, "## E N D\n");
+ fprintf(f, "########################################################\n");
+ }
fclose(f);
fprintf(f, "## Note: The metric is the 'distance' of inclusion from\n");
fprintf(f, "## the given file.\n");
fprintf(f, "########################################################\n");
- fprintf(f, "--!>\n");
+ fprintf(f, "-->\n");
fprintf(f, "\n\n");
fprintf(f, "########################################################\n");
fprintf(f, "## E N D\n");
fprintf(f, "########################################################\n");
- fprintf(f, "--!>\n");
+ fprintf(f, "-->\n");
}
else //######### not xml