help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Making all export clean parallel, but export before all


From: Alexander Farber
Subject: Making all export clean parallel, but export before all
Date: Fri, 27 Aug 2004 14:38:49 +0000
User-agent: Mutt/1.4.1i

Sorry, but one more question. With a small testcase below.

I have a list of subdirectories and want to support 3 targets:
"all", "export" and "clean". The targets are similar in the
way that for each target I want to go into a subdirectory
and call "gmake -f SubMakefile target". And I want the list
of $(SUBDIRS) to be processed in parallel (by "gmake -jX")
for each of these targets.

There is one problem though: I need the "export" target to
be executed completely (i.e. for all $(SUBDIRS)), before "all"
is started. That is because "export" copies the header files
needed for the builds in the "all" phase.

First, I'm trying to achieve that by having an "all: export"
dependency in the top Makefile, but this doesn't work:

    bolinux72:para-test {560} cat Makefile 
    SUBDIRS = a b

    all: export

    all export clean: $(SUBDIRS)

    $(SUBDIRS): %: %/SubMakefile
            $(MAKE) -C $@ -f $(notdir $<) $(MAKECMDGOALS)

    # TODO a rule for %/SubMakefiles

    .PHONY: all export clean $(SUBDIRS)

    bolinux72:para-test {561} cat a/SubMakefile 
    all export clean:
            @echo "Making $@"

    .PHONY: all export clean

    bolinux72:para-test {562} gmake
    gmake -C a -f SubMakefile 
    gmake[1]: Entering directory `/home/afarber/para-test/a'
    Making all
    gmake[1]: Leaving directory `/home/afarber/para-test/a'
    gmake -C b -f SubMakefile 
    gmake[1]: Entering directory `/home/afarber/para-test/b'
    Making all
    gmake[1]: Leaving directory `/home/afarber/para-test/b'

Then I try to add an "all: export" dependency to the
SubMakefile's in the sub-directories, but this still
doesn't work as needed ("export" doesn't run through
for all $(SUBDIRS) first):

    linux72:para-test {565} cat a/SubMakefile 
    all: export

    all export clean:
            @echo "Making $@"

    .PHONY: all export clean

    bolinux72:para-test {566} gmake
    gmake -C a -f SubMakefile 
    gmake[1]: Entering directory `/home/afarber/para-test/a'
    Making export
    Making all
    gmake[1]: Leaving directory `/home/afarber/para-test/a'
    gmake -C b -f SubMakefile 
    gmake[1]: Entering directory `/home/afarber/para-test/b'
    Making export
    Making all
    gmake[1]: Leaving directory `/home/afarber/para-test/b'

Any suggestions please?
Alex





reply via email to

[Prev in Thread] Current Thread [Next in Thread]