]>
git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/loongarch/genopts/genstr.sh
2 # A simple script that generates loongarch-str.h and loongarch.opt
3 # from genopt/loongarch-optstr.
5 # Copyright (C) 2021-2023 Free Software Foundation, Inc.
7 # This file is part of GCC.
9 # GCC is free software; you can redistribute it and/or modify it under
10 # the terms of the GNU General Public License as published by the Free
11 # Software Foundation; either version 3, or (at your option) any later
14 # GCC is distributed in the hope that it will be useful, but WITHOUT
15 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 # License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with GCC; see the file COPYING3. If not see
21 # <http://www.gnu.org/licenses/>.
25 # Generate a header containing definitions from the string table.
28 /* Generated automatically by "genstr" from "loongarch-strings".
29 Please do not edit this file directly.
31 Copyright (C) 2021-2023 Free Software Foundation, Inc.
32 Contributed by Loongson Ltd.
34 This file is part of GCC.
36 GCC is free software; you can redistribute it and/or modify
37 it under the terms of the GNU General Public License as published by
38 the Free Software Foundation; either version 3, or (at your option)
41 GCC is distributed in the hope that it will be useful,
42 but WITHOUT ANY WARRANTY; without even the implied warranty of
43 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
44 GNU General Public License for more details.
46 You should have received a copy of the GNU General Public License
47 along with GCC; see the file COPYING3. If not see
48 <http://www.gnu.org/licenses/>. */
50 #ifndef LOONGARCH_STR_H
51 #define LOONGARCH_STR_H
54 sed -e '/^$/n' -e 's@#.*$@@' -e '/^$/d' \
55 -e 's@^\([^ \t]\+\)[ \t]*\([^ \t]*\)@#define \1 "\2"@' \
59 echo "#endif /* LOONGARCH_STR_H */"
63 # Substitute all "@@<KEY>@@" to "<VALUE>" in loongarch.opt.in
64 # according to the key-value pairs defined in loongarch-strings.
68 sed -e '/^$/n' -e 's@#.*$@@' -e '/^$/d' \
69 -e 's@^\([^ \t]\+\)[ \t]*\([^ \t]*\)@\1="\2"@' \
70 loongarch-strings |
{ \
72 # read the definitions
73 while read -r line
; do
79 ; Generated by "genstr" from the template "loongarch.opt.in"
80 ; and definitions from "loongarch-strings".
82 ; Please do not edit this file directly.
83 ; It will be automatically updated during a gcc build
84 ; if you change "loongarch.opt.in" or "loongarch-strings".
88 # make the substitutions
89 sed -e 's@"@\\"@g' -e 's/@@\([^@]\+\)@@/${\1}/g' loongarch.opt.
in | \
90 while read -r line
; do
100 *) echo "Unknown Command: \"$1\". Available: header, opt"; exit 1;;