Browse Source

changed -V (version) output; added -v (verbose) option

Dave Schuyler 22 years ago
parent
commit
0855deea3f
4 changed files with 32 additions and 3 deletions
  1. 9 0
      ppremake/ppCommandFile.cxx
  2. 6 1
      ppremake/ppDirectory.cxx
  3. 16 2
      ppremake/ppremake.cxx
  4. 1 0
      ppremake/ppremake.h

+ 9 - 0
ppremake/ppCommandFile.cxx

@@ -316,6 +316,9 @@ read_file(Filename filename) {
     cerr << "Unable to open " << filename << ".\n";
     return false;
   }
+  if (verbose) {
+    cerr << "Reading (cmd) \"" << filename << "\"\n";
+  }
 
   return read_stream(in, filename);
 }
@@ -1686,6 +1689,9 @@ include_file(Filename filename) {
     cerr << "Unable to open include file " << filename << ".\n";
     return false;
   }
+  if (verbose) {
+    cerr << "Reading (inc) \"" << filename << "\"\n";
+  }
 
   PushFilename pushed(_scope, filename);
 
@@ -1999,6 +2005,9 @@ compare_output(const string &new_contents, Filename filename,
       cerr << "Cannot read existing " << filename << ", regenerating.\n";
       differ = true;
     } else {
+      if (verbose) {
+        cerr << "Reading (cmp) \"" << filename << "\"\n";
+      }
       in.read(orig_contents, want_bytes);
 
       if (in.gcount() != len) {

+ 6 - 1
ppremake/ppDirectory.cxx

@@ -448,7 +448,9 @@ read_source_file(const string &prefix, PPNamedScopes *named_scopes) {
 
   ifstream in(source_filename.c_str());
   if (in) {
-    //    cerr << "Reading " << source_filename << "\n";
+    if (verbose) {
+        cerr << "Reading (dir) \"" << source_filename << "\"\n";
+    }
 
     named_scopes->set_current(_dirname);
     _scope = named_scopes->make_scope("");
@@ -642,6 +644,9 @@ read_file_dependencies(const string &cache_filename) {
     // Can't read it.  Maybe it's not there.  No problem.
     return;
   }
+  if (verbose) {
+    cerr << "Reading (dep) \"" << cache_pathname.c_str() << "\"\n";
+  }
 
   string line;
   getline(in, line);

+ 16 - 2
ppremake/ppremake.cxx

@@ -30,6 +30,7 @@ bool unix_platform = false;
 bool windows_platform = false;
 bool dry_run = false;
 bool verbose_dry_run = false;
+bool verbose = false;
 
 static void
 usage() {
@@ -68,6 +69,7 @@ usage() {
 
     "  -h           Display this page.\n"
     "  -V           Report the version of ppremake, and exit.\n"
+    "  -v           Turn on verbose output (may help in debugging .pp files).\n"
     "  -P           Report the current platform name, and exit.\n\n"
     "  -D pp.dep    Examine the given dependency file, and re-run ppremake\n"
     "               only if the dependency file is stale.\n\n"
@@ -93,7 +95,9 @@ usage() {
 
 static void
 report_version() {
-  cerr << "This is " << PACKAGE << " version " << VERSION << ".\n";
+  cerr << "This is " << PACKAGE << " version " << VERSION 
+       << " built on " << __DATE__ << " at " << __TIME__
+       << ".\n";
 }
 
 static void
@@ -147,6 +151,9 @@ check_one_file(const string &dir_prefix, const vector<string> &words) {
     // Can't read the file for some reason.
     return false;
   }
+  if (verbose) {
+    cerr << "Reading (one) \"" << pathname.c_str() << "\"\n";
+  }
 
   string line;
   getline(in, line);
@@ -184,6 +191,9 @@ check_dependencies(const string &dep_filename) {
     // stale.
     return false;
   }
+  if (verbose) {
+    cerr << "Reading (chk) \"" << dep_filename.c_str() << "\"\n";
+  }
 
   string line;
   getline(in, line);
@@ -210,7 +220,7 @@ main(int argc, char *argv[]) {
   string progname = argv[0];
   extern char *optarg;
   extern int optind;
-  const char *optstr = "hVPD:drnNp:c:s:";
+  const char *optstr = "hVvPD:drnNp:c:s:";
 
   bool any_d = false;
   bool dependencies_stale = false;
@@ -240,6 +250,10 @@ main(int argc, char *argv[]) {
       exit(0);
       break;
 
+    case 'v':
+      verbose=true;
+      break;
+
     case 'P':
       report_platform();
       exit(0);

+ 1 - 0
ppremake/ppremake.h

@@ -91,6 +91,7 @@ extern bool windows_platform;
 /* This is a command-line global parameter. */
 extern bool dry_run;
 extern bool verbose_dry_run;
+extern bool verbose;
 #endif
 
 /* These are defined so that we may build Filename, DSearchPath, and