[OpenBIOS] [PATCH] build: improve subdir rules

Blue Swirl blauwirbel at gmail.com
Sat Feb 16 18:06:24 CET 2013


Use subdirectory build rules from QEMU. They allow a parallel build of
all available subdirectory targets.

Signed-off-by: Blue Swirl <blauwirbel at gmail.com>
---
 Makefile |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 3526b75..172f450 100644
--- a/Makefile
+++ b/Makefile
@@ -15,18 +15,24 @@ clean:
 		$(MAKE) -C $$dir clean; \
 	done
 
-build:
-	@printf "Building..."
+build: start-build
 	@for dir in $(ODIRS); do \
 		$(MAKE) -C $$dir > $$dir/build.log 2>&1 && echo "ok." || \
 		( echo "error:"; tail -15 $$dir/build.log; exit 1 ) \
 	done
 
-build-verbose:
+SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGETS))
+SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory)
+
+quiet-command = $(if $(V),$1,$(if $(2), at echo $2 && $1, @$1))
+
+build-verbose: start-build $(SUBDIR_RULES)
+
+subdir-%:
+	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C obj-$* V="$(V)" all,)
+
+start-build:
 	@echo "Building..."
-	@for dir in $(ODIRS); do \
-		$(MAKE) -C $$dir || exit 1; \
-	done
 
 run:
 	@echo "Running..."
-- 
1.7.2.5




More information about the OpenBIOS mailing list