From 0855deea3f9407319b9aa43612ca71e2e2ed8259 Mon Sep 17 00:00:00 2001 From: Dave Schuyler Date: Fri, 1 Aug 2003 04:33:34 +0000 Subject: [PATCH] changed -V (version) output; added -v (verbose) option --- ppremake/ppCommandFile.cxx | 9 +++++++++ ppremake/ppDirectory.cxx | 7 ++++++- ppremake/ppremake.cxx | 18 ++++++++++++++++-- ppremake/ppremake.h | 1 + 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/ppremake/ppCommandFile.cxx b/ppremake/ppCommandFile.cxx index fa57751f4c..019e4615dd 100644 --- a/ppremake/ppCommandFile.cxx +++ b/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) { diff --git a/ppremake/ppDirectory.cxx b/ppremake/ppDirectory.cxx index c112fdb828..1991b7b3cb 100644 --- a/ppremake/ppDirectory.cxx +++ b/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); diff --git a/ppremake/ppremake.cxx b/ppremake/ppremake.cxx index d77553dddf..ab695ab958 100644 --- a/ppremake/ppremake.cxx +++ b/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 &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); diff --git a/ppremake/ppremake.h b/ppremake/ppremake.h index 67738f353f..d781e99b09 100644 --- a/ppremake/ppremake.h +++ b/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