Commit f5b2106a63ace92faf1bc889435823e32c22796a

Daniel Mendler 2019-06-07T00:18:51

helper.pl: don't use sed, support CC variable for preprocessing

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/helper.pl b/helper.pl
index c7b8760..424e518 100755
--- a/helper.pl
+++ b/helper.pl
@@ -363,8 +363,9 @@ EOS
             read $src, $content, -s $src;
             close $src;
         } else {
-            my $cmd = "gcc -E -x c -DLTM_ALL $filename | sed '/# 1 \"$filename\"/,/# 2 \"$filename\"/d'";
-            $content = qx/$cmd/;
+            my $cc = $ENV{'CC'} || 'gcc';
+            $content = `$cc -E -x c -DLTM_ALL $filename`;
+            $content =~ s/^# 1 "$filename".*?^# 2 "$filename"//ms;
         }
 
         # convert filename to upper case so we can use it as a define