[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to parallel clean directories?
From: |
Peng Yu |
Subject: |
Re: How to parallel clean directories? |
Date: |
Sat, 25 Oct 2008 12:14:49 -0500 |
- Hide quoted text -
On Sat, Oct 25, 2008 at 11:23 AM, Sam Ravnborg <address@hidden> wrote:
> On Sat, Oct 25, 2008 at 11:06:45AM -0500, Peng Yu wrote:
>> On Sat, Oct 25, 2008 at 10:43 AM, Sam Ravnborg <address@hidden> wrote:
>> > On Sat, Oct 25, 2008 at 09:33:48AM -0500, Peng Yu wrote:
>> >> Hi,
>> >>
>> >> Suppose there are many subdirectories in a directory. The sub dirs all
>> >> have working makefiles.
>> >>
>> >> 'make -j3' in the parent dir would parallel make all directories. But
>> >> 'make clean -j3' could not. The problem is that I don't know how to
>> >> clean each directory as well as deleting the file '.d'.
>> >>
>> >> Can somebody let me know how to do it?
>> >
>> > Try to study the following sample:
>> > SUBDIRS := b c d e f
>> >
>> > .PHONY: $(SUBDIRS)
>> >
>> > all: $(SUBDIRS)
>> >
>> > $(SUBDIRS):
>> > @sleep 1; echo rm -f $@/*
>>
>> I want to make parallel clean because I want speedup clean. Would the
>> command 'sleep' slow down the process?
>
> Please try to understand the makefile before posting questions.
>
> The sleep command is there to show that the commands are indeed
> executed in parallel.
> Try to time it with make -j and with make -j1
>
> May I suggest you to spend a few hours reading the documentation
> that follows make.
I see what you mean. Essentially, I need to have the following rules.
#################
clean: $(SUBDIRS)
$(SUBDIRS):
sleep 1; make clean -C $@
###########
But what if I already have the following rules. The general questions
is how to run make parallel for any goal that may specified in the
command line.
##############
all: $(SUBDIRS)
$(SUBDIRS):
make -C $@
##############
Thanks,
Peng