This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: gcc_update bug


Seems like we have traded breakage on one system for breakage on another. ;-/

>+    echo '	@for f in $?; do test ! -f $$f && exit 0; done; \' >> Makefile.$$
>+    echo '	echo Touching $@...; \' >> Makefile.$$
>+    echo '	echo Touching $@... 1>&2; \' >> Makefile.$$
>+    echo '	touch $@' >> Makefile.$$

For some reason, the above code (which is written into Makefile.$$)
fails repeaedly with this wonderful error message:

*** Error code 1

which is actually hidden by usage:

>+    while ${MAKE-make} -f Makefile.$$ all | grep . > /dev/null; do
>+      sleep 1
>+    done 2>&1

causing an infinite loop on FreeBSD 4.2 with /usr/bin/make (only
in those cases where a touch was actually needed).

Here is the smallest testcase which shows a difference between make
behavior:

; cat Makefile 
all:
	false; true
; /usr/bin/make
false; true
*** Error code 1

Stop in /tmp.
; gmake
false; true

I know that there is a motion to only allow gmake to be used to build
gcc.  However, this is a special case of make usage where the user
didn't directly invoke make himself.

This patch fixes the problem in a general manner by ensuring that the
for loop always has a zero value:

2001-05-14  Loren J. Rittle  <ljrittle@acm.org>

	* gcc_update (touch_files): Enhance make portability.

Index: contrib/gcc_update
===================================================================
RCS file: /cvs/gcc/gcc/contrib/gcc_update,v
retrieving revision 1.21.4.1
diff -c -r1.21.4.1 gcc_update
*** gcc_update	2001/05/14 20:01:40	1.21.4.1
--- gcc_update	2001/05/15 00:04:52
***************
*** 108,108 ****
      files_and_dependencies | sed 's, ,: ,' >> Makefile.$$
      files_and_dependencies | sed 's, .*, \\,' >> Makefile.$$
      echo ':' >> Makefile.$$
!     echo '	@for f in $?; do test ! -f $$f && exit 0; done; \' >> Makefile.$$
      echo '	echo Touching $@...; \' >> Makefile.$$
      echo '	echo Touching $@... 1>&2; \' >> Makefile.$$
      echo '	touch $@' >> Makefile.$$
--- 114,120 ----
      files_and_dependencies | sed 's, ,: ,' >> Makefile.$$
      files_and_dependencies | sed 's, .*, \\,' >> Makefile.$$
      echo ':' >> Makefile.$$
!     echo '	@for f in $?; do test ! -f $$f && exit 0; true; done; \' >> Makefile.$$
      echo '	echo Touching $@...; \' >> Makefile.$$
      echo '	echo Touching $@... 1>&2; \' >> Makefile.$$
      echo '	touch $@' >> Makefile.$$

Regards,
Loren


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]