3 # Generate gcc's config.h, which is not your normal autoconf-generated
4 # config.h (that's auto-(host|build).h). $1 is the file to generate.
5 # HEADERS, DEFINES, and possibly TARGET_CPU_DEFAULT are expected to be
6 # set in the environment.
9 echo "Usage: HEADERS='list' DEFINES='list' mkconfig.sh FILE" >&2
16 # We used to exec > $output.T but apparently this has bugs.
17 # Use a redirected subshell instead.
20 # Define TARGET_CPU_DEFAULT if the system wants one.
21 # This substitutes for lots of *.h files.
22 if [ "$TARGET_CPU_DEFAULT" != "" ]; then
23 echo "#define TARGET_CPU_DEFAULT ($TARGET_CPU_DEFAULT)"
26 # The first entry in HEADERS may be auto-host.h or auto-build.h;
27 # it wants to be included even when not -DIN_GCC.
28 if [ -n "$HEADERS" ]; then
29 set $HEADERS; first
=$1
30 case $first in auto-
* )
31 echo "#include \"$first\""
38 if [ -n "$HEADERS" ]; then
40 for file in $HEADERS; do
41 echo "# include \"$file\""
46 for def
in $DEFINES; do
47 echo "#ifndef $def" |
sed 's/=.*//'
48 echo "# define $def" |
sed 's/=/ /'
52 # If this is tm_p.h, include tm-preds.h unconditionally.
53 # If this is tconfig.h or hconfig.h, include no more files.
54 # Otherwise, include insn-constants.h, insn-flags.h, and insn-codes.h,
55 # but only if GENERATOR_FILE is not defined. (The last of those is
56 # slated to be removed.)
59 echo "#include \"tm-preds.h\""
61 *tconfig.h |
*hconfig.h
)
64 echo "#ifndef GENERATOR_FILE"
65 echo "# include \"insn-constants.h\""
66 echo "# include \"insn-codes.h\""
67 echo "# include \"insn-flags.h\""
74 # Avoid changing the actual file if possible.
75 if [ -f $output ] && cmp $output.T
$output >/dev
/null
2>&1; then
76 echo $output is unchanged
>&2
79 mv -f $output.T
$output
82 # Touch a stamp file for Make's benefit.
84 echo timestamp
> cs-
$output