3 # Copyright (C) Dean Camera, 2012.
5 # dean [at] fourwalledcubicle [dot] com
9 # Makefile to build all the LUFA Device Demos. Call with "make all" to
10 # rebuild all Device demos.
12 # Projects are pre-cleaned before each one is built, to ensure any
13 # custom LUFA library build options are reflected in the compiled
16 PROJECT_DIRECTORIES = $(shell ls -d */)
18 # This makefile is potentially infinitely recursive if something really bad
19 # happens when determining the set of project directories - hard-abort if
20 # more than 10 levels deep to avoid angry emails.
21 ifeq ($(MAKELEVEL), 10)
22 $(error EMERGENCY ABORT: INFINITE RECURSION DETECTED)
25 # If building without a per-project object directory, we can't build in parallel
29 # Ensure projects are pre-cleaned if the target is the default or "all"
30 ifeq ($(MAKECMDGOALS),)
31 MAKECMDGOALS := clean all
33 ifneq ($(findstring all, $(MAKECMDGOALS)),)
34 MAKECMDGOALS := clean $(MAKECMDGOALS)
38 %: $(PROJECT_DIRECTORIES)
41 $(PROJECT_DIRECTORIES):
42 @$(MAKE) -C $@ $(MAKECMDGOALS)
44 .PHONY: $(PROJECT_DIRECTORIES)