help-make
[Top][All Lists]
Advanced

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

How to parallel clean directories?


From: Peng Yu
Subject: How to parallel clean directories?
Date: Sat, 25 Oct 2008 09:33:48 -0500

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?

Thanks,
Peng

------------------------
.PHONY: all clean

SUBDIRS := $(filter-out backup bash doc,$(patsubst %/.,%,$(wildcard */.)))

.PHONY: $(SUBDIRS)

all: $(SUBDIRS)

-include .d
.d:
        @rm -f $@; \
                for dir in $(SUBDIRS); do \
                echo $$dir: >> $@; \
                echo -e "\t"@$$\{MAKE\} -C $$dir $$\{MAKECMDGOALS\}>> $@; \
                echo >> $@; \
                done

clean:
        @$(RM) .d; for dir in $(SUBDIRS); do \
                $(MAKE) -C $$dir clean & \
                done




reply via email to

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