This patch replaces sed with tr when t-avr checks for
consistency between generated doc/avr-mmcu.texi and the compiler.

The method is the same as used in s-tm-texi in gcc/Makefile.in

The problem was reported by Joerg. Does it work for you?

Ok for trunk?

Johann

        * config/avr/t-avr: Correct avr-mmcu.texi dependencies.
        (s-avr-mmcu-texi): Use tr instead of sed to factor out line endings.
Index: config/avr/t-avr
===================================================================
--- config/avr/t-avr	(revision 188005)
+++ config/avr/t-avr	(working copy)
@@ -47,10 +47,26 @@ gen-avr-mmcu-texi$(build_exeext): $(srcd
   $(TM_H) $(AVR_MCUS) $(srcdir)/config/avr/avr-devices.c
 	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< -o $@
 
-avr-devices.o: s-avr-mmcu-texi
+# Make sure that the -mmcu= documentation is in sync with the compiler.
+$(srcdir)/doc/avr-mmcu.texi: s-avr-mmcu-texi; @true
 
+# invoke.texi @includes avr-mmcu.texi.  Put this dependency here instead
+# of in the global Makefile so that developers of other backends are not
+# bothered with AVR stuff. 
+$(srcdir)/doc/invoke.texi: $(srcdir)/doc/avr-mmcu.texi
+
+# The avr-mmcu.texi we want to compare against / check into svn should
+# have unix-style line endings.  To make this work on MinGW, remove \r.
+# \r is not portable to Solaris tr, therefore we have a special case
+# for ASCII.  We use \r for other encodings like EBCDIC.
 s-avr-mmcu-texi: gen-avr-mmcu-texi$(build_exeext)
-	$(RUN_GEN) ./$< | sed -e 's:\r::g' > avr-mmcu.texi
+	$(RUN_GEN) ./$< > tmp-avr-mmcu.texi
+	case `echo X|tr X '\101'` in 					\
+	  A) tr -d '\015' < tmp-avr-mmcu.texi > tmp2-avr-mmcu.texi ;; 	\
+	  *) tr -d '\r' < tmp-avr-mmcu.texi > tmp2-avr-mmcu.texi ;; 	\
+	esac
+	mv tmp2-avr-mmcu.texi tmp-avr-mmcu.texi
+	$(SHELL) $(srcdir)/../move-if-change tmp-avr-mmcu.texi avr-mmcu.texi
 	@if cmp -s $(srcdir)/doc/avr-mmcu.texi avr-mmcu.texi; then \
 	  $(STAMP) $@;		\
 	else			\

Reply via email to