Skip to contentSkip to conversation

tools - Add generic subdirs rules

PATCH In review Bastian Blank 2 participants 2 messages Mar 21, 2008 – Mar 25, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/8 tools - Add generic subdirs rules

# HG changeset patch
# User Bastian Blank <[email protected]>
# Date 1206103827 -3600
# Node ID f08e76266aa7190436f013532cd01d9693ebdaa8 # Parent 76c9cf11ce23540b6016116a972bb4f0e0480a14 Add generic subdirs rules.

Use them in the toplevel Makefile.

tools/Makefile +3 -21
diff -r 76c9cf11ce23 -r f08e76266aa7 tools/Makefile
@@ -37,34 +37,16 @@ endif
 endif
 
 .PHONY: all
-all:
-	@set -e; for subdir in $(SUBDIRS-y); do \
-		$(MAKE) subdir-$@-$$subdir; \
-	done
+all: subdirs-all
 
 .PHONY: install
-install:
-	@set -e; for subdir in $(SUBDIRS-y); do \
-		$(MAKE) subdir-$@-$$subdir; \
-	done
+install: subdirs-install
 	$(INSTALL_DIR) $(DESTDIR)/var/xen/dump
 	$(INSTALL_DIR) $(DESTDIR)/var/log/xen
 	$(INSTALL_DIR) $(DESTDIR)/var/lib/xen
 
 .PHONY: clean distclean
-clean distclean:
-	@set -e; for subdir in $(SUBDIRS-y); do \
-		$(MAKE) subdir-clean-$$subdir; \
-	done
-
-subdir-all-%:
-	$(MAKE) -C $* all
-
-subdir-clean-%:
-	$(MAKE) -C $* clean
-
-subdir-install-%:
-	$(MAKE) -C $* install
+clean distclean: subdirs-clean
 
 ifneq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
 IOEMU_CONFIGURE_CROSS ?= --cross-prefix=$(CROSS_COMPILE) \
tools/Rules.mk +10 -0
diff -r 76c9cf11ce23 -r f08e76266aa7 tools/Rules.mk
@@ -49,3 +49,13 @@ check-$(CONFIG_X86) = $(call cc-ver-chec
 %.o: %.cc
 	$(CC) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
 
+.PHONY: subdirs-all subdirs-clean subdirs-install
+.NOTPARALLEL: subdirs-all subdirs-clean subdirs-install
+subdirs-all subdirs-clean subdirs-install:
+	@set -e; for subdir in $(SUBDIRS) $(SUBDIRS-y); do \
+		$(MAKE) subdir-$(patsubst subdirs-%,%,$@)-$$subdir; \
+	done
+
+subdir-all-% subdir-clean-% subdir-install-%:
+	$(MAKE) -C $* $(patsubst subdir-%-$*,%,$@)
+
Signature · 1 line
She won' go Warp 7, Cap'n!  The batteries are dead!
#1 lore raw
Quoted 13 lines · Bastian Blank

Add generic subdirs rules.

Use them in the toplevel Makefile.

diff -r 76c9cf11ce23 -r f08e76266aa7 tools/Rules.mk

tools/Rules.mk Fri Mar 21 13:50:27 2008 +0100 renamed from tools/Rules.mk Fri Mar 21 09:45:34 2008 +0000 +0 -0
@@ -49,3 +49,13 @@ check-$(CONFIG_X86) = $(call cc-ver-chec
 %.o: %.cc

$(CC) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<

Quoted 2 lines

+.PHONY: subdirs-all subdirs-clean subdirs-install +.NOTPARALLEL: subdirs-all subdirs-clean subdirs-install

No, .NOTPARALLEL in GNU Make causes parallelism to be globally disabled, not just for the listed dependent targets. It's really not the right answer here, and it allowed you in a later patch to break the dependencies in tools/firmware -- it may look neater to list subdirs-all as a dependency of all, but it's not correct in all cases!

I applied your patches, then removed .NOTPARALLEL and fixed up the breakages.

-- Keir