help-make
[Top][All Lists]
Advanced

[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:08:14 +0100 (MET)

On Mon, 19 Feb 2001, Paul D. Smith wrote:

> There are some notes about this in the GNU make manual.
>
>   mf> One approach is to use .PHONY subdirectories as targets
> 
> This is the right approach.

In what section? Phony targets?

Are you suggesting

SUBDIRS:=A B
PROGS:=$(SUBDIRS:%=prog%)
LIBS:=$(SUBDIRS:%=lib%)
TARGET=null

prog: $(PROGS)
$(PROGS): $(LIBS)
lib: $(LIBS)
$(PROGS): TARGET=prog
$(LIBS): TARGET=lib
$(LIBS) $(PROGS):
        @test -d $(@:$(TARGET)%=%) || mkdir $(@:$(TARGET)%=%)
        $(MAKE) -C $(@:$(TARGET)%=%) $(TARGET)

.PHONY: $(LIBS) $(PROGS) lib prog

or what? By the way, this works, but it is breaking your rule that nothing
should build anything that is named in any other way than itself, I could 
get to use targets named A and B for building the directories but I wold
then have to generate dependencies forthem, and that would be horrible
since they are turned in response to $(LIBS) and $(PROGS).

If I use one target name for the active part then the second pass will
never be done since it is assumed to be already done.

> Try $(MAKECMDGOALS).

I still can't see how MAKECMDGOALS could help me in this situation.

Additionally there is the problem of how to make a build from a different 
directory work but that I can think about later.

Oh yes, your .signature is quite informative, it points to some really 
good pages.




reply via email to

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