summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpp/include/Slice/Preprocessor.h6
-rw-r--r--cpp/include/Slice/Util.h18
-rw-r--r--cpp/src/Slice/JavaUtil.cpp2
-rw-r--r--cpp/src/Slice/Preprocessor.cpp14
-rw-r--r--cpp/src/Slice/Python.cpp35
-rw-r--r--cpp/src/Slice/Ruby.cpp35
-rw-r--r--cpp/src/Slice/Util.cpp35
-rw-r--r--cpp/src/slice2cpp/Main.cpp42
-rw-r--r--cpp/src/slice2cpp/Makefile2
-rw-r--r--cpp/src/slice2cpp/Makefile.mak2
-rw-r--r--cpp/src/slice2cs/Main.cpp35
-rw-r--r--cpp/src/slice2cs/Makefile2
-rw-r--r--cpp/src/slice2cs/Makefile.mak2
-rw-r--r--cpp/src/slice2freeze/Makefile2
-rw-r--r--cpp/src/slice2freeze/Makefile.mak2
-rw-r--r--cpp/src/slice2freezej/Main.cpp15
-rw-r--r--cpp/src/slice2freezej/Makefile2
-rw-r--r--cpp/src/slice2freezej/Makefile.mak2
-rw-r--r--cpp/src/slice2html/Makefile2
-rw-r--r--cpp/src/slice2html/Makefile.mak2
-rw-r--r--cpp/src/slice2java/Main.cpp18
-rw-r--r--cpp/src/slice2java/Makefile2
-rw-r--r--cpp/src/slice2java/Makefile.mak2
-rw-r--r--cpp/src/slice2js/Main.cpp59
-rw-r--r--cpp/src/slice2js/Makefile2
-rw-r--r--cpp/src/slice2js/Makefile.mak2
-rw-r--r--cpp/src/slice2objc/Main.cpp22
-rw-r--r--cpp/src/slice2objc/Makefile2
-rw-r--r--cpp/src/slice2php/Main.cpp29
-rw-r--r--cpp/src/slice2php/Makefile2
-rw-r--r--cpp/src/slice2php/Makefile.mak2
-rw-r--r--cpp/src/slice2py/Makefile2
-rw-r--r--cpp/src/slice2py/Makefile.mak2
-rw-r--r--cpp/src/slice2rb/Makefile2
-rw-r--r--cpp/src/slice2rb/Makefile.mak2
35 files changed, 345 insertions, 62 deletions
diff --git a/cpp/include/Slice/Preprocessor.h b/cpp/include/Slice/Preprocessor.h
index df17ead72e7..08125e0fb2f 100644
--- a/cpp/include/Slice/Preprocessor.h
+++ b/cpp/include/Slice/Preprocessor.h
@@ -39,10 +39,10 @@ public:
FILE* preprocess(bool, const std::string& = "");
bool close();
- enum Language { CPlusPlus, Java, JavaXML, CSharp, Python, Ruby, PHP, JavaScript, JavaScriptJSON, ObjC };
+ enum Language { CPlusPlus, Java, CSharp, Python, Ruby, PHP, JavaScript, JavaScriptJSON, ObjC, SliceXML };
- bool printMakefileDependencies(Language, const std::vector<std::string>&, const std::string& = "", const std::string& = "cpp",
- const std::string& = "");
+ bool printMakefileDependencies(std::ostream&, Language, const std::vector<std::string>&, const std::string& = "",
+ const std::string& = "cpp", const std::string& = "");
std::string getBaseName();
diff --git a/cpp/include/Slice/Util.h b/cpp/include/Slice/Util.h
index 46df01910a1..9c9118e3740 100644
--- a/cpp/include/Slice/Util.h
+++ b/cpp/include/Slice/Util.h
@@ -12,6 +12,9 @@
#include <Slice/Parser.h>
#include <IceUtil/OutputUtil.h>
+#include <IceUtil/FileUtil.h>
+
+#include <ostream>
namespace Slice
{
@@ -28,6 +31,21 @@ SLICE_API void emitRaw(const char*);
SLICE_API std::vector<std::string> filterMcppWarnings(const std::string&);
SLICE_API void printGeneratedHeader(IceUtilInternal::Output& out, const std::string&, const std::string& commentStyle = "//");
+class SLICE_API DependOutputUtil : IceUtil::noncopyable
+{
+public:
+
+ DependOutputUtil(std::string& file);
+ ~DependOutputUtil();
+ void cleanup();
+ std::ostream& os();
+
+private:
+
+ const std::string _file;
+ IceUtilInternal::ofstream _os;
+};
+
}
#endif
diff --git a/cpp/src/Slice/JavaUtil.cpp b/cpp/src/Slice/JavaUtil.cpp
index e42490a0e4c..adfb6ed9f39 100644
--- a/cpp/src/Slice/JavaUtil.cpp
+++ b/cpp/src/Slice/JavaUtil.cpp
@@ -232,7 +232,7 @@ Slice::JavaOutput::openClass(const string& cls, const string& prefix, const stri
#ifdef _WIN32
result = _mkdir(path.c_str());
#else
- result = mkdir(path.c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
+ result = ::mkdir(path.c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
#endif
if(result != 0)
{
diff --git a/cpp/src/Slice/Preprocessor.cpp b/cpp/src/Slice/Preprocessor.cpp
index 09cdf23d0cc..e3764d747cf 100644
--- a/cpp/src/Slice/Preprocessor.cpp
+++ b/cpp/src/Slice/Preprocessor.cpp
@@ -287,8 +287,8 @@ Slice::Preprocessor::preprocess(bool keepComments, const string& extraArgs)
}
bool
-Slice::Preprocessor::printMakefileDependencies(Language lang, const vector<string>& includePaths,
- const std::string& extraArgs, const string& cppSourceExt,
+Slice::Preprocessor::printMakefileDependencies(ostream& out, Language lang, const vector<string>& includePaths,
+ const string& extraArgs, const string& cppSourceExt,
const string& optValue)
{
if(!checkInputFile())
@@ -384,7 +384,7 @@ Slice::Preprocessor::printMakefileDependencies(Language lang, const vector<strin
#endif
pos = unprocessed.find(suffix) + suffix.size();
string result;
- if(lang != JavaXML)
+ if(lang != SliceXML)
{
result = unprocessed.substr(0, pos);
}
@@ -436,7 +436,7 @@ Slice::Preprocessor::printMakefileDependencies(Language lang, const vector<strin
}
}
- if(lang == JavaXML)
+ if(lang == SliceXML)
{
if(result.size() == 0)
{
@@ -477,7 +477,7 @@ Slice::Preprocessor::printMakefileDependencies(Language lang, const vector<strin
}
pos = end;
}
- if(lang == JavaXML)
+ if(lang == SliceXML)
{
result += "\n </source>\n";
}
@@ -549,7 +549,7 @@ Slice::Preprocessor::printMakefileDependencies(Language lang, const vector<strin
}
break;
}
- case JavaXML:
+ case SliceXML:
break;
case Java:
{
@@ -684,7 +684,7 @@ Slice::Preprocessor::printMakefileDependencies(Language lang, const vector<strin
//
// Output result
//
- fputs(result.c_str(), stdout);
+ out << result;
return true;
}
diff --git a/cpp/src/Slice/Python.cpp b/cpp/src/Slice/Python.cpp
index 25210f33759..33490740e8b 100644
--- a/cpp/src/Slice/Python.cpp
+++ b/cpp/src/Slice/Python.cpp
@@ -402,6 +402,8 @@ usage(const char* n)
"-E Print preprocessor output on stdout.\n"
"--output-dir DIR Create files in the directory DIR.\n"
"--depend Generate Makefile dependencies.\n"
+ "--depend-xml Generate dependencies in XML format.\n"
+ "--depend-file FILE Write dependencies to FILE instead of standard output.\n"
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only).\n"
"--underscore Permit underscores in Slice identifiers.\n"
@@ -425,6 +427,8 @@ Slice::Python::compile(int argc, char* argv[])
opts.addOpt("E");
opts.addOpt("", "output-dir", IceUtilInternal::Options::NeedArg);
opts.addOpt("", "depend");
+ opts.addOpt("", "depend-xml");
+ opts.addOpt("", "depend-file", IceUtilInternal::Options::NeedArg, "");
opts.addOpt("d", "debug");
opts.addOpt("", "ice");
opts.addOpt("", "underscore");
@@ -482,6 +486,10 @@ Slice::Python::compile(int argc, char* argv[])
bool depend = opts.isSet("depend");
+ bool dependxml = opts.isSet("depend-xml");
+
+ string dependFile = opts.optArg("depend-file");
+
bool debug = opts.isSet("debug");
bool ice = opts.isSet("ice");
@@ -503,6 +511,13 @@ Slice::Python::compile(int argc, char* argv[])
return EXIT_FAILURE;
}
+ if(depend && dependxml)
+ {
+ getErrorStream() << argv[0] << ": error: cannot specify both --depend and --dependxml" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
int status = EXIT_SUCCESS;
IceUtil::CtrlCHandler ctrlCHandler;
@@ -510,6 +525,12 @@ Slice::Python::compile(int argc, char* argv[])
bool keepComments = true;
+ DependOutputUtil out(dependFile);
+ if(dependxml)
+ {
+ out.os() << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<dependencies>" << endl;
+ }
+
for(vector<string>::const_iterator i = args.begin(); i != args.end(); ++i)
{
//
@@ -521,13 +542,14 @@ Slice::Python::compile(int argc, char* argv[])
continue;
}
- if(depend)
+ if(depend || dependxml)
{
PreprocessorPtr icecpp = Preprocessor::create(argv[0], *i, cppArgs);
FILE* cppHandle = icecpp->preprocess(false, "-D__SLICE2PY__");
if(cppHandle == 0)
{
+ out.cleanup();
return EXIT_FAILURE;
}
@@ -537,17 +559,20 @@ Slice::Python::compile(int argc, char* argv[])
if(parseStatus == EXIT_FAILURE)
{
+ out.cleanup();
return EXIT_FAILURE;
}
- if(!icecpp->printMakefileDependencies(Preprocessor::Python, includePaths,
+ if(!icecpp->printMakefileDependencies(out.os(), depend ? Preprocessor::Python : Preprocessor::SliceXML, includePaths,
"-D__SLICE2PY__", "", prefix))
{
+ out.cleanup();
return EXIT_FAILURE;
}
if(!icecpp->close())
{
+ out.cleanup();
return EXIT_FAILURE;
}
}
@@ -667,11 +692,17 @@ Slice::Python::compile(int argc, char* argv[])
if(interrupted)
{
+ out.cleanup();
FileTracker::instance()->cleanup();
return EXIT_FAILURE;
}
}
}
+ if(dependxml)
+ {
+ out.os() << "</dependencies>\n";
+ }
+
return status;
}
diff --git a/cpp/src/Slice/Ruby.cpp b/cpp/src/Slice/Ruby.cpp
index a8d43563c5c..e452451f868 100644
--- a/cpp/src/Slice/Ruby.cpp
+++ b/cpp/src/Slice/Ruby.cpp
@@ -70,6 +70,8 @@ usage(const char* n)
"-E Print preprocessor output on stdout.\n"
"--output-dir DIR Create files in the directory DIR.\n"
"--depend Generate Makefile dependencies.\n"
+ "--depend-xml Generate dependencies in XML format.\n"
+ "--depend-file FILE Write dependencies to FILE instead of standard output.\n"
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only).\n"
"--underscore Permit underscores in Slice identifiers.\n"
@@ -92,6 +94,8 @@ Slice::Ruby::compile(int argc, char* argv[])
opts.addOpt("E");
opts.addOpt("", "output-dir", IceUtilInternal::Options::NeedArg);
opts.addOpt("", "depend");
+ opts.addOpt("", "depend-xml");
+ opts.addOpt("", "depend-file", IceUtilInternal::Options::NeedArg, "");
opts.addOpt("d", "debug");
opts.addOpt("", "ice");
opts.addOpt("", "underscore");
@@ -147,6 +151,10 @@ Slice::Ruby::compile(int argc, char* argv[])
bool depend = opts.isSet("depend");
+ bool dependxml = opts.isSet("depend-xml");
+
+ string dependFile = opts.optArg("depend-file");
+
bool debug = opts.isSet("debug");
bool ice = opts.isSet("ice");
@@ -164,11 +172,24 @@ Slice::Ruby::compile(int argc, char* argv[])
return EXIT_FAILURE;
}
+ if(depend && dependxml)
+ {
+ getErrorStream() << argv[0] << ": error: cannot specify both --depend and --dependxml" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
int status = EXIT_SUCCESS;
IceUtil::CtrlCHandler ctrlCHandler;
ctrlCHandler.setCallback(interruptedCallback);
+ DependOutputUtil out(dependFile);
+ if(dependxml)
+ {
+ out.os() << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<dependencies>" << endl;
+ }
+
for(vector<string>::const_iterator i = args.begin(); i != args.end(); ++i)
{
//
@@ -180,13 +201,14 @@ Slice::Ruby::compile(int argc, char* argv[])
continue;
}
- if(depend)
+ if(depend || dependxml)
{
PreprocessorPtr icecpp = Preprocessor::create(argv[0], *i, cppArgs);
FILE* cppHandle = icecpp->preprocess(false, "-D__SLICE2RB__");
if(cppHandle == 0)
{
+ out.cleanup();
return EXIT_FAILURE;
}
@@ -196,17 +218,20 @@ Slice::Ruby::compile(int argc, char* argv[])
if(parseStatus == EXIT_FAILURE)
{
+ out.cleanup();
return EXIT_FAILURE;
}
- if(!icecpp->printMakefileDependencies(Preprocessor::Ruby, includePaths,
+ if(!icecpp->printMakefileDependencies(out.os(), depend ? Preprocessor::Ruby : Preprocessor::SliceXML, includePaths,
"-D__SLICE2RB__"))
{
+ out.cleanup();
return EXIT_FAILURE;
}
if(!icecpp->close())
{
+ out.cleanup();
return EXIT_FAILURE;
}
}
@@ -307,11 +332,17 @@ Slice::Ruby::compile(int argc, char* argv[])
if(interrupted)
{
+ out.cleanup();
FileTracker::instance()->cleanup();
return EXIT_FAILURE;
}
}
}
+ if(dependxml)
+ {
+ out.os() << "</dependencies>\n";
+ }
+
return status;
}
diff --git a/cpp/src/Slice/Util.cpp b/cpp/src/Slice/Util.cpp
index 5ddd8c6c8b9..cacad7217f0 100644
--- a/cpp/src/Slice/Util.cpp
+++ b/cpp/src/Slice/Util.cpp
@@ -395,3 +395,38 @@ Slice::printGeneratedHeader(IceUtilInternal::Output& out, const string& path, co
out << comment << " </auto-generated>\n";
out << comment << "\n";
}
+
+Slice::DependOutputUtil::DependOutputUtil(string& file) : _file(file)
+{
+ if(!_file.empty())
+ {
+ _os.open(file, ios::out);
+ }
+}
+
+Slice::DependOutputUtil::~DependOutputUtil()
+{
+ if(!_file.empty() && _os.is_open())
+ {
+ _os.close();
+ }
+}
+
+void
+Slice::DependOutputUtil::cleanup()
+{
+ if(!_file.empty())
+ {
+ if(_os.is_open())
+ {
+ _os.close();
+ }
+ IceUtilInternal::unlink(_file);
+ }
+}
+
+ostream&
+Slice::DependOutputUtil::os()
+{
+ return _file.empty() ? cout : _os;
+}
diff --git a/cpp/src/slice2cpp/Main.cpp b/cpp/src/slice2cpp/Main.cpp
index 5fa6d6d247d..ec4cf798797 100644
--- a/cpp/src/slice2cpp/Main.cpp
+++ b/cpp/src/slice2cpp/Main.cpp
@@ -11,11 +11,15 @@
#include <IceUtil/CtrlCHandler.h>
#include <IceUtil/Mutex.h>
#include <IceUtil/MutexPtrLock.h>
+#include <IceUtil/FileUtil.h>
#include <Slice/Preprocessor.h>
#include <Slice/FileTracker.h>
#include <Slice/Util.h>
#include "Gen.h"
+#include <iostream>
+#include <fstream>
+
using namespace std;
using namespace Slice;
@@ -74,6 +78,8 @@ usage(const char* n)
"--dll-export SYMBOL Use SYMBOL for DLL exports.\n"
"--impl Generate sample implementations.\n"
"--depend Generate Makefile dependencies.\n"
+ "--depend-xml Generate dependencies in XML format.\n"
+ "--depend-file FILE Write dependencies to FILE instead of standard output.\n"
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only).\n"
"--underscore Permit underscores in Slice identifiers.\n"
@@ -100,7 +106,8 @@ compile(int argc, char* argv[])
opts.addOpt("", "dll-export", IceUtilInternal::Options::NeedArg);
opts.addOpt("", "impl");
opts.addOpt("", "depend");
- opts.addOpt("", "depend-header");
+ opts.addOpt("", "depend-xml");
+ opts.addOpt("", "depend-file", IceUtilInternal::Options::NeedArg, "");
opts.addOpt("d", "debug");
opts.addOpt("", "ice");
opts.addOpt("", "underscore");
@@ -168,6 +175,10 @@ compile(int argc, char* argv[])
bool depend = opts.isSet("depend");
+ bool dependxml = opts.isSet("depend-xml");
+
+ string dependFile = opts.optArg("depend-file");
+
bool debug = opts.isSet("debug");
bool ice = opts.isSet("ice");
@@ -185,11 +196,24 @@ compile(int argc, char* argv[])
return EXIT_FAILURE;
}
+ if(depend && dependxml)
+ {
+ getErrorStream() << argv[0] << ": error: cannot specify both --depend and --dependxml" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
int status = EXIT_SUCCESS;
IceUtil::CtrlCHandler ctrlCHandler;
ctrlCHandler.setCallback(interruptedCallback);
+ DependOutputUtil out(dependFile);
+ if(dependxml)
+ {
+ out.os() << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<dependencies>" << endl;
+ }
+
for(vector<string>::const_iterator i = args.begin(); i != args.end(); ++i)
{
//
@@ -201,13 +225,14 @@ compile(int argc, char* argv[])
continue;
}
- if(depend)
+ if(depend || dependxml)
{
PreprocessorPtr icecpp = Preprocessor::create(argv[0], *i, cppArgs);
FILE* cppHandle = icecpp->preprocess(false, "-D__SLICE2CPP__");
if(cppHandle == 0)
{
+ out.cleanup();
return EXIT_FAILURE;
}
@@ -217,17 +242,20 @@ compile(int argc, char* argv[])
if(parseStatus == EXIT_FAILURE)
{
+ out.cleanup();
return EXIT_FAILURE;
}
- if(!icecpp->printMakefileDependencies(Preprocessor::CPlusPlus, includePaths,
- "-D__SLICE2CPP__", sourceExtension, headerExtension))
+ if(!icecpp->printMakefileDependencies(out.os(), depend ? Preprocessor::CPlusPlus : Preprocessor::SliceXML,
+ includePaths, "-D__SLICE2CPP__", sourceExtension, headerExtension))
{
+ out.cleanup();
return EXIT_FAILURE;
}
if(!icecpp->close())
{
+ out.cleanup();
return EXIT_FAILURE;
}
}
@@ -299,12 +327,18 @@ compile(int argc, char* argv[])
if(interrupted)
{
+ out.cleanup();
FileTracker::instance()->cleanup();
return EXIT_FAILURE;
}
}
}
+ if(dependxml)
+ {
+ out.os() << "</dependencies>\n";
+ }
+
return status;
}
diff --git a/cpp/src/slice2cpp/Makefile b/cpp/src/slice2cpp/Makefile
index 531ab86d408..c774b2ab70e 100644
--- a/cpp/src/slice2cpp/Makefile
+++ b/cpp/src/slice2cpp/Makefile
@@ -20,7 +20,7 @@ RPATH_DIR = $(LOADER_PATH)/../$(libsubdir)
include $(top_srcdir)/config/Make.rules
-CPPFLAGS := -I. $(CPPFLAGS)
+CPPFLAGS := -I. -I.. $(CPPFLAGS)
$(NAME): $(OBJS)
rm -f $@
diff --git a/cpp/src/slice2cpp/Makefile.mak b/cpp/src/slice2cpp/Makefile.mak
index 94610b26905..91f7c77e160 100644
--- a/cpp/src/slice2cpp/Makefile.mak
+++ b/cpp/src/slice2cpp/Makefile.mak
@@ -18,7 +18,7 @@ OBJS = .\Gen.obj \
!include $(top_srcdir)/config/Make.rules.mak
-CPPFLAGS = -I. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
+CPPFLAGS = -I. -I.. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
!if "$(GENERATE_PDB)" == "yes"
PDBFLAGS = /pdb:$(NAME:.exe=.pdb)
diff --git a/cpp/src/slice2cs/Main.cpp b/cpp/src/slice2cs/Main.cpp
index 7e1ce36a25f..cf0365fdeca 100644
--- a/cpp/src/slice2cs/Main.cpp
+++ b/cpp/src/slice2cs/Main.cpp
@@ -71,6 +71,8 @@ usage(const char* n)
"--impl Generate sample implementations.\n"
"--impl-tie Generate sample TIE implementations.\n"
"--depend Generate Makefile dependencies.\n"
+ "--depend-xml Generate dependencies in XML format.\n"
+ "--depend-file FILE Write dependencies to FILE instead of standard output.\n"
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only).\n"
"--underscore Permit underscores in Slice identifiers.\n"
@@ -94,6 +96,8 @@ compile(int argc, char* argv[])
opts.addOpt("", "impl");
opts.addOpt("", "impl-tie");
opts.addOpt("", "depend");
+ opts.addOpt("", "depend-xml");
+ opts.addOpt("", "depend-file", IceUtilInternal::Options::NeedArg, "");
opts.addOpt("d", "debug");
opts.addOpt("", "ice");
opts.addOpt("", "underscore");
@@ -155,6 +159,10 @@ compile(int argc, char* argv[])
bool depend = opts.isSet("depend");
+ bool dependxml = opts.isSet("depend-xml");
+
+ string dependFile = opts.optArg("depend-file");
+
bool debug = opts.isSet("debug");
bool ice = opts.isSet("ice");
@@ -179,11 +187,24 @@ compile(int argc, char* argv[])
return EXIT_FAILURE;
}
+ if(depend && dependxml)
+ {
+ getErrorStream() << argv[0] << ": error: cannot specify both --depend and --dependxml" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
int status = EXIT_SUCCESS;
IceUtil::CtrlCHandler ctrlCHandler;
ctrlCHandler.setCallback(interruptedCallback);
+ DependOutputUtil out(dependFile);
+ if(dependxml)
+ {
+ out.os() << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<dependencies>" << endl;
+ }
+
for(vector<string>::const_iterator i = args.begin(); i != args.end(); ++i)
{
//
@@ -195,13 +216,14 @@ compile(int argc, char* argv[])
continue;
}
- if(depend)
+ if(depend || dependxml)
{
PreprocessorPtr icecpp = Preprocessor::create(argv[0], *i, cppArgs);
FILE* cppHandle = icecpp->preprocess(false, "-D__SLICE2CS__");
if(cppHandle == 0)
{
+ out.cleanup();
return EXIT_FAILURE;
}
@@ -211,17 +233,20 @@ compile(int argc, char* argv[])
if(parseStatus == EXIT_FAILURE)
{
+ out.cleanup();
return EXIT_FAILURE;
}
- if(!icecpp->printMakefileDependencies(Preprocessor::CSharp, includePaths,
+ if(!icecpp->printMakefileDependencies(out.os(), depend ? Preprocessor::CSharp : Preprocessor::SliceXML, includePaths,
"-D__SLICE2CS__"))
{
+ out.cleanup();
return EXIT_FAILURE;
}
if(!icecpp->close())
{
+ out.cleanup();
return EXIT_FAILURE;
}
}
@@ -307,12 +332,18 @@ compile(int argc, char* argv[])
if(interrupted)
{
+ out.cleanup();
FileTracker::instance()->cleanup();
return EXIT_FAILURE;
}
}
}
+ if(dependxml)
+ {
+ out.os() << "</dependencies>\n";
+ }
+
return status;
}
diff --git a/cpp/src/slice2cs/Makefile b/cpp/src/slice2cs/Makefile
index ccde4cf4c10..6d59b55654c 100644
--- a/cpp/src/slice2cs/Makefile
+++ b/cpp/src/slice2cs/Makefile
@@ -20,7 +20,7 @@ RPATH_DIR = $(LOADER_PATH)/../$(libsubdir)
include $(top_srcdir)/config/Make.rules
-CPPFLAGS := -I. $(CPPFLAGS)
+CPPFLAGS := -I. -I.. $(CPPFLAGS)
$(NAME): $(OBJS)
rm -f $@
diff --git a/cpp/src/slice2cs/Makefile.mak b/cpp/src/slice2cs/Makefile.mak
index e42a7e8d1ce..5dd2a1c0e63 100644
--- a/cpp/src/slice2cs/Makefile.mak
+++ b/cpp/src/slice2cs/Makefile.mak
@@ -18,7 +18,7 @@ OBJS = .\Gen.obj \
!include $(top_srcdir)/config/Make.rules.mak
-CPPFLAGS = -I. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
+CPPFLAGS = -I. -I.. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
!if "$(GENERATE_PDB)" == "yes"
PDBFLAGS = /pdb:$(NAME:.exe=.pdb)
diff --git a/cpp/src/slice2freeze/Makefile b/cpp/src/slice2freeze/Makefile
index 1b63be66a7e..5bc2f797773 100644
--- a/cpp/src/slice2freeze/Makefile
+++ b/cpp/src/slice2freeze/Makefile
@@ -19,7 +19,7 @@ RPATH_DIR = $(LOADER_PATH)/../$(libsubdir)
include $(top_srcdir)/config/Make.rules
-CPPFLAGS := -I. $(CPPFLAGS)
+CPPFLAGS := -I. -I.. $(CPPFLAGS)
$(NAME): $(OBJS)
rm -f $@
diff --git a/cpp/src/slice2freeze/Makefile.mak b/cpp/src/slice2freeze/Makefile.mak
index 6c5c59750ca..563c1b4889d 100644
--- a/cpp/src/slice2freeze/Makefile.mak
+++ b/cpp/src/slice2freeze/Makefile.mak
@@ -17,7 +17,7 @@ OBJS = .\Main.obj
!include $(top_srcdir)/config/Make.rules.mak
-CPPFLAGS = -I. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
+CPPFLAGS = -I. -I.. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
!if "$(GENERATE_PDB)" == "yes"
PDBFLAGS = /pdb:$(NAME:.exe=.pdb)
diff --git a/cpp/src/slice2freezej/Main.cpp b/cpp/src/slice2freezej/Main.cpp
index ae6b1beaf87..06302a5d51d 100644
--- a/cpp/src/slice2freezej/Main.cpp
+++ b/cpp/src/slice2freezej/Main.cpp
@@ -1445,6 +1445,7 @@ usage(const char* n)
"--output-dir DIR Create files in the directory DIR.\n"
"--depend Generate Makefile dependencies.\n"
"--depend-xml Generate dependencies in XML format.\n"
+ "--depend-file FILE Write dependencies to FILE instead of standard output.\n"
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only).\n"
"--underscore Permit underscores in Slice identifiers.\n"
@@ -1725,6 +1726,8 @@ compile(int argc, char* argv[])
bool depend = opts.isSet("depend");
bool dependxml = opts.isSet("depend-xml");
+ string dependFile = opts.optArg("depend-file");
+
bool debug = opts.isSet("debug");
bool ice = opts.isSet("ice");
@@ -1749,9 +1752,10 @@ compile(int argc, char* argv[])
IceUtil::CtrlCHandler ctrlCHandler;
ctrlCHandler.setCallback(interruptedCallback);
+ DependOutputUtil out(dependFile);
if(dependxml)
{
- cout << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<dependencies>" << endl;
+ out.os() << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<dependencies>" << endl;
}
for(vector<string>::size_type idx = 0; idx < args.size(); ++idx)
@@ -1763,6 +1767,7 @@ compile(int argc, char* argv[])
if(cppHandle == 0)
{
+ out.cleanup();
u->destroy();
return EXIT_FAILURE;
}
@@ -1771,19 +1776,22 @@ compile(int argc, char* argv[])
if(status == EXIT_FAILURE)
{
+ out.cleanup();
u->destroy();
return EXIT_FAILURE;
}
- if(!icecpp->printMakefileDependencies(depend ? Preprocessor::Java : Preprocessor::JavaXML, includePaths,
+ if(!icecpp->printMakefileDependencies(out.os(), depend ? Preprocessor::Java : Preprocessor::SliceXML, includePaths,
"-D__SLICE2FREEZEJ__"))
{
+ out.cleanup();
u->destroy();
return EXIT_FAILURE;
}
if(!icecpp->close())
{
+ out.cleanup();
u->destroy();
return EXIT_FAILURE;
}
@@ -1828,6 +1836,7 @@ compile(int argc, char* argv[])
if(interrupted)
{
+ out.cleanup();
return EXIT_FAILURE;
}
}
@@ -1835,7 +1844,7 @@ compile(int argc, char* argv[])
if(dependxml)
{
- cout << "</dependencies>\n";
+ out.os() << "</dependencies>\n";
}
if(depend || dependxml)
diff --git a/cpp/src/slice2freezej/Makefile b/cpp/src/slice2freezej/Makefile
index b244066aeb5..33cf5c3e931 100644
--- a/cpp/src/slice2freezej/Makefile
+++ b/cpp/src/slice2freezej/Makefile
@@ -19,7 +19,7 @@ RPATH_DIR = $(LOADER_PATH)/../$(libsubdir)
include $(top_srcdir)/config/Make.rules
-CPPFLAGS := -I. $(CPPFLAGS)
+CPPFLAGS := -I. -I.. $(CPPFLAGS)
$(NAME): $(OBJS)
rm -f $@
diff --git a/cpp/src/slice2freezej/Makefile.mak b/cpp/src/slice2freezej/Makefile.mak
index 97bac1bd5e5..e7f1a81b13d 100644
--- a/cpp/src/slice2freezej/Makefile.mak
+++ b/cpp/src/slice2freezej/Makefile.mak
@@ -17,7 +17,7 @@ OBJS = .\Main.obj
!include $(top_srcdir)/config/Make.rules.mak
-CPPFLAGS = -I. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
+CPPFLAGS = -I. -I.. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
!if "$(GENERATE_PDB)" == "yes"
PDBFLAGS = /pdb:$(NAME:.exe=.pdb)
diff --git a/cpp/src/slice2html/Makefile b/cpp/src/slice2html/Makefile
index 47f2177d6f0..e0f0f78fd85 100644
--- a/cpp/src/slice2html/Makefile
+++ b/cpp/src/slice2html/Makefile
@@ -20,7 +20,7 @@ RPATH_DIR = $(LOADER_PATH)/../$(libsubdir)
include $(top_srcdir)/config/Make.rules
-CPPFLAGS := -I. $(CPPFLAGS)
+CPPFLAGS := -I. -I.. $(CPPFLAGS)
$(NAME): $(OBJS)
rm -f $@
diff --git a/cpp/src/slice2html/Makefile.mak b/cpp/src/slice2html/Makefile.mak
index e3e52678e4c..1210ad26d4a 100644
--- a/cpp/src/slice2html/Makefile.mak
+++ b/cpp/src/slice2html/Makefile.mak
@@ -18,7 +18,7 @@ OBJS = .\Gen.obj \
!include $(top_srcdir)/config/Make.rules.mak
-CPPFLAGS = -I. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
+CPPFLAGS = -I. -I.. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
!if "$(GENERATE_PDB)" == "yes"
PDBFLAGS = /pdb:$(NAME:.exe=.pdb)
diff --git a/cpp/src/slice2java/Main.cpp b/cpp/src/slice2java/Main.cpp
index a334113a7af..fe93c7d59a3 100644
--- a/cpp/src/slice2java/Main.cpp
+++ b/cpp/src/slice2java/Main.cpp
@@ -73,6 +73,7 @@ usage(const char* n)
"--impl-tie Generate sample TIE implementations.\n"
"--depend Generate Makefile dependencies.\n"
"--depend-xml Generate dependencies in XML format.\n"
+ "--depend-file FILE Write dependencies to FILE instead of standard output.\n"
"--list-generated Emit list of generated files in XML format.\n"
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only).\n"
@@ -99,6 +100,7 @@ compile(int argc, char* argv[])
opts.addOpt("", "impl-tie");
opts.addOpt("", "depend");
opts.addOpt("", "depend-xml");
+ opts.addOpt("", "depend-file", IceUtilInternal::Options::NeedArg, "");
opts.addOpt("", "list-generated");
opts.addOpt("d", "debug");
opts.addOpt("", "ice");
@@ -162,6 +164,7 @@ compile(int argc, char* argv[])
bool depend = opts.isSet("depend");
bool dependxml = opts.isSet("depend-xml");
+ string dependFile = opts.optArg("depend-file");
bool debug = opts.isSet("debug");
@@ -200,9 +203,10 @@ compile(int argc, char* argv[])
IceUtil::CtrlCHandler ctrlCHandler;
ctrlCHandler.setCallback(interruptedCallback);
+ DependOutputUtil out(dependFile);
if(dependxml)
{
- cout << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<dependencies>" << endl;
+ out.os() << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<dependencies>" << endl;
}
for(vector<string>::const_iterator i = args.begin(); i != args.end(); ++i)
@@ -223,6 +227,7 @@ compile(int argc, char* argv[])
if(cppHandle == 0)
{
+ out.cleanup();
return EXIT_FAILURE;
}
@@ -232,18 +237,20 @@ compile(int argc, char* argv[])
if(parseStatus == EXIT_FAILURE)
{
+ out.cleanup();
return EXIT_FAILURE;
}
- if(!icecpp->printMakefileDependencies(depend ? Preprocessor::Java : Preprocessor::JavaXML, includePaths,
- "-D__SLICE2JAVA__"
- ))
+ if(!icecpp->printMakefileDependencies(out.os(), depend ? Preprocessor::Java : Preprocessor::SliceXML, includePaths,
+ "-D__SLICE2JAVA__"))
{
+ out.cleanup();
return EXIT_FAILURE;
}
if(!icecpp->close())
{
+ out.cleanup();
return EXIT_FAILURE;
}
}
@@ -361,6 +368,7 @@ compile(int argc, char* argv[])
if(interrupted)
{
+ out.cleanup();
//
// If the translator was interrupted then cleanup any files we've already created.
//
@@ -372,7 +380,7 @@ compile(int argc, char* argv[])
if(dependxml)
{
- cout << "</dependencies>\n";
+ out.os() << "</dependencies>\n";
}
if(status == EXIT_SUCCESS && !checksumClass.empty() && !dependxml)
diff --git a/cpp/src/slice2java/Makefile b/cpp/src/slice2java/Makefile
index 0d6c152f9f7..5b6afcbc512 100644
--- a/cpp/src/slice2java/Makefile
+++ b/cpp/src/slice2java/Makefile
@@ -20,7 +20,7 @@ RPATH_DIR = $(LOADER_PATH)/../$(libsubdir)
include $(top_srcdir)/config/Make.rules
-CPPFLAGS := -I. $(CPPFLAGS)
+CPPFLAGS := -I. -I.. $(CPPFLAGS)
$(NAME): $(OBJS)
rm -f $@
diff --git a/cpp/src/slice2java/Makefile.mak b/cpp/src/slice2java/Makefile.mak
index fa1eafda57b..7e1b2b88a58 100644
--- a/cpp/src/slice2java/Makefile.mak
+++ b/cpp/src/slice2java/Makefile.mak
@@ -18,7 +18,7 @@ OBJS = .\Gen.obj \
!include $(top_srcdir)/config/Make.rules.mak
-CPPFLAGS = -I. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
+CPPFLAGS = -I. -I.. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
!if "$(GENERATE_PDB)" == "yes"
PDBFLAGS = /pdb:$(NAME:.exe=.pdb)
diff --git a/cpp/src/slice2js/Main.cpp b/cpp/src/slice2js/Main.cpp
index 328b8997f60..35aca5463d4 100644
--- a/cpp/src/slice2js/Main.cpp
+++ b/cpp/src/slice2js/Main.cpp
@@ -70,6 +70,8 @@ usage(const char* n)
"--output-dir DIR Create files in the directory DIR.\n"
"--depend Generate Makefile dependencies.\n"
"--depend-json Generate Makefile dependencies in JSON format.\n"
+ "--depend-xml Generate dependencies in XML format.\n"
+ "--depend-file FILE Write dependencies to FILE instead of standard output.\n"
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only).\n"
"--underscore Permit underscores in Slice identifiers.\n"
@@ -91,6 +93,8 @@ compile(int argc, char* argv[])
opts.addOpt("", "output-dir", IceUtilInternal::Options::NeedArg);
opts.addOpt("", "depend");
opts.addOpt("", "depend-json");
+ opts.addOpt("", "depend-xml");
+ opts.addOpt("", "depend-file", IceUtilInternal::Options::NeedArg, "");
opts.addOpt("d", "debug");
opts.addOpt("", "ice");
opts.addOpt("", "underscore");
@@ -149,6 +153,10 @@ compile(int argc, char* argv[])
bool dependJSON = opts.isSet("depend-json");
+ bool dependxml = opts.isSet("depend-xml");
+
+ string dependFile = opts.optArg("depend-file");
+
bool debug = opts.isSet("debug");
bool ice = opts.isSet("ice");
@@ -164,14 +172,40 @@ compile(int argc, char* argv[])
return EXIT_FAILURE;
}
+ if(depend && dependJSON)
+ {
+ getErrorStream() << argv[0] << ": error: cannot specify both --depend and --depend-json" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ if(depend && dependxml)
+ {
+ getErrorStream() << argv[0] << ": error: cannot specify both --depend and --dependxml" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ if(dependxml && dependJSON)
+ {
+ getErrorStream() << argv[0] << ": error: cannot specify both --dependxml and --depend-json" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
int status = EXIT_SUCCESS;
IceUtil::CtrlCHandler ctrlCHandler;
ctrlCHandler.setCallback(interruptedCallback);
+ DependOutputUtil out(dependFile);
if(dependJSON)
{
- cout << "{" << endl;
+ out.os() << "{" << endl;
+ }
+ else if(dependxml)
+ {
+ out.os() << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<dependencies>" << endl;
}
//
@@ -189,13 +223,14 @@ compile(int argc, char* argv[])
for(vector<string>::const_iterator i = sources.begin(); i != sources.end();)
{
- if(depend || dependJSON)
+ if(depend || dependJSON || dependxml)
{
PreprocessorPtr icecpp = Preprocessor::create(argv[0], *i, cppArgs);
FILE* cppHandle = icecpp->preprocess(false, "-D__SLICE2JS__");
if(cppHandle == 0)
{
+ out.cleanup();
return EXIT_FAILURE;
}
@@ -205,19 +240,24 @@ compile(int argc, char* argv[])
if(parseStatus == EXIT_FAILURE)
{
+ out.cleanup();
return EXIT_FAILURE;
}
bool last = (++i == sources.end());
- if(!icecpp->printMakefileDependencies(depend ? Preprocessor::JavaScript : Preprocessor::JavaScriptJSON, includePaths,
- "-D__SLICE2JS__"))
+ if(!icecpp->printMakefileDependencies(out.os(),
+ depend ? Preprocessor::JavaScript : (dependJSON ? Preprocessor::JavaScriptJSON : Preprocessor::SliceXML),
+ includePaths,
+ "-D__SLICE2JS__"))
{
+ out.cleanup();
return EXIT_FAILURE;
}
if(!icecpp->close())
{
+ out.cleanup();
return EXIT_FAILURE;
}
@@ -225,9 +265,9 @@ compile(int argc, char* argv[])
{
if(!last)
{
- cout << ",";
+ out.os() << ",";
}
- cout << "\n";
+ out.os() << "\n";
}
}
else
@@ -306,6 +346,7 @@ compile(int argc, char* argv[])
if(interrupted)
{
+ out.cleanup();
FileTracker::instance()->cleanup();
return EXIT_FAILURE;
}
@@ -314,7 +355,11 @@ compile(int argc, char* argv[])
if(dependJSON)
{
- cout << "}" << endl;
+ out.os() << "}" << endl;
+ }
+ else if(dependxml)
+ {
+ out.os() << "</dependencies>\n";
}
return status;
diff --git a/cpp/src/slice2js/Makefile b/cpp/src/slice2js/Makefile
index 4d0bf3d7fa3..ffe0fa99b17 100644
--- a/cpp/src/slice2js/Makefile
+++ b/cpp/src/slice2js/Makefile
@@ -21,7 +21,7 @@ RPATH_DIR = $(LOADER_PATH)/../$(libsubdir)
include $(top_srcdir)/config/Make.rules
-CPPFLAGS := -I. $(CPPFLAGS)
+CPPFLAGS := -I. -I.. $(CPPFLAGS)
$(NAME): $(OBJS)
rm -f $@
diff --git a/cpp/src/slice2js/Makefile.mak b/cpp/src/slice2js/Makefile.mak
index 8652531204c..9e48db8e884 100644
--- a/cpp/src/slice2js/Makefile.mak
+++ b/cpp/src/slice2js/Makefile.mak
@@ -19,7 +19,7 @@ OBJS = .\Gen.obj \
!include $(top_srcdir)/config/Make.rules.mak
-CPPFLAGS = -I. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
+CPPFLAGS = -I. -I.. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
!if "$(GENERATE_PDB)" == "yes"
PDBFLAGS = /pdb:$(NAME:.exe=.pdb)
diff --git a/cpp/src/slice2objc/Main.cpp b/cpp/src/slice2objc/Main.cpp
index fe9189514a1..92da5f2a617 100644
--- a/cpp/src/slice2objc/Main.cpp
+++ b/cpp/src/slice2objc/Main.cpp
@@ -70,6 +70,7 @@ usage(const char* n)
"--dll-export SYMBOL Use SYMBOL for DLL exports.\n"
"--depend Generate Makefile dependencies.\n"
"--depend-xml Generate dependencies in XML format.\n"
+ "--depend-file FILE Write dependencies to FILE instead of standard output.\n"
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only)\n"
"--underscore Permit underscores in Slice identifiers.\n"
@@ -92,6 +93,7 @@ main(int argc, char* argv[])
opts.addOpt("", "dll-export", IceUtilInternal::Options::NeedArg);
opts.addOpt("", "depend");
opts.addOpt("", "depend-xml");
+ opts.addOpt("", "depend-file", IceUtilInternal::Options::NeedArg, "");
opts.addOpt("d", "debug");
opts.addOpt("", "ice");
opts.addOpt("", "underscore");
@@ -151,6 +153,7 @@ main(int argc, char* argv[])
bool depend = opts.isSet("depend");
bool dependxml = opts.isSet("depend-xml");
+ string dependFile = opts.optArg("depend-file");
bool debug = opts.isSet("debug");
@@ -165,11 +168,19 @@ main(int argc, char* argv[])
return EXIT_FAILURE;
}
+ if(depend && dependxml)
+ {
+ getErrorStream() << argv[0] << ": error: cannot specify both --depend and --dependxml" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
int status = EXIT_SUCCESS;
+ DependOutputUtil out(dependFile);
if(dependxml)
{
- cout << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<dependencies>" << endl;
+ out.os() << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<dependencies>" << endl;
}
IceUtil::CtrlCHandler ctrlCHandler;
@@ -184,6 +195,7 @@ main(int argc, char* argv[])
if(cppHandle == 0)
{
+ out.cleanup();
return EXIT_FAILURE;
}
@@ -193,17 +205,20 @@ main(int argc, char* argv[])
if(parseStatus == EXIT_FAILURE)
{
+ out.cleanup();
return EXIT_FAILURE;
}
- if(!icecpp->printMakefileDependencies(depend ? Preprocessor::ObjC : Preprocessor::JavaXML,
+ if(!icecpp->printMakefileDependencies(out.os(), depend ? Preprocessor::ObjC : Preprocessor::SliceXML,
includePaths, "-D__SLICE2OBJC__"))
{
+ out.cleanup();
return EXIT_FAILURE;
}
if(!icecpp->close())
{
+ out.cleanup();
return EXIT_FAILURE;
}
}
@@ -279,6 +294,7 @@ main(int argc, char* argv[])
if(interrupted)
{
+ out.cleanup();
FileTracker::instance()->cleanup();
return EXIT_FAILURE;
}
@@ -287,7 +303,7 @@ main(int argc, char* argv[])
if(dependxml)
{
- cout << "</dependencies>\n";
+ out.os() << "</dependencies>\n";
}
return status;
diff --git a/cpp/src/slice2objc/Makefile b/cpp/src/slice2objc/Makefile
index 244fd0a5c82..e95af7fd610 100644
--- a/cpp/src/slice2objc/Makefile
+++ b/cpp/src/slice2objc/Makefile
@@ -20,7 +20,7 @@ RPATH_DIR = $(LOADER_PATH)/../$(libsubdir)
include $(top_srcdir)/config/Make.rules
-CPPFLAGS := -I. $(CPPFLAGS)
+CPPFLAGS := -I. -I.. $(CPPFLAGS)
$(NAME): $(OBJS)
rm -f $@
diff --git a/cpp/src/slice2php/Main.cpp b/cpp/src/slice2php/Main.cpp
index bb992c77a96..39f5ecceedc 100644
--- a/cpp/src/slice2php/Main.cpp
+++ b/cpp/src/slice2php/Main.cpp
@@ -1584,6 +1584,8 @@ usage(const char* n)
"-E Print preprocessor output on stdout.\n"
"--output-dir DIR Create files in the directory DIR.\n"
"--depend Generate Makefile dependencies.\n"
+ "--depend-xml Generate dependencies in XML format.\n"
+ "--depend-file FILE Write dependencies to FILE instead of standard output.\n"
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only).\n"
"--underscore Permit underscores in Slice identifiers.\n"
@@ -1605,6 +1607,8 @@ compile(int argc, char* argv[])
opts.addOpt("E");
opts.addOpt("", "output-dir", IceUtilInternal::Options::NeedArg);
opts.addOpt("", "depend");
+ opts.addOpt("", "depend-xml");
+ opts.addOpt("", "depend-file", IceUtilInternal::Options::NeedArg, "");
opts.addOpt("d", "debug");
opts.addOpt("", "ice");
opts.addOpt("", "underscore");
@@ -1661,6 +1665,10 @@ compile(int argc, char* argv[])
bool depend = opts.isSet("depend");
+ bool dependxml = opts.isSet("depend-xml");
+
+ string dependFile = opts.optArg("depend-file");
+
bool debug = opts.isSet("debug");
bool ice = opts.isSet("ice");
@@ -1685,6 +1693,12 @@ compile(int argc, char* argv[])
IceUtil::CtrlCHandler ctrlCHandler;
ctrlCHandler.setCallback(interruptedCallback);
+ DependOutputUtil out(dependFile);
+ if(dependxml)
+ {
+ out.os() << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<dependencies>" << endl;
+ }
+
for(vector<string>::const_iterator i = args.begin(); i != args.end(); ++i)
{
//
@@ -1696,13 +1710,14 @@ compile(int argc, char* argv[])
continue;
}
- if(depend)
+ if(depend || dependxml)
{
PreprocessorPtr icecpp = Preprocessor::create(argv[0], *i, cppArgs);
FILE* cppHandle = icecpp->preprocess(false, "-D__SLICE2PHP__");
if(cppHandle == 0)
{
+ out.cleanup();
return EXIT_FAILURE;
}
@@ -1712,16 +1727,20 @@ compile(int argc, char* argv[])
if(parseStatus == EXIT_FAILURE)
{
+ out.cleanup();
return EXIT_FAILURE;
}
- if(!icecpp->printMakefileDependencies(Preprocessor::PHP, includePaths, "-D__SLICE2PHP__"))
+ if(!icecpp->printMakefileDependencies(out.os(), depend ? Preprocessor::PHP : Preprocessor::SliceXML,
+ includePaths, "-D__SLICE2PHP__"))
{
+ out.cleanup();
return EXIT_FAILURE;
}
if(!icecpp->close())
{
+ out.cleanup();
return EXIT_FAILURE;
}
}
@@ -1830,12 +1849,18 @@ compile(int argc, char* argv[])
if(interrupted)
{
+ out.cleanup();
FileTracker::instance()->cleanup();
return EXIT_FAILURE;
}
}
}
+ if(dependxml)
+ {
+ out.os() << "</dependencies>\n";
+ }
+
return status;
}
diff --git a/cpp/src/slice2php/Makefile b/cpp/src/slice2php/Makefile
index 9436e6f9f0c..e4e2fca71d3 100644
--- a/cpp/src/slice2php/Makefile
+++ b/cpp/src/slice2php/Makefile
@@ -19,7 +19,7 @@ RPATH_DIR = $(LOADER_PATH)/../$(libsubdir)
include $(top_srcdir)/config/Make.rules
-CPPFLAGS := -I. $(CPPFLAGS)
+CPPFLAGS := -I. -I.. $(CPPFLAGS)
$(NAME): $(OBJS)
rm -f $@
diff --git a/cpp/src/slice2php/Makefile.mak b/cpp/src/slice2php/Makefile.mak
index 38a49a283c0..2eb06feb889 100644
--- a/cpp/src/slice2php/Makefile.mak
+++ b/cpp/src/slice2php/Makefile.mak
@@ -17,7 +17,7 @@ OBJS = .\Main.obj
!include $(top_srcdir)/config/Make.rules.mak
-CPPFLAGS = -I. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
+CPPFLAGS = -I. -I.. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
!if "$(GENERATE_PDB)" == "yes"
PDBFLAGS = /pdb:$(NAME:.exe=.pdb)
diff --git a/cpp/src/slice2py/Makefile b/cpp/src/slice2py/Makefile
index fdd58cf87c6..aa8a5932067 100644
--- a/cpp/src/slice2py/Makefile
+++ b/cpp/src/slice2py/Makefile
@@ -19,7 +19,7 @@ RPATH_DIR = $(LOADER_PATH)/../$(libsubdir)
include $(top_srcdir)/config/Make.rules
-CPPFLAGS := -I. $(CPPFLAGS)
+CPPFLAGS := -I. -I.. $(CPPFLAGS)
$(NAME): $(OBJS)
rm -f $@
diff --git a/cpp/src/slice2py/Makefile.mak b/cpp/src/slice2py/Makefile.mak
index 26f0247f146..f8313e86836 100644
--- a/cpp/src/slice2py/Makefile.mak
+++ b/cpp/src/slice2py/Makefile.mak
@@ -17,7 +17,7 @@ OBJS = .\Main.obj
!include $(top_srcdir)/config/Make.rules.mak
-CPPFLAGS = -I. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
+CPPFLAGS = -I. -I.. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
!if "$(GENERATE_PDB)" == "yes"
PDBFLAGS = /pdb:$(NAME:.exe=.pdb)
diff --git a/cpp/src/slice2rb/Makefile b/cpp/src/slice2rb/Makefile
index 7728f3889e0..f44a3c35d06 100644
--- a/cpp/src/slice2rb/Makefile
+++ b/cpp/src/slice2rb/Makefile
@@ -19,7 +19,7 @@ RPATH_DIR = $(LOADER_PATH)/../$(libsubdir)
include $(top_srcdir)/config/Make.rules
-CPPFLAGS := -I. $(CPPFLAGS)
+CPPFLAGS := -I. -I.. $(CPPFLAGS)
$(NAME): $(OBJS)
rm -f $@
diff --git a/cpp/src/slice2rb/Makefile.mak b/cpp/src/slice2rb/Makefile.mak
index 1742e069e22..abc55490e88 100644
--- a/cpp/src/slice2rb/Makefile.mak
+++ b/cpp/src/slice2rb/Makefile.mak
@@ -17,7 +17,7 @@ OBJS = .\Main.obj
!include $(top_srcdir)/config/Make.rules.mak
-CPPFLAGS = -I. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
+CPPFLAGS = -I. -I.. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
!if "$(GENERATE_PDB)" == "yes"
PDBFLAGS = /pdb:$(NAME:.exe=.pdb)