blob: 9ca68f435fca5cfcc703839b33b44fdf2556f039 [file] [log] [blame]
#!/bin/bash
#
# Copyright 2022 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
if [[ $# -ne 3 ]]; then
echo >&2 "Usage: $0 RSPFILE OUTPUT DEFILE"
exit 2
fi
readonly RSPFILE="$1" # Name of link_output_rspfile() output.
readonly OUTPUT="$2" # .S (.inc) file to write.
readonly DEPFILE="$3" # depfile to write.
readonly LINK_OUTPUT="$(<"${RSPFILE}")"
readonly BUILD_ID_FILE="${LINK_OUTPUT}.build-id.stamp"
echo > "$OUTPUT" "\
// Generated by $0. DO NOT EDIT!
.incbin \"$BUILD_ID_FILE\""
echo > "$DEPFILE" "\
${OUTPUT}: ${RSPFILE} ${BUILD_ID_FILE}"
exit 0