Mercurial > hg > CbC > CbC_gcc
annotate gcc/mkconfig.sh @ 132:d34655255c78
update gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 10:21:07 +0900 |
parents | 84e7813d76e9 |
children | 1830386684a0 |
rev | line source |
---|---|
0 | 1 #! /bin/sh |
2 | |
131 | 3 # Copyright (C) 2001-2018 Free Software Foundation, Inc. |
0 | 4 # This file is part of GCC. |
5 | |
6 # GCC is free software; you can redistribute it and/or modify | |
7 # it under the terms of the GNU General Public License as published by | |
8 # the Free Software Foundation; either version 3, or (at your option) | |
9 # any later version. | |
10 | |
11 # GCC is distributed in the hope that it will be useful, | |
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 # GNU General Public License for more details. | |
15 | |
16 # You should have received a copy of the GNU General Public License | |
17 # along with GCC; see the file COPYING3. If not see | |
18 # <http://www.gnu.org/licenses/>. | |
19 | |
20 | |
21 # Generate gcc's various configuration headers: | |
111 | 22 # config.h, tconfig.h, bconfig.h, tm.h, libgcc_tm.h, and tm_p.h. |
0 | 23 # $1 is the file to generate. DEFINES, HEADERS, and possibly |
24 # TARGET_CPU_DEFAULT are expected to be set in the environment. | |
25 | |
26 if [ -z "$1" ]; then | |
27 echo "Usage: DEFINES='list' HEADERS='list' \\" >&2 | |
28 echo " [TARGET_CPU_DEFAULT='default'] mkconfig.sh FILE" >&2 | |
29 exit 1 | |
30 fi | |
31 | |
32 output=$1 | |
33 rm -f ${output}T | |
34 | |
35 # This converts a file name into header guard macro format. | |
36 hg_sed_expr='y,abcdefghijklmnopqrstuvwxyz./,ABCDEFGHIJKLMNOPQRSTUVWXYZ__,' | |
37 header_guard=GCC_`echo ${output} | sed -e ${hg_sed_expr}` | |
38 | |
39 # Add multiple inclusion protection guard, part one. | |
40 echo "#ifndef ${header_guard}" >> ${output}T | |
41 echo "#define ${header_guard}" >> ${output}T | |
42 | |
43 # A special test to ensure that build-time files don't blindly use | |
44 # config.h. | |
45 if test x"$output" = x"config.h"; then | |
46 echo "#ifdef GENERATOR_FILE" >> ${output}T | |
47 echo "#error config.h is for the host, not build, machine." >> ${output}T | |
48 echo "#endif" >> ${output}T | |
49 fi | |
50 | |
51 # Define TARGET_CPU_DEFAULT if the system wants one. | |
52 # This substitutes for lots of *.h files. | |
53 if [ "$TARGET_CPU_DEFAULT" != "" ]; then | |
54 echo "#define TARGET_CPU_DEFAULT ($TARGET_CPU_DEFAULT)" >> ${output}T | |
55 fi | |
56 | |
57 # Provide defines for other macros set in config.gcc for this file. | |
58 for def in $DEFINES; do | |
59 echo "#ifndef $def" | sed 's/=.*//' >> ${output}T | |
60 echo "# define $def" | sed 's/=/ /' >> ${output}T | |
61 echo "#endif" >> ${output}T | |
62 done | |
63 | |
64 # The first entry in HEADERS may be auto-FOO.h ; | |
65 # it wants to be included even when not -DIN_GCC. | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
66 # Postpone including defaults.h until after the insn-* |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
67 # headers, so that the HAVE_* flags are available |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
68 # when defaults.h gets included. |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
69 postpone_defaults_h="no" |
0 | 70 if [ -n "$HEADERS" ]; then |
71 set $HEADERS | |
72 case "$1" in auto-* ) | |
73 echo "#include \"$1\"" >> ${output}T | |
74 shift | |
75 ;; | |
76 esac | |
77 if [ $# -ge 1 ]; then | |
78 echo '#ifdef IN_GCC' >> ${output}T | |
79 for file in "$@"; do | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
80 if test x"$file" = x"defaults.h"; then |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
81 postpone_defaults_h="yes" |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
82 else |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
83 echo "# include \"$file\"" >> ${output}T |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
84 fi |
0 | 85 done |
86 echo '#endif' >> ${output}T | |
87 fi | |
88 fi | |
89 | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
90 # If this is tm.h, now include insn-flags.h only if IN_GCC is defined |
111 | 91 # but neither GENERATOR_FILE nor USED_FOR_TARGET is defined. (Much of this |
92 # is temporary.) | |
0 | 93 |
94 case $output in | |
95 tm.h ) | |
96 cat >> ${output}T <<EOF | |
97 #if defined IN_GCC && !defined GENERATOR_FILE && !defined USED_FOR_TARGET | |
98 # include "insn-flags.h" | |
99 #endif | |
111 | 100 #if defined IN_GCC && !defined GENERATOR_FILE |
101 # include "insn-modes.h" | |
102 #endif | |
0 | 103 EOF |
104 ;; | |
105 esac | |
106 | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
107 # If we postponed including defaults.h, add the #include now. |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
108 if test x"$postpone_defaults_h" = x"yes"; then |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
109 echo "# include \"defaults.h\"" >> ${output}T |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
110 fi |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
111 |
0 | 112 # Add multiple inclusion protection guard, part two. |
113 echo "#endif /* ${header_guard} */" >> ${output}T | |
114 | |
115 # Avoid changing the actual file if possible. | |
116 if [ -f $output ] && cmp ${output}T $output >/dev/null 2>&1; then | |
117 echo $output is unchanged >&2 | |
118 rm -f ${output}T | |
119 else | |
120 mv -f ${output}T $output | |
121 fi | |
122 | |
123 # Touch a stamp file for Make's benefit. | |
124 rm -f cs-$output | |
125 echo timestamp > cs-$output |