I have an, umm, maybe somewhat weird idea, and would like some feedback on this.
Some rules, most importantly the compile rules, do things like if $(COMPILE); then $whatever; else exit 1; fi (where the `fi' also marks the end of the rule). This is conceptually very close to if $(COMPILE); then $whatever; else false; fi except that false isn't guaranteed to have an exit status of 1. That could be achieved by if $(COMPILE); then $whatever; else (exit 1); fi Now there are two distinct differences between the last and first line: - If you cut-and-paste the last rule into your shell, the last one won't cause the shell to exit in the failure case. This is very helpful from a usability point of view (and pasteability is one of the main reasons to echo the rules in a precise way anyway). - If you modify the last rule, e.g., by appending another command, you must be more careful not to throw away the error. I'm not sure which of those we should value higher -- the last issue can be avoided by being careful, and isn't exactly new, but present for all kind of compound rules. OTOH, I don't care so much for pasteability for those compound rules that aren't output by default anyway because of the `@' modifier; and at this point I don't want to uglify rules that loop just to make them skip differently. So, how about a patch like this one? Cheers, Ralf * lib/am/depend2.am: Use `(exit 1)' instead of `exit 1' in the failure case, so that pasting the rule in an interactive shell will not cause the shell to exit. * lib/am/lisp.am (elc-stamp): Likewise. Index: lib/am/depend2.am =================================================================== RCS file: /cvs/automake/automake/lib/am/depend2.am,v retrieving revision 1.60 diff -u -r1.60 depend2.am --- lib/am/depend2.am 23 Mar 2006 06:35:15 -0000 1.60 +++ lib/am/depend2.am 11 Jun 2006 07:55:12 -0000 @@ -68,7 +68,7 @@ ?!GENERIC? if %COMPILE% -MT %OBJ% -MD -MP -MF "%DEPBASE%.Tpo" %-c% -o %OBJ% `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%; \ ?SUBDIROBJ??GENERIC? depbase=`echo %OBJ% | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`; \ ?GENERIC? if %COMPILE% -MT %OBJ% -MD -MP -MF "%DEPBASE%.Tpo" %-c% -o %OBJ% %SOURCE%; \ - then mv -f "%DEPBASE%.Tpo" "%DEPBASE%.Po"; else rm -f "%DEPBASE%.Tpo"; exit 1; fi + then mv -f "%DEPBASE%.Tpo" "%DEPBASE%.Po"; else rm -f "%DEPBASE%.Tpo"; (exit 1); fi else !%FASTDEP% if %AMDEP% source='%SOURCE%' object='%OBJ%' libtool=no @AMDEPBACKSLASH@ @@ -92,7 +92,7 @@ ?!GENERIC? if %COMPILE% -MT %OBJOBJ% -MD -MP -MF "%DEPBASE%.Tpo" %-c% -o %OBJOBJ% `if test -f '%SOURCE%'; then $(CYGPATH_W) '%SOURCE%'; else $(CYGPATH_W) '$(srcdir)/%SOURCE%'; fi`; \ ?SUBDIROBJ??GENERIC? depbase=`echo %OBJ% | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`; \ ?GENERIC? if %COMPILE% -MT %OBJOBJ% -MD -MP -MF "%DEPBASE%.Tpo" %-c% -o %OBJOBJ% `$(CYGPATH_W) '%SOURCE%'`; \ - then mv -f "%DEPBASE%.Tpo" "%DEPBASE%.Po"; else rm -f "%DEPBASE%.Tpo"; exit 1; fi + then mv -f "%DEPBASE%.Tpo" "%DEPBASE%.Po"; else rm -f "%DEPBASE%.Tpo"; (exit 1); fi else !%FASTDEP% if %AMDEP% source='%SOURCE%' object='%OBJOBJ%' libtool=no @AMDEPBACKSLASH@ @@ -118,7 +118,7 @@ ?!GENERIC? if %LTCOMPILE% -MT %LTOBJ% -MD -MP -MF "%DEPBASE%.Tpo" %-c% -o %LTOBJ% `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%; \ ?SUBDIROBJ??GENERIC? depbase=`echo %OBJ% | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`; \ ?GENERIC? if %LTCOMPILE% -MT %LTOBJ% -MD -MP -MF "%DEPBASE%.Tpo" %-c% -o %LTOBJ% %SOURCE%; \ - then mv -f "%DEPBASE%.Tpo" "%DEPBASE%.Plo"; else rm -f "%DEPBASE%.Tpo"; exit 1; fi + then mv -f "%DEPBASE%.Tpo" "%DEPBASE%.Plo"; else rm -f "%DEPBASE%.Tpo"; (exit 1); fi else !%FASTDEP% if %AMDEP% source='%SOURCE%' object='%LTOBJ%' libtool=yes @AMDEPBACKSLASH@ Index: lib/am/lisp.am =================================================================== RCS file: /cvs/automake/automake/lib/am/lisp.am,v retrieving revision 1.47 diff -u -r1.47 lisp.am --- lib/am/lisp.am 14 May 2005 20:28:53 -0000 1.47 +++ lib/am/lisp.am 11 Jun 2006 07:55:13 -0000 @@ -39,7 +39,7 @@ done; \ ## Finally call elisp-comp for all files. shift; \ - EMACS="$(EMACS)" $(SHELL) $(elisp_comp) "$$@" || exit 1; \ + EMACS="$(EMACS)" $(SHELL) $(elisp_comp) "$$@" || (exit 1); \ else : ; fi @mv -f elc-temp $@