Matt Caswell | 488f16e | 2014-12-19 10:55:54 +0000 | [diff] [blame^] | 1 | #!/usr/local/bin/perl |
| 2 | |
| 3 | my ($cflags, $platform) = @ARGV; |
| 4 | |
| 5 | $cflags = "compiler: $cflags"; |
| 6 | $date = localtime(); |
| 7 | print <<"END_OUTPUT"; |
| 8 | #ifndef MK1MF_BUILD |
| 9 | /* auto-generated by util/mkbuildinf.pl for crypto/cversion.c */ |
| 10 | #define CFLAGS |
| 11 | /* |
| 12 | * Generate CFLAGS as an array of individual characters. This is a |
| 13 | * workaround for the situation where CFLAGS gets too long for a C90 string |
| 14 | * literal |
| 15 | */ |
| 16 | static const char cflags[] = { |
| 17 | END_OUTPUT |
| 18 | my $ctr = 0; |
| 19 | foreach my $c (split //, $cflags) { |
| 20 | # Max 18 characters per line |
| 21 | if (($ctr++ % 18) == 0) { |
| 22 | if ($ctr != 0) { |
| 23 | print "\n"; |
| 24 | } |
| 25 | print " "; |
| 26 | } |
| 27 | print "'$c',"; |
| 28 | } |
| 29 | print <<"END_OUTPUT"; |
| 30 | '\\0' |
| 31 | }; |
| 32 | #define PLATFORM "platform: $platform" |
| 33 | #define DATE "built on: $date" |
| 34 | #endif |
| 35 | END_OUTPUT |