help-make
[Top][All Lists]
Advanced

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

How to dive into SUBDIRS


From: Patrick Schoenfeld
Subject: How to dive into SUBDIRS
Date: Fri, 28 Mar 2008 18:11:59 +0100
User-agent: Mutt/1.5.17 (2007-12-11)

[ Please CC me as I am not subscribed to the list ]

Hi there,

in 4.6 of the make manual there is an example for using PHONY targets to
dive into SUBDIRS instead of the "for dir in.." variant. But I'm unsure
how to handle situations where you want to execute specific PHONY targets,
that all depend on the same SUBDIRS.

Example:
You have DIRS defined and several targets all, update and upload.
Normaly you would do something like this:

all:
    set -e; for dir in $(DIRS); do make -C $$dir all; done

update:
    set -e; for dir in $(DIRS); do make -C $$dir update; done

upload:
    set -e; for dir in $(DIRS); do make -C $$dir upload; done

etc.

But how to do it with the PHONY target variant? Defining different
variable names (my first guess) does obvious not work. Is there any
special variable to indicate which rule implicitly matched the $(DIRS):
rule? Then something like the following would work:

$(DIRS):
    $(MAKE) -C $@ $magicvar

I didn't find anything. Whats the right way to do this?

Thanks and best Regards,

Patrick




reply via email to

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