Update of /cvsroot/libfunutil/libfunutil/toc/make
In directory sc8-pr-cvs1:/tmp/cvs-serv20565/toc/make
Modified Files:
subdirs_traverser.make
Log Message:
major rewrites vis-a-vis subdirs handling.
Index: subdirs_traverser.make
===================================================================
RCS file: /cvsroot/libfunutil/libfunutil/toc/make/subdirs_traverser.make,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- subdirs_traverser.make 31 Aug 2003 00:44:26 -0000 1.9
+++ subdirs_traverser.make 31 Aug 2003 20:26:43 -0000 1.10
@@ -16,39 +16,43 @@
# $1 = list of dirs
# $2 = target
toc_make_subdirs = \
- test -z "$(1)" && exit 0; \
+ test "x$(1)" = "x" && exit 0; \
+ tgt="$(2)"; test -z "$$tgt" && tgt="all"; \
for b in $(1) ""; do test -z "$$b" && continue; \
pwd=$$(pwd); \
- tgt="$(2)"; test -z "$$tgt" && tgt="all"; \
- echo "Making $$tgt in directory $$pwd/$$b..."; \
- ${MAKE} --no-print-directory -C $$b $(2) || exit; \
+ cd $$pwd/$$b || exit; \
+ echo "Making $$tgt in $$pwd/$${b}"; \
+ ${MAKE} $$tgt || exit; \
+ cd $$pwd || exit; \
done
SUBDIRS_CLEANERS = $(patsubst %,clean-%,$(SUBDIRS))
SUBDIRS_DISTCLEANERS = $(patsubst %,distclean-%,$(SUBDIRS))
$(SUBDIRS_CLEANERS) $(SUBDIRS_DISTCLEANERS):
@dir=$@;target=$$dir; dir=$${dir##*-}; target=$${target%%-*}; \
- ${MAKE} -C $$dir $$target;
+ ${MAKE} -C $$dir $$target
.PHONY: subdirs $(SUBDIRS) $(SUBDIRS_CLEANERS) $(SUBDIRS_DISTCLEANERS) \
distclean-subdirs clean-subdirs
$(SUBDIRS):
- ${MAKE} -C $@
+ @$(call toc_make_subdirs,$@)
# make $* as a subdirectory:
-subdir-%:
+subdir-%: # makes $* subdir
@$(call toc_make_subdirs,$*)
-clean-%:
- @test -d "$*" || exit 0; $(call toc_make_subdirs,$*,clean)
+clean-%: # cleans $* subdir
+ @$(call toc_make_subdirs,$*,clean)
+# @test -d "$*" || exit 0;
distclean-%:
- @test -d "$*" || exit 0; $(call toc_make_subdirs,$*,distclean)
+ @$(call toc_make_subdirs,$*,distclean)
+subdirs-%: # calls $* target in all $(SUBDIRS)
+ @$(call toc_make_subdirs,$(SUBDIRS),$*)
+
subdirs: $(addprefix subdir-,$(SUBDIRS))
clean-subdirs: $(patsubst %,clean-%,$(SUBDIRS))
distclean-subdirs: $(patsubst %,distclean-%,$(SUBDIRS))
-clean: clean-subdirs
-distclean: clean-PWD distclean-subdirs
|