aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKelley Cook <kelleycook@wideopenwest.com>2003-07-10 20:42:05 +0000
committerNeil Booth <neil@gcc.gnu.org>2003-07-10 20:42:05 +0000
commit4ade7b1af1b9c853410ea15b82979fc17ec427d1 (patch)
tree9427980c5142749e9c8310d65c59717e50802afc /gcc
parent9db367b45cc60c446821eb9c8aa7e96402376afb (diff)
downloadgcc-4ade7b1af1b9c853410ea15b82979fc17ec427d1.zip
gcc-4ade7b1af1b9c853410ea15b82979fc17ec427d1.tar.gz
gcc-4ade7b1af1b9c853410ea15b82979fc17ec427d1.tar.bz2
Makefile.in (options.h): Depend on Makefile.
* Makefile.in (options.h): Depend on Makefile. Add move-if-change to opts.sh command line. * opts.sh: Write to temporary files with a move-if-change at the end. From-SVN: r69200
Diffstat (limited to 'gcc')
-rw-r--r--gcc/Makefile.in7
-rw-r--r--gcc/opts.sh17
2 files changed, 17 insertions, 7 deletions
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 8d9ceb8..a62873f 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1416,9 +1416,10 @@ s-specs : Makefile
options.c: $(lang_opt_files) $(srcdir)/opts.sh options.h intl.h
-options.h: $(lang_opt_files) $(srcdir)/opts.sh
- AWK=$(AWK) $(SHELL) $(srcdir)/opts.sh options.c options.h \
- $(lang_opt_files)
+options.h: $(lang_opt_files) $(srcdir)/opts.sh Makefile
+ AWK=$(AWK) $(SHELL) $(srcdir)/opts.sh \
+ '$(SHELL) $(srcdir)/move-if-change' \
+ options.c options.h $(lang_opt_files)
dumpvers: dumpvers.c
diff --git a/gcc/opts.sh b/gcc/opts.sh
index 985cf96..3509dfd 100644
--- a/gcc/opts.sh
+++ b/gcc/opts.sh
@@ -17,7 +17,7 @@
# along with this program; if not, write to the Free Software
# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-# Usage: opts.sh outfile.c outfile.h file1.opt [file2.opt, ...]
+# Usage: opts.sh moveifchange srcdir outfile.c outfile.h file1.opt [ ...]
# Always operate in the C locale.
LANG=C
@@ -30,8 +30,11 @@ AWK=${AWK-awk}
SORT=sort # Could be /bin/sort or /usr/bin/sort
+MOVEIFCHANGE=$1; shift
C_FILE=$1; shift
H_FILE=$1; shift
+TMP_C_FILE=tmp-${C_FILE}
+TMP_H_FILE=tmp-${H_FILE}
${AWK} '
# Ignore comments and blank lines
@@ -88,13 +91,14 @@ ${AWK} '
# Dump out an enumeration into a .h file, and an array of options into a
# C file. Combine the flags of duplicate options.
END {
- c_file = "'${C_FILE}'"
- h_file = "'${H_FILE}'"
+ c_file = "'${TMP_C_FILE}'"
+ h_file = "'${TMP_H_FILE}'"
+ realh_file = "'${H_FILE}'"
comma = ","
print "/* This file is auto-generated by opts.sh. */\n" > c_file
print "#include <intl.h>" >> c_file
- print "#include \"" h_file "\"" >> c_file
+ print "#include \"" realh_file "\"" >> c_file
print "#include \"opts.h\"\n" >> c_file
print "const char * const lang_names[] =\n{" >> c_file
@@ -163,3 +167,8 @@ ${AWK} '
print "};" >> c_file
}
'
+
+# Copy the newly generated files back to the correct names only if different.
+# This is to prevent a cascade of file rebuilds when not necessary.
+${MOVEIFCHANGE} ${TMP_H_FILE} ${H_FILE}
+${MOVEIFCHANGE} ${TMP_C_FILE} ${C_FILE}