makefile 1.2 KB
Newer Older
1
2
#
#             LUFA Library
3
#     Copyright (C) Dean Camera, 2012.
4
#
5
#  dean [at] fourwalledcubicle [dot] com
6
#           www.lufa-lib.org
7
8
9
10
11
12
13
14
15
#

# Makefile to build all the LUFA USB Bootloaders. Call with "make all" to
# rebuild all bootloaders.

# Bootloaders are pre-cleaned before each one is built, to ensure any
# custom LUFA library build options are reflected in the compiled
# code.

16
PROJECT_DIRECTORIES = $(shell ls -d */)
17

18
19
20
21
22
23
24
# This makefile is potentially infinitely recursive if something really bad
# happens when determining the set of project directories - hard-abort if
# more than 10 levels deep to avoid angry emails.
ifeq ($(MAKELEVEL), 10)
   $(error EMERGENCY ABORT: INFINITE RECURSION DETECTED)
endif

25
# If building without a per-project object directory, we can't build in parallel
26
ifeq ($(OBJDIR),)
27
28
29
30
31
32
33
34
35
   .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
36
endif
37

38
39
40
41
42
43
44
%: $(PROJECT_DIRECTORIES)
	@echo . > /dev/null

$(PROJECT_DIRECTORIES):
	@$(MAKE) -C $@ $(MAKECMDGOALS)
    
.PHONY: $(PROJECT_DIRECTORIES)