diff --git a/ppremake/config_msvc.h b/ppremake/config_msvc.h index 2ebb05fe47..3b4c01599d 100644 --- a/ppremake/config_msvc.h +++ b/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 ****************/ diff --git a/ppremake/configure.in b/ppremake/configure.in index 7bf3d1e498..49b8f5f7c2 100644 --- a/ppremake/configure.in +++ b/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.]) diff --git a/ppremake/ppCommandFile.cxx b/ppremake/ppCommandFile.cxx index 810c6485c2..2d7ca71a60 100644 --- a/ppremake/ppCommandFile.cxx +++ b/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"; diff --git a/ppremake/ppCommandFile.h b/ppremake/ppCommandFile.h index 9496d2340a..965d72ab43 100644 --- a/ppremake/ppCommandFile.h +++ b/ppremake/ppCommandFile.h @@ -78,7 +78,7 @@ protected: bool replay_foreach(const string &varname, const vector &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 { diff --git a/ppremake/ppScope.cxx b/ppremake/ppScope.cxx index 4be0622efd..ff3117e40d 100644 --- a/ppremake/ppScope.cxx +++ b/ppremake/ppScope.cxx @@ -1492,14 +1492,20 @@ expand_libtest(const string ¶ms) { 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(); diff --git a/ppremake/ppremake.cxx b/ppremake/ppremake.cxx index 95b51c1a8e..3d3f79c954 100644 --- a/ppremake/ppremake.cxx +++ b/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