OSDN Git Service

* mkconfig.sh: Include insn-flags.h.
[pf3gnuchains/gcc-fork.git] / gcc / mkconfig.sh
1 #! /bin/sh
2
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.
7
8 if [ -z "$1" ]; then
9     echo "Usage: HEADERS='list' DEFINES='list' mkconfig.sh FILE" >&2
10     exit 1
11 fi
12
13 output=$1
14 rm -f $output.T
15 exec > $output.T
16
17 # Define TARGET_CPU_DEFAULT if the system wants one.
18 # This substitutes for lots of *.h files.
19 if [ "$TARGET_CPU_DEFAULT" != "" ]; then
20     echo "#define TARGET_CPU_DEFAULT ($TARGET_CPU_DEFAULT)"
21 fi
22
23 # The first entry in HEADERS may be auto-host.h or auto-build.h;
24 # it wants to be included even when not -DIN_GCC.
25 if [ -n "$HEADERS" ]; then
26     set $HEADERS; first=$1
27     case $first in auto-* )
28         echo "#include \"$first\""
29         shift
30         HEADERS=$*
31         ;;
32     esac
33 fi
34
35 if [ -n "$HEADERS" ]; then
36     echo '#ifdef IN_GCC'
37     for file in $HEADERS; do
38         echo "# include \"$file\""
39     done
40     echo '#endif'
41 fi
42
43 for def in $DEFINES; do
44     echo "#ifndef $def"
45     echo "# define $def"
46     echo "#endif"
47 done
48
49 # Include insn-codes.h last, because it includes machmode.h,
50 # and we want EXTRA_CC_MODES to be taken into account.
51 echo "#ifndef GENERATOR_FILE"
52 echo "#include \"insn-codes.h\""
53 echo "#include \"insn-flags.h\""
54 echo "#endif"
55
56 exec >&-
57
58 # Avoid changing the actual file if possible.
59 if [ -f $output ] && cmp $output.T $output; then
60     echo $output is unchanged >&2
61     rm -f $output.T
62 else
63     mv -f $output.T $output
64 fi
65
66 # Touch a stamp file for Make's benefit.
67 rm -f cs-$output
68 echo timestamp > cs-$output