This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: FYI: libiberty's maintainer-clean breaks if SUBDIRS is empty
- To: msokolov at ivan dot Harhan dot ORG (Michael Sokolov)
- Subject: Re: FYI: libiberty's maintainer-clean breaks if SUBDIRS is empty
- From: Alexandre Oliva <aoliva at cygnus dot com>
- Date: 29 Apr 2000 19:48:28 -0300
- Cc: gcc-patches at gcc dot gnu dot org
- Organization: Cygnus Solutions, a Red Hat Company
- References: <0004292150.AA01821@ivan.Harhan.ORG>
On Apr 29, 2000, msokolov@ivan.Harhan.ORG (Michael Sokolov) wrote:
> Alexandre Oliva <aoliva@cygnus.com> wrote:
>> - @if test "x$(SUBDIRS)" = x; then exit 0; fi; \
>> + @subdirs='$(SUBDIRS)'; \
>> target=`echo $@ | sed -e 's/-subdir//'`; \
>> - for dir in $(SUBDIRS) ; do \
>> + for dir in $$subdirs ; do \
> It was my earlier patch that made it work the way it did. It was
> necessary as what was there before my patch failed on 4.3BSD. It
> still works on 4.3BSD after your patch, so I'm not complaining, but
> why was your patch necessary?
Because some shells will parse the whole sequence of commands before
evaluating them. Bash, for example, will complain when if sees:
if test "x" = x; then exit 0; fi; ...; for dir in ; do ...
^
this can't be parsed, even if it is never going to be executed.
subdirs=''; ...; for dir in $subdirs; do ...
^^^^^^^^
Now this can be parsed correctly, and will do The Right Thing (TM)
even if $subdirs expands to nothing.
> Why did my way break for maintainer-clean-subdir? And how is
> maintainer-clean-subdir different from any other *-subdir?
It is not different, I had just failed to notice that all *-subdir
commands shared the same rule. It's just that some of the existing
clean rules call $(MAKE) some-other-clean, setting SUBDIRS="", and so
they fail.
--
Alexandre Oliva Enjoy Guaranį, see http://www.ic.unicamp.br/~oliva/
Cygnus Solutions, a Red Hat company aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org} Write to mailing lists, not to me