[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Making in subdirectories
From: |
Magnus Fromreide |
Subject: |
Re: Making in subdirectories |
Date: |
Mon, 19 Feb 2001 18:32:27 +0100 (MET) |
On Mon, 19 Feb 2001, Paul D. Smith wrote:
> Something like this:
>
> SUBDIRS = A B
>
> prog:
> prog lib: $(SUBDIRS)
>
> $(SUBDIRS):
> $(MAKE) -C $@ $(MAKECMDGOALS)
>
> .PHONY: $(SUBDIRS) prog lib
>
> Does this not do something you need?
With your makefile:
(the line with a lone prog: is changed to prog: lib, please note that
this doesn't affect the result)
$ gmake
gmake -C A
gmake[1]: Entering directory `/home/telco/maf/maketest/A'
Making lib in A
gmake[1]: Leaving directory `/home/telco/maf/maketest/A'
gmake -C B
gmake[1]: Entering directory `/home/telco/maf/maketest/B'
Making lib in B
gmake[1]: Leaving directory `/home/telco/maf/maketest/B'
With my makefile from earlier posting:
$ gmake -f Makefile.mine
gmake -C A lib
gmake[1]: Entering directory `/home/telco/maf/maketest/A'
Making lib in A
gmake[1]: Leaving directory `/home/telco/maf/maketest/A'
gmake -C B lib
gmake[1]: Entering directory `/home/telco/maf/maketest/B'
Making lib in B
gmake[1]: Leaving directory `/home/telco/maf/maketest/B'
gmake -C A prog
gmake[1]: Entering directory `/home/telco/maf/maketest/A'
Making prog in A
gmake[1]: Leaving directory `/home/telco/maf/maketest/A'
gmake -C B prog
gmake[1]: Entering directory `/home/telco/maf/maketest/B'
Making prog in B
gmake[1]: Leaving directory `/home/telco/maf/maketest/B'
The makefile in A:
$ cat A/Makefile
lib prog:
@echo "Making $@ in A"
In B it looks similar.
What I am trying to express is
In SUBDIRS, do $(MAKE) lib
when finished do
In SUBDIRS, do $(MAKE) prog
while you are describing
In SUBDIRS, do $(MAKE) $(MAKECMDGOALS)
> You can also make simple prerequisites, like:
>
> a: b
>
> to make sure everything builds in the right order in the face of
> parallel builds.
Yes, in this way I can order the directories but not the targets in the
directories. I do not care about the order of the directories, I only care
about lib being built before prog is built.