xref: /netbsd-src/external/gpl3/gdb/dist/gdbsupport/create-version.sh (revision 5ba1f45f2a09259cc846f20c7c5501604d633c90)
18dffb485Schristos#!/bin/sh
28dffb485Schristos
3*5ba1f45fSchristos# Copyright (C) 1989-2024 Free Software Foundation, Inc.
48dffb485Schristos
58dffb485Schristos# This file is part of GDB.
68dffb485Schristos
78dffb485Schristos# This program is free software; you can redistribute it and/or modify
88dffb485Schristos# it under the terms of the GNU General Public License as published by
98dffb485Schristos# the Free Software Foundation; either version 3 of the License, or
108dffb485Schristos# (at your option) any later version.
118dffb485Schristos#
128dffb485Schristos# This program is distributed in the hope that it will be useful,
138dffb485Schristos# but WITHOUT ANY WARRANTY; without even the implied warranty of
148dffb485Schristos# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
158dffb485Schristos# GNU General Public License for more details.
168dffb485Schristos#
178dffb485Schristos# You should have received a copy of the GNU General Public License
188dffb485Schristos# along with this program.  If not, see <http://www.gnu.org/licenses/>.
198dffb485Schristos
208dffb485Schristos# Create version.c from version.in.
218dffb485Schristos# Usage:
228dffb485Schristos#    create-version.sh PATH-TO-GDB-SRCDIR HOST_ALIAS \
238dffb485Schristos#        TARGET_ALIAS OUTPUT-FILE-NAME
248dffb485Schristos
258dffb485Schristossrcdir="$1"
268dffb485Schristoshost_alias="$2"
278dffb485Schristostarget_alias="$3"
288dffb485Schristosoutput="$4"
298dffb485Schristos
308dffb485Schristosrm -f version.c-tmp "$output" version.tmp
318dffb485Schristosdate=$(sed -n -e 's/^.* BFD_VERSION_DATE \(.*\)$/\1/p' "$srcdir/../bfd/version.h")
328dffb485Schristossed -e "s/DATE/$date/" < "$srcdir/version.in" > version.tmp
338dffb485Schristos{
348dffb485Schristos    echo '#include "gdbsupport/version.h"'
358dffb485Schristos    echo 'const char version[] = "'"$(sed q version.tmp)"'";'
368dffb485Schristos    echo 'const char host_name[] = "'"$host_alias"'";'
378dffb485Schristos    echo 'const char target_name[] = "'"$target_alias"'";'
388dffb485Schristos} >> version.c-tmp
398dffb485Schristosmv version.c-tmp "$output"
408dffb485Schristosrm -f version.tmp
41