This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
op.c: Remove unnecessary flag
[perl5.git] / vms / mms2make.pl
index 54db616..7795e4a 100644 (file)
@@ -1,10 +1,10 @@
 #!/usr/bin/perl
 #
 #  mms2make.pl - convert Descrip.MMS file to Makefile
-#  Version 2.0 29-Sep-1994
+#  Version 2.2 29-Jan-1996
 #  David Denholm <denholm@conmat.phys.soton.ac.uk>
 #
-#  1.0  06-Aug-1994  Charles Bailey  bailey@genetics.upenn.edu
+#  1.0  06-Aug-1994  Charles Bailey  bailey@newman.upenn.edu
 #    - original version
 #  2.0  29-Sep-1994  David Denholm <denholm@conmat.phys.soton.ac.uk>
 #    - take action based on MMS .if / .else / .endif
 #      we deselect any other line if $conditions[0] is 0
 #      I'm being very lazy - push a 1 at start, then dont need to check for
 #      an empty @conditions [assume nesting in descrip.mms is correct] 
+#  2.1  26-Feb-1995  Charles Bailey  bailey@newman.upenn.edu
+#    - handle MMS macros generated by MakeMaker
+#  2.2  29-Jan-1996  Charles Bailey  bailey@newman.upenn.edu
+#    - Fix output file name to work under Unix
 
 if ($#ARGV > -1 && $ARGV[0] =~ /^[\-\/]trim/i) {
   $do_trim = 1;
   shift @ARGV;
 }
 $infile  = $#ARGV > -1 ? shift(@ARGV) : "Descrip.MMS";
-$outfile = $#ARGV > -1 ? shift(@ARGV) : "Makefile.";
+$outfile = $#ARGV > -1 ? shift(@ARGV) : "Makefile";
 
 # set any other args in %macros - set VAXC by default
 foreach (@ARGV) { $macros{"\U$_"}=1 }
@@ -83,6 +87,22 @@ while (<INFIL>) {
     else { $firstsrc = "\$<" }
   }
 
+#convert macros we expect to see in MakeMaker-generated Descrip.MMSs
+  s#/Descrip=\s*\n#-f \nMMS = make\n#;
+  s#/Macro=\(# #;
+  s#MACROEND = \)#MACROEND = #;
+  if (m#\$\(USEMACROS\)(.*)(\$\(MACROEND\))?#) {
+    while (1) {
+      my($macros,$end) = ($1,$2);
+      $macros =~ s/,/ /g;  # We're hosed if there're commas within a macro -
+                           # someday, check for "" and skip contents
+      last if $end;
+      print OUTFIL $conditions[0] ? "#> " : "",$_;
+      $_ = <INFIL>;
+      m#(.*)(\$\(MACROEND\))?#;
+    }
+  }
+
   s/^ +/\t/;
   s/^\.first/\.first:/i;
   s/^\.suffixes/\.suffixes:/i;