3 # Copyright (C) 2001, 2002 Free Software Foundation, Inc.
4 # This file is part of GCC.
6 # GCC is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
11 # GCC is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with GCC; see the file COPYING. If not, write to
18 # the Free Software Foundation, 59 Temple Place - Suite 330,
19 # Boston MA 02111-1307, USA.
22 # Generate gcc's various configuration headers:
23 # config.h, tconfig.h, bconfig.h, tm.h, and tm_p.h.
24 # $1 is the file to generate. DEFINES, HEADERS, and possibly
25 # TARGET_CPU_DEFAULT are expected to be set in the environment.
28 echo "Usage: DEFINES='list' HEADERS='list' \\" >&2
29 echo " [TARGET_CPU_DEFAULT='default'] mkconfig.sh FILE" >&2
36 # Define TARGET_CPU_DEFAULT if the system wants one.
37 # This substitutes for lots of *.h files.
38 if [ "$TARGET_CPU_DEFAULT" != "" ]; then
39 echo "#define TARGET_CPU_DEFAULT ($TARGET_CPU_DEFAULT)" >> ${output}T
42 # Provide defines for other macros set in config.gcc for this file.
43 for def
in $DEFINES; do
44 echo "#ifndef $def" |
sed 's/=.*//' >> ${output}T
45 echo "# define $def" |
sed 's/=/ /' >> ${output}T
46 echo "#endif" >> ${output}T
49 # The first entry in HEADERS may be auto-host.h or auto-build.h;
50 # it wants to be included even when not -DIN_GCC.
51 if [ -n "$HEADERS" ]; then
54 echo "#include \"$1\"" >> ${output}T
59 echo '#ifdef IN_GCC' >> ${output}T
61 echo "# include \"$file\"" >> ${output}T
63 echo '#endif' >> ${output}T
67 # If this is tconfig.h, now define USED_FOR_TARGET. If this is tm.h,
68 # now include insn-constants.h and insn-flags.h only if IN_GCC is
69 # defined but neither GENERATOR_FILE nor USED_FOR_TARGET is defined.
70 # (Much of this is temporary.)
74 cat >> ${output}T
<<EOF
75 #define USED_FOR_TARGET
79 cat >> ${output}T
<<EOF
80 #if defined IN_GCC && !defined GENERATOR_FILE && !defined USED_FOR_TARGET
81 # include "insn-constants.h"
82 # include "insn-flags.h"
88 # Avoid changing the actual file if possible.
89 if [ -f $output ] && cmp ${output}T
$output >/dev
/null
2>&1; then
90 echo $output is unchanged
>&2
93 mv -f ${output}T
$output
96 # Touch a stamp file for Make's benefit.
98 echo timestamp
> cs-
$output