help-make
[Top][All Lists]
Advanced

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

Re: Interating over Target List with Jobs?


From: Harvey Chapman
Subject: Re: Interating over Target List with Jobs?
Date: Sun, 30 May 2010 21:16:30 -0400

On May 30, 2010, at 6:30 PM, Erik Rull wrote:

> Per Jessen wrote:
>> 
>> clean1:
>>         make -C mod1 clean
>> ....
>> clean: clean1 clean2 clean3 clean4 clean5
> 
> Hm, well, yes - this could be possbile - but quite brute-force ;-)
> If I add a new module, just the list of targets gets extended and I've 
> nothing to change in the makefile - with your approach a new clean rule must 
> be added manually.

I think he was implying something like this:


MODULE_LIST:=one two three

.PHONY: all
all:
        @echo $(MODULE_LIST)

define clean_module
.PHONY: clean_$(1)
clean_$(1):
        @echo "Clean: $(1)"
CLEAN_EXTRA+= clean_$(1)
endef

$(foreach MODULE,$(MODULE_LIST),$(eval $(call clean_module,$(MODULE))))

.PHONY: clean
clean: $(CLEAN_EXTRA)
        @echo "Clean: main"




reply via email to

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