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|;
17
print "Testing " . $root . "\n";
22
$thisroot = $File::Find::dir;
23
$thisroot =~ s|^./(.*)$|$1|;
24
$thisroot =~ s|/|\\\\|g;
25
$thisroot = $root . "\\\\" . $thisroot;
29
#print "Processing " . $thisroot . " of " . $_ . "\n";
30
$srcfl = new IO::File $_, "r" || die;
31
$dstfl = new IO::File $tname, "w" || die;
32
while ($src = <$srcfl>) {
33
if ($src =~ m|^\s*($root[^\"]*)\".*$|) {
34
#print "Found " . $1 . "\"\n";
37
while (!($src =~ s|$orig|$repl|)) {
38
#print "Tried replacing " . $orig . " with " . $repl . "\n";
39
if (!($orig =~ s|^(.*)\\\\[^\\]+$|$1|)) {
44
#print "Replaced " . $orig . " with " . $repl . "\n";
53
rename $tname, $oname || die;
54
print "Corrected absolute paths within " . $oname . " in " . $File::Find::dir . "\n";
60
$dname =~ s/.mak$/.dsp/;
61
@dstat = stat($dname);
62
@ostat = stat($oname);
63
if ($ostat[9] && $dstat[9] && ($ostat[9] != $dstat[9])) {
65
utime $dstat[9], $dstat[9], @onames;
66
print "Touched datestamp for " . $oname . " in " . $File::Find::dir . "\n";
68
$oname =~ s/.mak$/.dep/;
69
@ostat = stat($oname);
70
if ($ostat[9] && $dstat[9] && ($ostat[9] != $dstat[9])) {
72
utime $dstat[9], $dstat[9], @onames;
73
print "Touched datestamp for " . $oname . " in " . $File::Find::dir . "\n";