Configurations/unix-Makefile.tmpl: don't count on -E -P.
authorAndy Polyakov <appro@openssl.org>
Mon, 2 May 2016 21:38:11 +0000 (23:38 +0200)
committerAndy Polyakov <appro@openssl.org>
Tue, 3 May 2016 18:57:00 +0000 (20:57 +0200)
Some non-Gnu compilers interpret -E -P combination differently.
some prioritize -E over -P, others -P over -E (in which case .i
file is generated and sometimes truncated because of redirection).

Reviewed-by: Richard Levitte <levitte@openssl.org>
Configurations/unix-Makefile.tmpl

index 974a978fb3ebf8f8689cc92fa977ec66231dc6fa..ea3b7083e6b8a62da4b8ac5d751df0b2ece79929 100644 (file)
@@ -846,7 +846,9 @@ EOF
 $target: $args{generator}->[0] $deps
        ( trap "rm -f \$@.*" INT 0; \\
          $generator \$@.S; \\
-         \$(CC) \$(CFLAGS) $incs -E -P \$@.S > \$@.i && mv -f \$@.i \$@ )
+         \$(CC) \$(CFLAGS) $incs -E \$@.S | \\
+         \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@.i && \\
+         mv -f \$@.i \$@ )
 EOF
               }
               # Otherwise....
@@ -857,7 +859,8 @@ EOF
           }
           return <<"EOF";
 $args{src}: $args{generator}->[0] $deps
-       \$(CC) \$(CFLAGS) $incs -E -P \$< > \$@
+       \$(CC) \$(CFLAGS) $incs -E \$< | \\
+       \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
 EOF
       }
   }