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