Browse code

makefiles: clean-utils and proper-utils fix

- clean-utils and proper-utils now work both from the main
directory (for utils compiled by make utils or installed by make
install-utils) and from the modules directories (for utils
installed by a module)
- make utils now works in module directories (compiles utils that
would be installed by the module)

Andrei Pelinescu-Onciul authored on 04/12/2009 17:16:25
Showing 3 changed files
... ...
@@ -953,6 +953,28 @@ clean-libs:
953 953
 proper-libs realclean-libs distclean-libs maintainer-clean-libs:
954 954
 			$(MAKE) -C lib $(patsubst %-libs,%,$@)
955 955
 
956
+# utils cleaning targets
957
+
958
+.PHONY: clean-utils
959
+clean-utils:
960
+	@for r in $(C_COMPILE_UTILS) $(C_INSTALL_UTILS) "" ; do \
961
+		if [ -d "$$r" ]; then \
962
+			 $(MAKE) -C "$$r" clean ; \
963
+		fi ; \
964
+	done
965
+
966
+.PHONY: proper-utils
967
+.PHONY: distclean-utils
968
+.PHONY: realclean-utils
969
+.PHONY: maintainer-clean-utils
970
+proper-utils realclean-utils distclean-utils maintainer-clean-utils: \
971
+ clean_target=$(patsubst %-utils,%,$@)
972
+proper-utils realclean-utils distclean-utils maintainer-clean-utils:
973
+	@for r in $(C_COMPILE_UTILS) $(C_INSTALL_UTILS) "" ; do \
974
+		if [ -d "$$r" ]; then \
975
+			 $(MAKE) -C "$$r" $(clean_target); \
976
+		fi ; \
977
+	done
956 978
 
957 979
 # clean extra binary names (common "flavour" names)
958 980
 clean: clean-extra-names
... ...
@@ -139,14 +139,45 @@ install-libs:
139 139
 
140 140
 endif # $(SER_LIBS)
141 141
 
142
+.PHONY: utils
143
+.PHONY: clean-utils
144
+.PHONY: proper-utils
145
+.PHONY: distclean-utils
146
+.PHONY: realclean-utils
147
+.PHONY: maintainer-clean-utils
142 148
 ifneq (,$(MOD_INSTALL_UTILS))
143 149
 install-utils:
144 150
 	@for ut in $(MOD_INSTALL_UTILS) ; do \
145 151
 		$(call try_err, $(MAKE) -C "$${ut}" install-if-newer ) ;\
146 152
 	done; true
147 153
 
154
+utils:
155
+	@for r in $(MOD_INSTALL_UTILS) ; do \
156
+		$(call try_err, $(MAKE) -C "$$r" ) ;\
157
+	done; true
158
+
159
+clean-utils:
160
+	@for r in $(MOD_INSTALL_UTILS) ; do \
161
+		if [ -d "$$r" ]; then \
162
+			 $(MAKE) -C "$$r" clean ; \
163
+		fi ; \
164
+	done
165
+
166
+proper-utils realclean-utils distclean-utils maintainer-clean-utils: \
167
+ clean_target=$(patsubst %-utils,%,$@)
168
+proper-utils realclean-utils distclean-utils maintainer-clean-utils:
169
+	@for r in $(MOD_INSTALL_UTILS) ; do \
170
+		if [ -d "$$r" ]; then \
171
+			 $(MAKE) -C "$$r" $(clean_target); \
172
+		fi ; \
173
+	done
174
+
148 175
 else
176
+# ! MOD_INSTALL_UTILS
149 177
 install-utils:
178
+utils:
179
+clean-utils:
180
+proper-utils realclean-utils distclean-utils maintainer-clean-utils:
150 181
 
151 182
 endif # $(MOD_INSTALL_UTILS)
152 183
 
... ...
@@ -218,16 +218,6 @@ clean-modules:
218 218
 		fi ; \
219 219
 	done
220 220
 
221
-.PHONY: clean-utils
222
-clean-utils:
223
-	@if [ -n "$(cmodules)" ]; then \
224
-		for r in $(utils_compile) "" ; do \
225
-			if [ -d "$$r" ]; then \
226
-				 $(MAKE) -C "$$r" clean ; \
227
-			fi ; \
228
-		done \
229
-	fi
230
-
231 221
 # make proper for the local directory
232 222
 .PHONY: proper
233 223
 .PHONY: distclean
... ...
@@ -253,21 +243,6 @@ proper-modules realclean-modules distclean-modules maintainer-clean-modules:
253 253
 		fi ; \
254 254
 	done
255 255
 
256
-.PHONY: proper-utils
257
-.PHONY: distclean-utils
258
-.PHONY: realclean-utils
259
-.PHONY: maintainer-clean-utils
260
-proper-utils realclean-utils distclean-utils maintainer-clean-utils: \
261
- clean_target=$(patsubst %-utils,%,$@)
262
-proper-utils realclean-utils distclean-utils maintainer-clean-utils:
263
-	@if [ -n "$(cmodules)" ]; then \
264
-		for r in $(utils_compile) "" ; do \
265
-			if [ -d "$$r" ]; then \
266
-				 $(MAKE) -C "$$r" $(clean_target); \
267
-			fi ; \
268
-		done \
269
-	fi
270
-
271 256
 .PHONY: clean-tmp
272 257
 clean-tmp:
273 258
 	-@rm -f TAGS tags *.dbg .*.swp