Browse code

- fix for make modules=foo clean (this produced an infinite loop)

Andrei Pelinescu-Onciul authored on 01/06/2005 23:23:48
Showing 1 changed files
... ...
@@ -41,12 +41,15 @@ static: $(objs)
41 41
 clean: 
42 42
 	-@rm -f $(objs) $(NAME) $(objs:.o=.il) 2>/dev/null
43 43
 	-@for r in $(modules) $(static_modules_path) "" ; do \
44
-		if [ -n "$$r" ]; then \
44
+		if [ -d "$$r" ]; then \
45 45
 			echo "module $$r" ; \
46 46
 			$(MAKE) -C $$r clean ; \
47 47
 		fi ; \
48 48
 	done
49
-	@if [ -n "$(modules)" ]; then cd utils/gen_ha1; $(MAKE) clean; cd ../serunix; $(MAKE) clean; fi
49
+	@if [ -n "$(modules)" -a -d utils/gen_ha1 ]; then \
50
+		cd utils/gen_ha1; $(MAKE) clean; \
51
+		cd ../serunix; $(MAKE) clean; \
52
+	fi
50 53
 
51 54
 .PHONY: proper
52 55
 .PHONY: distclean
... ...
@@ -54,7 +57,7 @@ clean:
54 54
 proper realclean distclean: clean 
55 55
 	-@rm -f $(depends) $(auto_gen) 2>/dev/null
56 56
 	-@for r in $(modules) "" ; do \
57
-		if [ -n "$$r" ]; then \
57
+		if [ -d "$$r" ]; then \
58 58
 			 $(MAKE) -C $$r proper ; \
59 59
 		fi ; \
60 60
 	done 
... ...
@@ -63,7 +66,7 @@ proper realclean distclean: clean
63 63
 mantainer-clean: distclean
64 64
 	-rm -f TAGS tags *.dbg .*.swp
65 65
 	-@for r in $(modules) "" ; do \
66
-		if [ -n "$$r" ]; then \
66
+		if [ -d "$$r" ]; then \
67 67
 			$(MAKE) -C $$r mantainer-clean; \
68 68
 		fi ; \
69 69
 	 done