1#! /usr/bin/env perl 2# Copyright 2014-2017 The OpenSSL Project Authors. All Rights Reserved. 3# 4# Licensed under the Apache License 2.0 (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 9use strict; 10use warnings; 11 12my ($cflags, $platform) = @ARGV; 13$cflags = "compiler: $cflags"; 14 15# Use the value of the envvar SOURCE_DATE_EPOCH, even if it's 16# zero or the empty string. 17my $date = gmtime($ENV{'SOURCE_DATE_EPOCH'} // time()) . " UTC"; 18 19print <<"END_OUTPUT"; 20/* 21 * WARNING: do not edit! 22 * Generated by util/mkbuildinf.pl 23 * 24 * Copyright 2014-2017 The OpenSSL Project Authors. All Rights Reserved. 25 * 26 * Licensed under the Apache License 2.0 (the "License"). You may not use 27 * this file except in compliance with the License. You can obtain a copy 28 * in the file LICENSE in the source distribution or at 29 * https://www.openssl.org/source/license.html 30 */ 31 32#define PLATFORM "platform: $platform" 33#define DATE "built on: $date" 34 35/* 36 * Generate compiler_flags as an array of individual characters. This is a 37 * workaround for the situation where CFLAGS gets too long for a C90 string 38 * literal 39 */ 40static const char compiler_flags[] = { 41END_OUTPUT 42 43my $ctr = 0; 44foreach my $c (split //, $cflags) { 45 $c =~ s|([\\'])|\\$1|; 46 # Max 16 characters per line 47 if (($ctr++ % 16) == 0) { 48 if ($ctr != 1) { 49 print "\n"; 50 } 51 print " "; 52 } 53 print "'$c',"; 54} 55print <<"END_OUTPUT"; 56'\\0' 57}; 58END_OUTPUT 59