hwmon.pl: Pass in base directory

The script needs to be told which directory to
create its output files in.

Change-Id: I1cb34ef6d5492ec06998b957f26f62f425e00b7a
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/hwmon.pl b/hwmon.pl
index 46f7b73..b784997 100755
--- a/hwmon.pl
+++ b/hwmon.pl
@@ -19,9 +19,11 @@
 };
 
 my $serverwizFile;
+my $g_outputDir;
 my @hwmon;
 
-GetOptions("x=s" => \$serverwizFile) or printUsage();
+GetOptions("x=s" => \$serverwizFile,
+           "d=s" => \$g_outputDir) or printUsage();
 
 if (not defined $serverwizFile) {
     printUsage();
@@ -270,7 +272,7 @@
                 "in the I2C master unit XML\n";
         }
 
-        $path = "ahb/apb/i2c\@$entry->{regBaseAddress}/i2c-bus@" .
+        $path = "$g_outputDir/ahb/apb/i2c\@$entry->{regBaseAddress}/i2c-bus@" .
                 "$entry->{regOffset}";
     }
     else {
@@ -293,6 +295,6 @@
 
 sub printUsage
 {
-    print "$0 -x [XML filename]\n";
+    print "$0 -x [XML filename] -d [output base directory]\n";
     exit(1);
 }