blob: c9ada406c511951efdcf92b0ed4dd998ae9a84e2 [file] [log] [blame]
#!/usr/bin/env bash
# Copyright 2020 The Fuchsia Authors
#
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT
set -e -o pipefail
readonly VERSION_STRING_FILE="$1"
readonly KERNEL_SYMBOL_FILE="$<("$3")"
readonly OUTPUT="$2"
readonly MIN_SIZE=52
SIZE=$(wc -c < "$VERSION_STRING_FILE")
if [ $SIZE -lt $MIN_SIZE ]; then
SIZE=$MIN_SIZE
fi
CONTENTS="// This file is generated by $0. DO NOT EDIT!
#define VERSION_STRING_FILE \"${VERSION_STRING_FILE}\"
#define VERSION_STRING_SIZE $SIZE"
if [ ! -r "$OUTPUT" ] || [ "$(<"$OUTPUT")" != "$CONTENTS" ]; then
echo "$CONTENTS" > "$OUTPUT"
fi