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.
9 echo "Usage: TM_DEFINES='list' HEADERS='list' XM_DEFINES='list' mkconfig.sh FILE" >&2
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
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
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
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.
46 *config.h |
*hconfig.h |
*tconfig.h
)
47 cat >> ${output}T
<<EOF
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. */
54 typedef struct rtx_def *rtx;
56 typedef struct rtvec_def *rtvec;
58 typedef union tree_node *tree;
65 if [ -n "$HEADERS" ]; then
66 echo '#ifdef IN_GCC' >> ${output}T
67 for file in $HEADERS; do
68 echo "# include \"$file\"" >> ${output}T
70 echo '#endif' >> ${output}T
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
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.
85 echo "#include \"tm-preds.h\"" >> ${output}T
87 *tconfig.h |
*hconfig.h
)
90 cat >> ${output}T
<<EOF
91 #ifndef GENERATOR_FILE
92 # include "insn-constants.h"
93 # include "insn-flags.h"
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
104 mv -f ${output}T
$output
107 # Touch a stamp file for Make's benefit.
109 echo timestamp
> cs-
$output