aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2012-07-10 18:30:41 +0000
committerDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2012-07-10 18:30:41 +0000
commit245a0a81abcd4706fef7d034eb0bb69af79ec595 (patch)
treeefc5238c97e02270f002f474c64503a9571af98d
parent0e230bac5d3e1f0eebbd7711e222d2db499a8271 (diff)
Slightly better method of recursive make - use proper make dependencies to allow for parallel builds.
git-svn-id: http://lufa-lib.googlecode.com/svn/trunk@2391 d5102386-fcda-11dd-9fdb-3debd5008f28
-rw-r--r--Bootloaders/makefile21
-rw-r--r--Demos/Device/ClassDriver/makefile21
-rw-r--r--Demos/Device/LowLevel/makefile21
-rw-r--r--Demos/DualRole/ClassDriver/makefile20
-rw-r--r--Demos/Host/ClassDriver/makefile21
-rw-r--r--Demos/Host/LowLevel/makefile21
-rw-r--r--Projects/makefile22
7 files changed, 119 insertions, 28 deletions
diff --git a/Bootloaders/makefile b/Bootloaders/makefile
index 01aa506f..ba4f5125 100644
--- a/Bootloaders/makefile
+++ b/Bootloaders/makefile
@@ -22,10 +22,23 @@ ifeq ($(MAKELEVEL), 10)
$(error EMERGENCY ABORT: INFINITE RECURSION DETECTED)
endif
-all:
+# If building without a per-project object directory, we can't build in parallel
ifeq ($(OBJDIR),)
- @$(foreach PROJECT, $(PROJECT_DIRECTORIES), $(MAKE) -C $(PROJECT) clean all;)
+ .NOTPARALLEL:
+
+ # Ensure projects are pre-cleaned if the target is the default or "all"
+ ifeq ($(MAKECMDGOALS),)
+ MAKECMDGOALS := clean all
+ endif
+ ifneq ($(findstring all, $(MAKECMDGOALS)),)
+ MAKECMDGOALS := clean $(MAKECMDGOALS)
+ endif
endif
-%:
- @$(foreach PROJECT, $(PROJECT_DIRECTORIES), $(MAKE) -C $(PROJECT) $@;)
+%: $(PROJECT_DIRECTORIES)
+ @echo . > /dev/null
+
+$(PROJECT_DIRECTORIES):
+ @$(MAKE) -C $@ $(MAKECMDGOALS)
+
+.PHONY: $(PROJECT_DIRECTORIES)
diff --git a/Demos/Device/ClassDriver/makefile b/Demos/Device/ClassDriver/makefile
index ad880009..3a5615e0 100644
--- a/Demos/Device/ClassDriver/makefile
+++ b/Demos/Device/ClassDriver/makefile
@@ -22,10 +22,23 @@ ifeq ($(MAKELEVEL), 10)
$(error EMERGENCY ABORT: INFINITE RECURSION DETECTED)
endif
-all:
+# If building without a per-project object directory, we can't build in parallel
ifeq ($(OBJDIR),)
- @$(foreach PROJECT, $(PROJECT_DIRECTORIES), $(MAKE) -C $(PROJECT) clean all;)
+ .NOTPARALLEL:
+
+ # Ensure projects are pre-cleaned if the target is the default or "all"
+ ifeq ($(MAKECMDGOALS),)
+ MAKECMDGOALS := clean all
+ endif
+ ifneq ($(findstring all, $(MAKECMDGOALS)),)
+ MAKECMDGOALS := clean $(MAKECMDGOALS)
+ endif
endif
-%:
- @$(foreach PROJECT, $(PROJECT_DIRECTORIES), $(MAKE) -C $(PROJECT) $@;)
+%: $(PROJECT_DIRECTORIES)
+ @echo . > /dev/null
+
+$(PROJECT_DIRECTORIES):
+ @$(MAKE) -C $@ $(MAKECMDGOALS)
+
+.PHONY: $(PROJECT_DIRECTORIES)
diff --git a/Demos/Device/LowLevel/makefile b/Demos/Device/LowLevel/makefile
index ad880009..3a5615e0 100644
--- a/Demos/Device/LowLevel/makefile
+++ b/Demos/Device/LowLevel/makefile
@@ -22,10 +22,23 @@ ifeq ($(MAKELEVEL), 10)
$(error EMERGENCY ABORT: INFINITE RECURSION DETECTED)
endif
-all:
+# If building without a per-project object directory, we can't build in parallel
ifeq ($(OBJDIR),)
- @$(foreach PROJECT, $(PROJECT_DIRECTORIES), $(MAKE) -C $(PROJECT) clean all;)
+ .NOTPARALLEL:
+
+ # Ensure projects are pre-cleaned if the target is the default or "all"
+ ifeq ($(MAKECMDGOALS),)
+ MAKECMDGOALS := clean all
+ endif
+ ifneq ($(findstring all, $(MAKECMDGOALS)),)
+ MAKECMDGOALS := clean $(MAKECMDGOALS)
+ endif
endif
-%:
- @$(foreach PROJECT, $(PROJECT_DIRECTORIES), $(MAKE) -C $(PROJECT) $@;)
+%: $(PROJECT_DIRECTORIES)
+ @echo . > /dev/null
+
+$(PROJECT_DIRECTORIES):
+ @$(MAKE) -C $@ $(MAKECMDGOALS)
+
+.PHONY: $(PROJECT_DIRECTORIES)
diff --git a/Demos/DualRole/ClassDriver/makefile b/Demos/DualRole/ClassDriver/makefile
index 741383f1..71fb805e 100644
--- a/Demos/DualRole/ClassDriver/makefile
+++ b/Demos/DualRole/ClassDriver/makefile
@@ -22,11 +22,23 @@ ifeq ($(MAKELEVEL), 10)
$(error EMERGENCY ABORT: INFINITE RECURSION DETECTED)
endif
-all:
+# If building without a per-project object directory, we can't build in parallel
ifeq ($(OBJDIR),)
- @$(foreach PROJECT, $(PROJECT_DIRECTORIES), $(MAKE) -C $(PROJECT) clean all;)
+ .NOTPARALLEL:
+
+ # Ensure projects are pre-cleaned if the target is the default or "all"
+ ifeq ($(MAKECMDGOALS),)
+ MAKECMDGOALS := clean all
+ endif
+ ifneq ($(findstring all, $(MAKECMDGOALS)),)
+ MAKECMDGOALS := clean $(MAKECMDGOALS)
+ endif
endif
-%:
- @$(foreach PROJECT, $(PROJECT_DIRECTORIES), $(MAKE) -C $(PROJECT) $@;)
+%: $(PROJECT_DIRECTORIES)
+ @echo . > /dev/null
+$(PROJECT_DIRECTORIES):
+ @$(MAKE) -C $@ $(MAKECMDGOALS)
+
+.PHONY: $(PROJECT_DIRECTORIES)
diff --git a/Demos/Host/ClassDriver/makefile b/Demos/Host/ClassDriver/makefile
index d9a3dc35..a2b14c8a 100644
--- a/Demos/Host/ClassDriver/makefile
+++ b/Demos/Host/ClassDriver/makefile
@@ -22,10 +22,23 @@ ifeq ($(MAKELEVEL), 10)
$(error EMERGENCY ABORT: INFINITE RECURSION DETECTED)
endif
-all:
+# If building without a per-project object directory, we can't build in parallel
ifeq ($(OBJDIR),)
- @$(foreach PROJECT, $(PROJECT_DIRECTORIES), $(MAKE) -C $(PROJECT) clean all;)
+ .NOTPARALLEL:
+
+ # Ensure projects are pre-cleaned if the target is the default or "all"
+ ifeq ($(MAKECMDGOALS),)
+ MAKECMDGOALS := clean all
+ endif
+ ifneq ($(findstring all, $(MAKECMDGOALS)),)
+ MAKECMDGOALS := clean $(MAKECMDGOALS)
+ endif
endif
-%:
- @$(foreach PROJECT, $(PROJECT_DIRECTORIES), $(MAKE) -C $(PROJECT) $@;)
+%: $(PROJECT_DIRECTORIES)
+ @echo . > /dev/null
+
+$(PROJECT_DIRECTORIES):
+ @$(MAKE) -C $@ $(MAKECMDGOALS)
+
+.PHONY: $(PROJECT_DIRECTORIES)
diff --git a/Demos/Host/LowLevel/makefile b/Demos/Host/LowLevel/makefile
index d9a3dc35..a2b14c8a 100644
--- a/Demos/Host/LowLevel/makefile
+++ b/Demos/Host/LowLevel/makefile
@@ -22,10 +22,23 @@ ifeq ($(MAKELEVEL), 10)
$(error EMERGENCY ABORT: INFINITE RECURSION DETECTED)
endif
-all:
+# If building without a per-project object directory, we can't build in parallel
ifeq ($(OBJDIR),)
- @$(foreach PROJECT, $(PROJECT_DIRECTORIES), $(MAKE) -C $(PROJECT) clean all;)
+ .NOTPARALLEL:
+
+ # Ensure projects are pre-cleaned if the target is the default or "all"
+ ifeq ($(MAKECMDGOALS),)
+ MAKECMDGOALS := clean all
+ endif
+ ifneq ($(findstring all, $(MAKECMDGOALS)),)
+ MAKECMDGOALS := clean $(MAKECMDGOALS)
+ endif
endif
-%:
- @$(foreach PROJECT, $(PROJECT_DIRECTORIES), $(MAKE) -C $(PROJECT) $@;)
+%: $(PROJECT_DIRECTORIES)
+ @echo . > /dev/null
+
+$(PROJECT_DIRECTORIES):
+ @$(MAKE) -C $@ $(MAKECMDGOALS)
+
+.PHONY: $(PROJECT_DIRECTORIES)
diff --git a/Projects/makefile b/Projects/makefile
index 2bc9f98b..ec8e65b8 100644
--- a/Projects/makefile
+++ b/Projects/makefile
@@ -22,10 +22,24 @@ ifeq ($(MAKELEVEL), 10)
$(error EMERGENCY ABORT: INFINITE RECURSION DETECTED)
endif
-all:
+# If building without a per-project object directory, we can't build in parallel
ifeq ($(OBJDIR),)
- @$(foreach PROJECT, $(PROJECT_DIRECTORIES), $(MAKE) -C $(PROJECT) clean all;)
+ .NOTPARALLEL:
+
+ # Ensure projects are pre-cleaned if the target is the default or "all"
+ ifeq ($(MAKECMDGOALS),)
+ MAKECMDGOALS := clean all
+ endif
+ ifneq ($(findstring all, $(MAKECMDGOALS)),)
+ MAKECMDGOALS := clean $(MAKECMDGOALS)
+ endif
endif
-%:
- @$(foreach PROJECT, $(PROJECT_DIRECTORIES), $(MAKE) -C $(PROJECT) $@;)
+%: $(PROJECT_DIRECTORIES)
+ @echo . > /dev/null
+
+$(PROJECT_DIRECTORIES):
+ @$(MAKE) -C $@ $(MAKECMDGOALS)
+
+.PHONY: $(PROJECT_DIRECTORIES)
+