Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.7 KiB

  1. while ($_ = $ARGV[0], /^-/) {
  2. shift;
  3. last if /^--$/;
  4. /^-d(.*)/i && ($targetroot = $1);
  5. /^-f(.*)/i && ($projectfile = $1);
  6. /^-p(.*)/i && ($platformfilter = $1);
  7. }
  8. ($targetroot && $projectfile) ||
  9. die "Usage: Convert2Alpha.pl -D<target root dir> -F<project ini file> [-P<platform filter>]\n";
  10. open (FILE, $projectfile) || die "Error opening $projectfile!\n";
  11. while (<FILE>) {
  12. /^\[.*\/(.*)\]/ && ($projectname = $1);
  13. if ( $projectname ) {
  14. /^Directory=(.*)/i && ($directory{$projectname} = $1);
  15. /^ProjectFile=(.*)/i && ($projectfile{$projectname} = $1);
  16. /^Platform=(.*)/i && ($platform{$projectname} = $1);
  17. }
  18. }
  19. close FILE;
  20. foreach $project (sort keys %projectfile) {
  21. if ( !$platformfilter || ($platform{$project} =~ /$platformfilter/i) ) {
  22. $targetdir = "$targetroot\\$directory{$project}";
  23. $dspfile = "$targetdir\\$projectfile{$project}";
  24. if ( -f "$dspfile.i386" ) {
  25. system ("del /f $dspfile.i386");
  26. }
  27. rename ("$dspfile", "$dspfile.i386") || die "Error renaming $dspfile to $dspfile.i386: $!.\n";
  28. open (INFILE, "<$dspfile.i386") || die "Error opening file $dspfile.i386: $!.\n";
  29. open (OUTFILE, ">$dspfile") || die "Error opening file $dspfile: $!.\n";
  30. print "Converting $dspfile to ALPHA...\n";
  31. $num = 6;
  32. while (<INFILE>) {
  33. s/(.*TARGTYPE.*0x0)1([0-9][0-9])/$1$num$2/;
  34. s/Win32 \(x86\)/Win32 (ALPHA)/g;
  35. s/(Win32 )(Debug|Release)/$1(ALPHA) $2/g;
  36. s/machine:I386/machine:ALPHA/g;
  37. s/(samlib|nwuser|fpnwclnt|ntdll)(.lib)/$1alpha$2/gi;
  38. print OUTFILE;
  39. }
  40. close INFILE, OUTFILE;
  41. chmod 0444, "$dspfile";
  42. }
  43. }
  44. exit 0;