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 # 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 # The first entry in HEADERS may be auto-host.h or auto-build.h;
23 # it wants to be included even when not -DIN_GCC.
24 if [ -n "$HEADERS" ]; then
25 set $HEADERS; first
=$1
26 case $first in auto-
* )
27 echo "#include \"$first\"" >> ${output}T
34 # Provide three core typedefs used by everything, if we are compiling
35 # GCC. These used to be found in rtl.h and tree.h, but this is no
36 # longer practical. Providing these in config.h/tconfig.h/hconfig.h
37 # rather than system.h allows the typedefs to be used anywhere in GCC.
39 *config.h |
*hconfig.h |
*tconfig.h
)
40 cat >> ${output}T
<<EOF
42 /* Provide three core typedefs used by everything, if we are compiling
43 GCC. These used to be found in rtl.h and tree.h, but this is no
44 longer practical. Providing these here rather that system.h allows
45 the typedefs to be used everywhere within GCC. */
47 typedef struct rtx_def *rtx;
49 typedef struct rtvec_def *rtvec;
51 typedef union tree_node *tree;
57 if [ -n "$HEADERS" ]; then
58 echo '#ifdef IN_GCC' >> ${output}T
59 for file in $HEADERS; do
60 echo "# include \"$file\"" >> ${output}T
62 echo '#endif' >> ${output}T
65 for def
in $DEFINES; do
66 echo "#ifndef $def" |
sed 's/=.*//' >> ${output}T
67 echo "# define $def" |
sed 's/=/ /' >> ${output}T
68 echo "#endif" >> ${output}T
71 # If this is tm_p.h, include tm-preds.h unconditionally.
72 # If this is tconfig.h or hconfig.h, include no more files.
73 # Otherwise, include insn-constants.h and insn-flags.h,
74 # but only if GENERATOR_FILE is not defined.
77 echo "#include \"tm-preds.h\"" >> ${output}T
79 *tconfig.h |
*hconfig.h
)
82 cat >> ${output}T
<<EOF
83 #ifndef GENERATOR_FILE
84 # include "insn-constants.h"
85 # include "insn-flags.h"
91 # Avoid changing the actual file if possible.
92 if [ -f $output ] && cmp ${output}T
$output >/dev
/null
2>&1; then
93 echo $output is unchanged
>&2
96 mv -f ${output}T
$output
99 # Touch a stamp file for Make's benefit.
101 echo timestamp
> cs-
$output