help-make
[Top][All Lists]
Advanced

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

clean recursively into sub-directories


From: Hongliang Wang
Subject: clean recursively into sub-directories
Date: Tue, 29 Apr 2008 12:49:12 +0000

Hello all,

I have three sub-directories (gen, ora, util) under the top-level directory and 
I want to run Makefiles recursively into these sub-directories.

My Makefile at top-level directory is

============================================
SRC = gen ora util

SUBDIRS = gen ora util

.PHONY: all $(SUBDIRS)

all: $(SUBDIRS)

$(SUBDIRS):
        $(MAKE) -C $@ -f Makefile.hvr_gcc

util: ora

ora: gen

.PHONY: clean $(SRC)

clean: $(SRC)

$(SRC): 
        $(MAKE) -C $@ -f Makefile.hvr_gcc clean

==============================================

It just follows the example code from the offical manual of GNU Make. But since 
I would like this Makefile to run "make clean" also recureively into 
sub-directories, I add the "clean" target and it stops working.

However, when I run "make" or "make clean" under the top-level directory, the 
result is:

==============================================
address@hidden> gmake -f Makefile
Makefile:54: warning: overriding commands for target `gen'
Makefile:41: warning: ignoring old commands for target `gen'
Makefile:54: warning: overriding commands for target `ora'
Makefile:41: warning: ignoring old commands for target `ora'
Makefile:54: warning: overriding commands for target `util'
Makefile:41: warning: ignoring old commands for target `util'
gmake -C gen -f Makefile.hvr_gcc clean
gmake[1]: Entering directory `/export/guam/jigsaw/dev/jhwgu/src/jz/gen'
rm -f libzizzy.a
rm -f *.o
gmake[1]: Leaving directory `/export/guam/jigsaw/dev/jhwgu/src/jz/gen'
gmake -C ora -f Makefile.hvr_gcc clean
gmake[1]: Entering directory `/export/guam/jigsaw/dev/jhwgu/src/jz/ora'
rm -f libzizora.a
rm -f *.o
rm -f ../gen/*.o
gmake[1]: Leaving directory `/export/guam/jigsaw/dev/jhwgu/src/jz/ora'
gmake -C util -f Makefile.hvr_gcc clean
gmake[1]: Entering directory `/export/guam/jigsaw/dev/jhwgu/src/jz/util'
rm -f zizzy
rm -f *.o
gmake[1]: Leaving directory `/export/guam/jigsaw/dev/jhwgu/src/jz/util'
================================================

Could anybody help me out? Thanks in advance!
_________________________________________________________________
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx




reply via email to

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