blob: 5bf0168b6a7c889f2355095b4169a9db6db14123 [file] [log] [blame]
Rich Salze0a65192016-04-19 22:10:43 -04001#! /usr/bin/env perl
2# Copyright 2014-2016 The OpenSSL Project Authors. All Rights Reserved.
3#
4# Licensed under the OpenSSL license (the "License"). You may not use
5# this file except in compliance with the License. You can obtain a copy
6# in the file LICENSE in the source distribution or at
7# https://www.openssl.org/source/license.html
8
Matt Caswell488f16e2014-12-19 10:55:54 +00009
10my ($cflags, $platform) = @ARGV;
11
12$cflags = "compiler: $cflags";
13$date = localtime();
14print <<"END_OUTPUT";
Richard Levittef4a748a2016-02-10 19:11:40 +010015/* auto-generated by util/mkbuildinf.pl for crypto/cversion.c */
16#define CFLAGS cflags
17/*
18 * Generate CFLAGS as an array of individual characters. This is a
19 * workaround for the situation where CFLAGS gets too long for a C90 string
20 * literal
21 */
22static const char cflags[] = {
Matt Caswell488f16e2014-12-19 10:55:54 +000023END_OUTPUT
24my $ctr = 0;
25foreach my $c (split //, $cflags) {
Richard Levitte9ca25292016-02-10 19:06:54 +010026 $c =~ s|([\\'])|\\$1|;
Richard Levitte124cbe12016-02-10 23:31:43 +010027 # Max 16 characters per line
Richard Levitte9ca25292016-02-10 19:06:54 +010028 if (($ctr++ % 16) == 0) {
Matt Caswellb6911542015-01-06 15:32:01 +000029 if ($ctr != 1) {
Matt Caswell488f16e2014-12-19 10:55:54 +000030 print "\n";
31 }
Richard Levittef4a748a2016-02-10 19:11:40 +010032 print " ";
Matt Caswell488f16e2014-12-19 10:55:54 +000033 }
34 print "'$c',";
35}
36print <<"END_OUTPUT";
37'\\0'
Richard Levittef4a748a2016-02-10 19:11:40 +010038};
39#define PLATFORM "platform: $platform"
40#define DATE "built on: $date"
Matt Caswell488f16e2014-12-19 10:55:54 +000041END_OUTPUT