wrowe       00/12/04 12:39:58

  Added:       test     MakeWin32Make.pl
  Log:
    Test Makefile.in -> Makefile converter for Win32 ... I'll wrap with a
    .dsp soonish.  I have no issues with using a .pl for apr/test builders,
    since they are the exception, rather than the typical user.
  
  Revision  Changes    Path
  1.1                  apr/test/MakeWin32Make.pl
  
  Index: MakeWin32Make.pl
  ===================================================================
  use IO::File;
  
  $srcfl = new IO::File "Makefile.in", "r" || die "failed to open .in file";
  $dstfl = new IO::File "Makefile", "w" || die "failed to create Makefile";
  
  print $dstfl "LINK=link.exe\n";
  
  while ($t = <$srcfl>) {
  
      if ($t =~ s|[EMAIL PROTECTED]@|\/nologo \/MDd \/W3 \/Gm \/GX \/Zi \/Od 
\/D "_DEBUG" \/D "WIN32" \/D APR_DECLARE_STATIC \/FD|) {
          $t =~ s|-g ||;
      }
      $t =~ s|[EMAIL PROTECTED]@|\/nologo \/debug \/machine:I386|;
  
      $t =~ s|[EMAIL PROTECTED]@|del|;
      $t =~ s|(\$\(RM\)) -f|$1|;
      $t =~ s|[EMAIL PROTECTED]@|cl|;
      $t =~ s|[EMAIL PROTECTED]@||;
      $t =~ s|[EMAIL PROTECTED]@||;
      $t =~ s|[EMAIL PROTECTED]@|kernel32\.lib user32\.lib advapi32\.lib 
ws2_32\.lib wsock32\.lib|;
      $t =~ s|-I\$\(INCDIR\)|\/I "\$\(INCDIR\)"|;
      $t =~ s|\.\.\/libapr\.a|\.\./LibD/apr\.lib|;
      if ($t =~ s|[EMAIL PROTECTED]@|\.exe|) {
          $t =~ s|\$\(CC\) \$\(CFLAGS\)|\$\(LINK\) \/subsystem:console|;
          $t =~ s|-o (\S+)|\/out:\"$1\"|;
          $t =~ s|--export-dynamic ||; 
          $t =~ s|-fPIC ||;
      }
      if ($t =~ s|\$\(CC\) -shared|\$\(LINK\) \/subsystem:windows \/dll|) {
          $t =~ s|-o (\S+)|\/out:\"$1\"|;
      }
      while ($t =~ s|\.a\b|\.lib|) {}
      while ($t =~ s|\.o\b|\.obj|) {}
      while ($t =~ s|\.so\b|\.dll|) {}
  
      print $dstfl $t;
  
  }
  
  undef $srcfl;
  undef $dstfl;
  
  
  

Reply via email to