Browse Source

add new binary option

David Rose 19 years ago
parent
commit
76a6b01a56

+ 4 - 1
ppremake/config_msvc.h

@@ -21,6 +21,9 @@
 /* Define if we're compiling with Cygwin. */
 /* #undef HAVE_CYGWIN */
 
+/* Define if we're compiling for OSX. */
+/* #undef HAVE_OSX */
+
 /* Define if we're compiling using Windows Microsoft Visual C++. */
 #define WIN32_VC 1
 
@@ -86,5 +89,5 @@
  **         Also be sure to change the version number        **
  **             at the beginning of configure.in.            **
  ****************                              ****************/
-#define VERSION "1.20"
+#define VERSION "1.21"
 /****************  UPDATE VERSION NUMBER HERE  ****************/

+ 5 - 1
ppremake/configure.in

@@ -5,7 +5,7 @@ dnl ****************  UPDATE VERSION NUMBER HERE  ****************
 dnl **         Also be sure to change the version number        **
 dnl **                at the end of config_msvc.h.              **
 dnl ****************                              ****************
-AM_INIT_AUTOMAKE(ppremake, 1.20)
+AM_INIT_AUTOMAKE(ppremake, 1.21)
 dnl ****************  UPDATE VERSION NUMBER HERE  ****************
 
 AM_CONFIG_HEADER(config.h)
@@ -82,6 +82,10 @@ if test "$PLATFORM" = "Cygwin"; then
   AC_DEFINE(HAVE_CYGWIN, 1, [Define if we're compiling with Cygwin.])
 fi
 
+if test "$PLATFORM" = "OSX"; then
+  AC_DEFINE(HAVE_OSX, 1, [Define if we're compiling for OSX.])
+fi
+
 AC_DEFINE_UNQUOTED(PLATFORM, "$PLATFORM", 
    [The platform ppremake is compiled for.  This primarily controls the
     initial setting of the PLATFORM ppremake variable.])

+ 15 - 4
ppremake/ppCommandFile.cxx

@@ -1138,6 +1138,8 @@ handle_output_command() {
   for (int i = 0; i < (int)words.size(); i++) {
     if (words[i] == "notouch") {
       nest->_flags |= OF_notouch;
+    } else if (words[i] == "binary") {
+      nest->_flags |= OF_binary;
     } else {
       cerr << "Invalid output flag: " << words[i] << "\n";
       errors_occurred = true;
@@ -1281,7 +1283,8 @@ handle_end_command() {
 #endif  // HAVE_SSTREAM
 
       if (!compare_output(generated_file, nest->_params,
-                          (nest->_flags & OF_notouch) != 0)) {
+                          (nest->_flags & OF_notouch) != 0,
+                          (nest->_flags & OF_binary) != 0)) {
         return false;
       }
     }
@@ -2103,8 +2106,12 @@ replay_formap(const string &varname, const string &mapvar) {
 ////////////////////////////////////////////////////////////////////
 bool PPCommandFile::
 compare_output(const string &new_contents, Filename filename,
-               bool notouch) {
-  filename.set_text();
+               bool notouch, bool binary) {
+  if (binary) {
+    filename.set_binary();
+  } else {
+    filename.set_text();
+  }    
   bool exists = filename.exists();
   bool differ = false;
 
@@ -2139,7 +2146,11 @@ compare_output(const string &new_contents, Filename filename,
       // Write our new contents to a file so we can run diff on both
       // of them.
       Filename temp_filename = filename.get_fullpath() + string(".ppd");
-      temp_filename.set_text();
+      if (binary) {
+        temp_filename.set_binary();
+      } else {
+        temp_filename.set_text();
+      }    
       ofstream out_b;
       if (!temp_filename.open_write(out_b)) {
         cerr << "Unable to open temporary file " << filename << " for writing.\n";

+ 2 - 1
ppremake/ppCommandFile.h

@@ -78,7 +78,7 @@ protected:
   bool replay_foreach(const string &varname, const vector<string> &words);
   bool replay_formap(const string &varname, const string &mapvar);
   bool compare_output(const string &new_contents, Filename filename,
-                      bool notouch);
+                      bool notouch, bool binary);
   bool failed_if() const;
 
   bool is_valid_formal(const string &formal_parameter_name) const;
@@ -154,6 +154,7 @@ private:
 
   enum OutputFlags {
     OF_notouch  = 0x001,
+    OF_binary   = 0x002,
   };
   
   class BlockNesting {

+ 8 - 2
ppremake/ppScope.cxx

@@ -1492,14 +1492,20 @@ expand_libtest(const string &params) {
     found = libname.resolve_filename(directories);
   }
   
-#else
+#else  // WIN32
   libname = "lib" + libname.get_basename() + ".a";
   found = libname.resolve_filename(directories);
   if (!found) {
     libname.set_extension("so");
     found = libname.resolve_filename(directories);
   }
-#endif
+#ifdef HAVE_OSX
+  if (!found) {
+    libname.set_extension("dylib");
+    found = libname.resolve_filename(directories);
+  }
+#endif  // HAVE_OSX
+#endif  // WIN32
 
   if (found) {
     return libname.get_fullpath();

+ 2 - 1
ppremake/ppremake.cxx

@@ -139,7 +139,8 @@ static void
 report_version() {
   cerr << "This is " << PACKAGE << " version " << VERSION 
        << " built on " << __DATE__ << " at " << __TIME__
-       << ".\n";
+       << ".\n"
+       << "Default platform is \"" << PLATFORM << "\".\n";
 }
 
 static void