2 # fixwin32mak.pl ::: Apache/Win32 maintanace program
4 # This program, launched from the build/ directory, replaces all nasty absoulute paths
5 # in the win32 .mak files with the appropriate relative root.
7 # Run this program prior to committing or packaging any newly exported make files.
14 # ignore our own direcory (allowing us to move into any parallel tree)
15 $root =~ s|^.:(.*)?$|cd "$1|;
18 $altroot =~ s| ".:| "|;
19 print "Stripping " . $root . " and " . $altroot . "\n";
24 $thisroot = $File::Find::dir;
25 $thisroot =~ s|^./(.*)$|$1|;
26 $thisroot =~ s|/|\\\\|g;
27 $thisroot = $root . "\\\\" . $thisroot;
28 $thisaltroot = $altroot . "\\\\" . $thisroot;
32 $srcfl = new IO::File $_, "r" || die;
33 $dstfl = new IO::File $tname, "w" || die;
34 while ($src = <$srcfl>) {
35 if ($src =~ m|^\s*($root[^\"]*)\".*$|) {
37 } elsif ($src =~ m|^\s*($altroot[^\"]*)\".*$|) {
42 while (!($src =~ s|$orig|$repl|)) {
43 if (!($orig =~ s|^(.*)\\\\[^\\]+$|$1|)) {
48 print "Replaced " . $orig . " with " . $repl . "\n";
58 rename $tname, $oname || die;
59 print "Corrected absolute paths within " . $oname . " in " . $File::Find::dir . "\n";
65 $dname =~ s/.mak$/.dsp/;
66 @dstat = stat($dname);
67 @ostat = stat($oname);
68 if ($ostat[9] && $dstat[9] && ($ostat[9] != $dstat[9])) {
70 utime $dstat[9], $dstat[9], @onames;
71 print "Touched datestamp for " . $oname . " in " . $File::Find::dir . "\n";
73 $oname =~ s/.mak$/.dep/;
74 @ostat = stat($oname);
75 if ($ostat[9] && $dstat[9] && ($ostat[9] != $dstat[9])) {
77 utime $dstat[9], $dstat[9], @onames;
78 print "Touched datestamp for " . $oname . " in " . $File::Find::dir . "\n";