summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 720a6e9)
raw | patch | inline | side by side (parent: 720a6e9)
author | ishmal <ishmal@users.sourceforge.net> | |
Thu, 16 Nov 2006 21:45:33 +0000 (21:45 +0000) | ||
committer | ishmal <ishmal@users.sourceforge.net> | |
Thu, 16 Nov 2006 21:45:33 +0000 (21:45 +0000) |
buildtool.cpp | patch | blob | history |
diff --git a/buildtool.cpp b/buildtool.cpp
index 60621478458772dd21b44585d21c6ffb827a9bf3..bcec40c93227b0cf31b1799ffb008e867c36d443 100644 (file)
--- a/buildtool.cpp
+++ b/buildtool.cpp
#include <sys/time.h>
#include <dirent.h>
-
#include <string>
#include <map>
#include <set>
/**
*
*/
- ~URI()
+ virtual ~URI()
{}
{
va_list args;
va_start(args,fmt);
- fprintf(stdout, "-");
+ //fprintf(stdout, " ");
vfprintf(stdout, fmt, args);
fprintf(stdout, "\n");
va_end(args) ;
/**
- * Execute a system call via the shell
+ * Execute a system call, using pipes to send data to the
+ * program's stdin, and reading stdout and stderr.
*/
bool MakeBase::executeCommand(const String &command,
const String &inbuf,
String &errbuf)
{
- status("-------- cmd --------\n%s\n---------------------",
+ status("============ cmd ============\n%s\n=============================",
command.c_str());
#ifdef __WIN32__
+ /*
+ I really hate having win32 code in this program, but the
+ read buffer in command.com and cmd.exe are just too small
+ for the large commands we need for compiling and linking.
+ */
+
bool ret = true;
//# Allocate a separate buffer for safety
{
break;
}
- for (int i=0 ; i<bytesRead ; i++)
+ for (unsigned int i=0 ; i<bytesRead ; i++)
errbuf.push_back(readBuf[i]);
}
//trace("## stdout");
{
break;
}
- for (int i=0 ; i<bytesRead ; i++)
+ for (unsigned int i=0 ; i<bytesRead ; i++)
outbuf.push_back(readBuf[i]);
}
DWORD exitCode;
//Now do the stuff
//Get the base directory for reading file names
- bool doDir = true;
if (!propRef.getAttribute(elem, "dir", dir))
return false;
depObject.files.push_back(depName);
}
}
- result.push_back(depObject);
+ //Insert into the result list, in a sorted manner
+ bool inserted = false;
+ std::vector<DepRec>::iterator iter;
+ for (iter = result.begin() ; iter != result.end() ; iter++)
+ {
+ if (iter->path > depObject.path)
+ {
+ inserted = true;
+ iter = result.insert(iter, depObject);
+ break;
+ }
+ else if (iter->path == depObject.path)
+ {
+ if (iter->name > depObject.name)
+ {
+ inserted = true;
+ iter = result.insert(iter, depObject);
+ break;
+ }
+ }
+ }
+ if (!inserted)
+ result.push_back(depObject);
}
}
//Get the immediate parent directory's base name
String baseFileSetDir = fileSetDir;
- int pos = baseFileSetDir.find_last_of('/');
- if (pos>0 && pos < baseFileSetDir.size()-1)
+ unsigned int pos = baseFileSetDir.find_last_of('/');
+ if (pos!=baseFileSetDir.npos &&
+ pos < baseFileSetDir.size()-1)
baseFileSetDir =
baseFileSetDir.substr(pos+1,
baseFileSetDir.size());
//the source appended to the dest dir
status(" : %s", fileName.c_str());
String baseName = fileName;
- int pos = baseName.find_last_of('/');
- if (pos > 0 && pos<baseName.size()-1)
+ unsigned int pos = baseName.find_last_of('/');
+ if (pos!=baseName.npos && pos<baseName.size()-1)
baseName = baseName.substr(pos+1, baseName.size());
String fullSource = parent.resolve(fileName);
String destPath;
{
status(" : %s", dirName.c_str());
String fullDir = parent.resolve(dirName);
- char *dname = (char *)fullDir.c_str();
if (!removeDirectory(fullDir))
return false;
return true;
virtual bool execute()
{
//trace("msgfmt: %d", fileSet.size());
- bool doit = false;
-
- String fullDest = parent.resolve(toDirName);
-
for (unsigned int i=0 ; i<fileSet.size() ; i++)
{
String fileName = fileSet[i];
*
*/
bool checkTargetDependencies(Target &prop,
- std::set<String> &depList);
+ std::vector<String> &depList);
/**
*
*
*/
bool Make::checkTargetDependencies(Target &target,
- std::set<String> &depList)
+ std::vector<String> &depList)
{
String tgtName = target.getName().c_str();
- depList.insert(tgtName);
+ depList.push_back(tgtName);
std::vector<String> deps = target.getDependencies();
for (unsigned int i=0 ; i<deps.size() ; i++)
{
String dep = deps[i];
- std::set<String>::iterator diter = depList.find(dep);
- if (diter != depList.end())
+ //First thing entered was the starting Target
+ if (dep == depList[0])
{
error("Circular dependency '%s' found at '%s'",
dep.c_str(), tgtName.c_str());
+ std::vector<String>::iterator diter;
+ for (diter=depList.begin() ; diter!=depList.end() ; diter++)
+ {
+ error(" %s", diter->c_str());
+ }
return false;
}
for (iter = targets.begin() ; iter!= targets.end() ; iter++)
{
Target tgt = iter->second;
- std::set<String> depList;
+ std::vector<String> depList;
if (!checkTargetDependencies(tgt, depList))
{
return false;
return true;
}
-
+/**
+ * Parse the command-line args, get our options,
+ * and run this thing
+ */
static bool parseOptions(int argc, char **argv)
{
if (argc < 1)
return true;
}
+
+
+
+/*
static bool runMake()
{
buildtool::Make make;
return true;
}
-/*
+
static bool pkgConfigTest()
{
buildtool::PkgConfig pkgConfig;