%% Yossi Itzkovich <[EMAIL PROTECTED]> writes:

  yi> I have PKGS set to a list of sub directories.

  yi> I want to launch the main Makefile with a target (say, clean) and
  yi> that this one will be sent to every sub make.

  yi> I use:

  yi> define  for_loop
  yi> for pkg in $(PKGS); do $(MAKE)  -C $$pkg/obj  -f Makefile.pkg  $@; done
  yi> endef

  yi> clean:
  yi>         $(for_loop)

  yi> Is it OK?  It does work, but I think I can't control this way the
  yi> -j and -l option.

It depends on what you mean by "OK".  It does work, as you mentioned,
and you're also correct that it won't play well with the -j
option... that is to say, it will not invoke the sub-makes in parallel;
only serially.

If you want to have it work well with -j you have to create a target for
each directory; maybe something like this:

  PKGS.clean = $(PKGS:=.clean)

  clean: $(PKGS.clean)

  $(PKGS.clean):
        $(MAKE) -C $(basename $@) clean

  .PHONY: clean $(PKGS.clean)

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[EMAIL PROTECTED]>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make

Reply via email to