Parallel builds

Ian Lynagh igloo at earth.li
Mon Sep 10 10:07:07 EDT 2007


On Sun, Sep 09, 2007 at 11:58:26AM +0200, Sven Panne wrote:
> On Saturday 08 September 2007 19:33, Stefan O'Rear wrote:
> > [...]
> > $(MAKE) always includes the flags (at least with gnumake), cf "info make
> > MAKE\ Variable".
> 
> Nope... Don't stop reading manuals prematurely: ;-)
> 
>   http://www.gnu.org/software/make/manual/html_node/Options_002fRecursion.html

I'm not sure exactly which bit of that URL you're referring to?

> Easy test:
> 
> ---------- Makefile --------------------------------------
> subsystem:
> 	@echo "top MAKE      = $(MAKE)"
> 	@echo "top MAKEFLAGS = $(MAKEFLAGS)"
> 	@echo "top MFLAGS    = $(MFLAGS)"
> 	cd subdir && $(MAKE)
> ----------------------------------------------------------
> 
> ---------- subdir/Makefile -------------------------------
> all:
> 	@echo "sub MAKE      = $(MAKE)"
> 	@echo "sub MAKEFLAGS = $(MAKEFLAGS)"
> 	@echo "sub MFLAGS    = $(MFLAGS)"
> ----------------------------------------------------------
> 
> ---------- output ----------------------------------------
> panne at spock:~/maketest> make -j2 foo=bar
> top MAKE      = make
> top MAKEFLAGS =  --jobserver-fds=3,4 -j -- foo=bar
> top MFLAGS    = - --jobserver-fds=3,4 -j
> cd subdir && make
> make[1]: Entering directory `/home/panne/maketest/subdir'
> sub MAKE      = make
> sub MAKEFLAGS = w --jobserver-fds=3,4 -j -- foo=bar
> sub MFLAGS    = -w --jobserver-fds=3,4 -j
> make[1]: Leaving directory `/home/panne/maketest/subdir'
> ----------------------------------------------------------

What is this test meant to show? That -j is being passed down correctly,
so it works as-is?

> So MAKEFLAGS seems to be passed down automatically, but I think that we still 
> have to mention it in the recursive call.

Why do you think that?

> We do this already for every 
> directory in SUBDIRS_BUILD, but that doesn't include "libraries". (Well, we 
> use MFLAGS there, which should probably better be MAKEFLAGS, BTW).

The URL you give says, in relation to using "$(MAKE) $(MFLAGS)",

    [...] MAKEFLAGS makes this usage redundant. If you want
    your makefiles to be compatible with old make programs, use this
    technique [...]

IIRC on *BSD you need to use gmake rather than make to build GHC, so I
doubt that any such "old make programs" can build GHC anyway. Even if
they can, the build will still work, just with less parallelisation.


Thanks
Ian



More information about the Cvs-ghc mailing list