OSDN Git Service

* config/rs6000/rs6000.c (spe_init_builtins,
[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 # TM_DEFINES, HEADERS, XM_DEFINES, and possibly TARGET_CPU_DEFAULT are
6 # expected to be set in the environment.
7
8 if [ -z "$1" ]; then
9     echo "Usage: TM_DEFINES='list' HEADERS='list' XM_DEFINES='list' mkconfig.sh FILE" >&2
10     exit 1
11 fi
12
13 output=$1
14 rm -f ${output}T
15
16 # Define TARGET_CPU_DEFAULT if the system wants one.
17 # This substitutes for lots of *.h files.
18 if [ "$TARGET_CPU_DEFAULT" != "" ]; then
19     echo "#define TARGET_CPU_DEFAULT ($TARGET_CPU_DEFAULT)" >> ${output}T
20 fi
21
22 # Provide defines for other target machine macros to be used everywhere.
23 for def in $TM_DEFINES; do
24     echo "#ifndef $def" | sed 's/=.*//' >> ${output}T
25     echo "# define $def" | sed 's/=/ /' >> ${output}T
26     echo "#endif" >> ${output}T
27 done
28
29 # The first entry in HEADERS may be auto-host.h or auto-build.h;
30 # it wants to be included even when not -DIN_GCC.
31 if [ -n "$HEADERS" ]; then
32     set $HEADERS; first=$1
33     case $first in auto-* )
34         echo "#include \"$first\"" >> ${output}T
35         shift
36         HEADERS=$*
37         ;;
38     esac
39 fi
40
41 # Provide three core typedefs used by everything, if we are compiling
42 # GCC.  These used to be found in rtl.h and tree.h, but this is no
43 # longer practical. Providing these in config.h/tconfig.h/hconfig.h
44 # rather than system.h allows the typedefs to be used anywhere in GCC.
45 case $output in 
46     *config.h | *hconfig.h | *tconfig.h)
47         cat >> ${output}T <<EOF
48 #ifdef IN_GCC
49 /* Provide three core typedefs used by everything, if we are compiling
50    GCC.  These used to be found in rtl.h and tree.h, but this is no
51    longer practical.  Providing these here rather that system.h allows
52    the typedefs to be used everywhere within GCC. */
53 struct rtx_def;
54 typedef struct rtx_def *rtx;
55 struct rtvec_def;
56 typedef struct rtvec_def *rtvec;
57 union tree_node;
58 typedef union tree_node *tree;
59 #endif
60 #define GTY(x)
61 EOF
62         ;;
63 esac
64
65 if [ -n "$HEADERS" ]; then
66     echo '#ifdef IN_GCC' >> ${output}T
67     for file in $HEADERS; do
68         echo "# include \"$file\"" >> ${output}T
69     done
70     echo '#endif' >> ${output}T
71 fi
72
73 for def in $XM_DEFINES; do
74     echo "#ifndef $def" | sed 's/=.*//' >> ${output}T
75     echo "# define $def" | sed 's/=/ /' >> ${output}T
76     echo "#endif" >> ${output}T
77 done
78
79 # If this is tm_p.h, include tm-preds.h unconditionally.
80 # If this is tconfig.h or hconfig.h, include no more files.
81 # Otherwise, include insn-constants.h and insn-flags.h,
82 # but only if GENERATOR_FILE is not defined.
83 case $output in
84     *tm_p.h)
85         echo "#include \"tm-preds.h\"" >> ${output}T
86     ;;
87     *tconfig.h | *hconfig.h)
88     ;;
89     *)
90         cat >> ${output}T <<EOF
91 #ifndef GENERATOR_FILE
92 # include "insn-constants.h"
93 # include "insn-flags.h"
94 #endif
95 EOF
96     ;;
97 esac
98
99 # Avoid changing the actual file if possible.
100 if [ -f $output ] && cmp ${output}T $output >/dev/null 2>&1; then
101     echo $output is unchanged >&2
102     rm -f ${output}T
103 else
104     mv -f ${output}T $output
105 fi
106
107 # Touch a stamp file for Make's benefit.
108 rm -f cs-$output
109 echo timestamp > cs-$output