Re^2: using /bin/sh in make commands

Mike McNally m5 at lynx.uucp
Sat Oct 21 04:19:36 AEST 1989


david at indetech.com (David Kuder) writes:

In article <21173 at adm.BRL.MIL> Leisner.Henr at xerox.com (Marty) writes:
>Often people have rules in makefiles of the form:
	foo:
		for i in $(DIRS); do \
			(cd $$i; $(MAKE) foo); \
		done
> . . .

>Which make are you using?  There are way too many of these beasts.
>However, on the three that I have at hand, SunOS4, Sys5.3, UCB4.3 (the
>last two are Pyramid versions), a "make foo" stops as soon as one of
>the sub makes fails.

That seems pretty bizarre to me, but then again I'm not up on Suns and
Pyramids.  My "make" won't find out about the failed children of the
spawned Bourne shell, and (barring various disgusting possibilities)
couldn't find out even if it wanted to.

>If you must avoid changing the makefile (arguably broken) if you run
>the make under a Bourne in which a 'set -e' has been done then the
>shells started by the make will inherit it.  I can't test this but
>it may work.

I don't think child shells (particularly ones separated from the parent by 
a "make") will inherit flags, unless your sh is a lot different than mine.

Why not

    foo:
        set -e \; \
        for blah in blah blah blah \; \
          do \
            blah blah blah \;
          done

-- 
Mike McNally                                    Lynx Real-Time Systems
uucp: {voder,athsys}!lynx!m5                    phone: 408 370 2233

            Where equal mind and contest equal, go.



More information about the Comp.unix.wizards mailing list