WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] tools top level makefile cleanup

On Tue, 22 Mar 2005, Jerone Young wrote:

> On Tue, 2005-03-22 at 15:33 -0600, Adam Heath wrote:
> > On Tue, 22 Mar 2005, Jerone Young wrote:
> >
> > > I cleaned up the top level makefile in the tools directory. No major
> > > changes. Except I have it so that ioemmu is compiled only with x86_32.
> > >
> > > Signed-off-by: Jerone Young <jyoung5@xxxxxxxxxx>
> > >
> > > +all:
> > > + @for subdir in $(SUBDIRS); do \
> > > +         $(MAKE) -C $$subdir $@ || exit -1; \
> > > + done
> > > +
> > > +clean:
> > > + @for subdir in $(SUBDIRS); do \
> > > +         $(MAKE) -C $$subdir $@ || exit -1; \
> > > + done
> > > +
> > > +install:
> > > + @for subdir in $(SUBDIRS); do \
> > > +         $(MAKE) -C $$subdir $@ || exit -1; \
> > > + done
> >
> > Don't do it like this.  make -j won't work.
> Hmm...I mainly did this to clean up things for development purposes. I
> don't know if everyone cares all that much about the using the -j option
> with building the tools (maybe..someone speakup!). It really does not
> take anytime now to build them without it. Also you have to build
> libxutil & libxc first so your not going to get a huge performance
> increase because everything is dependent on these getting built first.

==
install: $(patsubst %,install.%,$(SUBDIRS))
$(patsubst %,install.%,$(SUBDIRS)): install.%: CMD := install

all: $(patsubst %,all.%,$(SUBDIRS))
$(patsubst %,all.%,$(SUBDIRS)): all.%: CMD := all

$(foreach cmd,all install,$(patsubst %,$(cmd).%,$(SUBDIRS))):
        $(MAKE) -C $* $(CMD)
==

Adding more commands is left as an exercise, as is converting the first 2
lines into a multi-line variable(ie, define).

> > Besides, don't use || exit.  Instead, use set -e.
> We want the build to die (with extreme prejudice :-) ) if something does
> not go right.

Yes, of course.  But if you have an error in the definition of SUBDIRS(empty,
or bad quote char), then your shell line may not error out.

Using set -e is the preferred approach.

Generally, like:

        @set -e; for .... \
                ....; \
        done

Or:

SHELL += -e


-------------------------------------------------------
This SF.net email is sponsored by Microsoft Mobile & Embedded DevCon 2005
Attend MEDC 2005 May 9-12 in Vegas. Learn more about the latest Windows
Embedded(r) & Windows Mobile(tm) platforms, applications & content.  Register
by 3/29 & save $300 http://ads.osdn.com/?ad_id=6883&alloc_id=15149&op=click
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-devel