make: Fix nasm build with MSVC
authorMarat Dukhan <maratek@gmail.com>
Sat, 29 Jun 2013 21:30:44 +0000 (01:30 +0400)
committerCyrill Gorcunov <gorcunov@gmail.com>
Sat, 29 Jun 2013 21:31:15 +0000 (01:31 +0400)
http://bugzilla.nasm.us/show_bug.cgi?id=3392258

Signed-off-by: Marat Dukhan <maratek@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Mkfiles/msvc.mak
directiv.pl
pptok.pl

index 65efd6c..583cc2c 100644 (file)
@@ -94,8 +94,10 @@ version.mac: version version.pl
 # `standard.mac' by another Perl script. Again, it's part of the
 # standard distribution.
 
-macros.c: macros.pl standard.mac version.mac
-       $(PERL) $(srcdir)/macros.pl $(srcdir)/standard.mac version.mac
+macros.c: macros.pl pptok.ph standard.mac version.mac \
+       $(srcdir)/macros/*.mac $(srcdir)/output/*.mac
+       $(PERL) $(srcdir)/macros.pl $(srcdir)/standard.mac version.mac \
+               $(srcdir)/macros/*.mac $(srcdir)/output/*.mac
 
 # These source files are generated from regs.dat by yet another
 # perl script.
@@ -105,6 +107,8 @@ regflags.c: regs.dat regs.pl
        $(PERL) $(srcdir)/regs.pl fc $(srcdir)/regs.dat > regflags.c
 regdis.c: regs.dat regs.pl
        $(PERL) $(srcdir)/regs.pl dc $(srcdir)/regs.dat > regdis.c
+regdis.h: regs.dat regs.pl
+       $(PERL) $(srcdir)/regs.pl dh $(srcdir)/regs.dat > regdis.h
 regvals.c: regs.dat regs.pl
        $(PERL) $(srcdir)/regs.pl vc $(srcdir)/regs.dat > regvals.c
 regs.h: regs.dat regs.pl
@@ -125,6 +129,14 @@ pptok.h: pptok.dat pptok.pl perllib/phash.ph
        $(PERL) $(srcdir)/pptok.pl h $(srcdir)/pptok.dat pptok.h
 pptok.c: pptok.dat pptok.pl perllib/phash.ph
        $(PERL) $(srcdir)/pptok.pl c $(srcdir)/pptok.dat pptok.c
+pptok.ph: pptok.dat pptok.pl perllib/phash.ph
+       $(PERL) $(srcdir)/pptok.pl ph $(srcdir)/pptok.dat pptok.ph
+
+# Directives hash
+directiv.h: directiv.dat directiv.pl perllib/phash.ph
+       $(PERL) $(srcdir)/directiv.pl h $(srcdir)/directiv.dat directiv.h
+directiv.c: directiv.dat directiv.pl perllib/phash.ph
+       $(PERL) $(srcdir)/directiv.pl c $(srcdir)/directiv.dat directiv.c
 
 # This target generates all files that require perl.
 # This allows easier generation of distribution (see dist target).
index 01af235..51d0ec3 100755 (executable)
@@ -35,7 +35,9 @@
 #
 # Generate a perfect hash for directive parsing
 #
-# Usage: directiv.pl directiv.dat directiv.c directiv.h
+# Usage:
+#      directiv.pl h directiv.dat directiv.h (to generate C header)
+#      directiv.pl c directiv.dat directiv.c (to generate C source)
 #
 
 require 'phash.ph';
index be85b94..1ea2e7e 100755 (executable)
--- a/pptok.pl
+++ b/pptok.pl
@@ -45,7 +45,7 @@ my($what, $in, $out) = @ARGV;
 #
 open(IN, "< $in") or die "$0: cannot open: $in\n";
 while (defined($line = <IN>)) {
-    chomp $line;
+    $line =~ s/\r?\n$//;       # Remove trailing \r\n or \n
     $line =~ s/^\s+//;         # Remove leading whitespace
     $line =~ s/\s*\#.*$//;     # Remove comments and trailing whitespace
     next if ($line eq '');