create-version.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/sh
  2. # Copyright (C) 1989-2022 Free Software Foundation, Inc.
  3. # This file is part of GDB.
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 3 of the License, or
  7. # (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. # Create version.c from version.in.
  17. # Usage:
  18. # create-version.sh PATH-TO-GDB-SRCDIR HOST_ALIAS \
  19. # TARGET_ALIAS OUTPUT-FILE-NAME
  20. srcdir="$1"
  21. host_alias="$2"
  22. target_alias="$3"
  23. output="$4"
  24. rm -f version.c-tmp "$output" version.tmp
  25. date=$(sed -n -e 's/^.* BFD_VERSION_DATE \(.*\)$/\1/p' "$srcdir/../bfd/version.h")
  26. sed -e "s/DATE/$date/" < "$srcdir/version.in" > version.tmp
  27. {
  28. echo '#include "gdbsupport/version.h"'
  29. echo 'const char version[] = "'"$(sed q version.tmp)"'";'
  30. echo 'const char host_name[] = "'"$host_alias"'";'
  31. echo 'const char target_name[] = "'"$target_alias"'";'
  32. } >> version.c-tmp
  33. mv version.c-tmp "$output"
  34. rm -f version.tmp