makefile 1.31 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
# Makefile to build all the LUFA Dual Role Demos. Call with "make all" to
# rebuild all Dual Role demos.
11
12
13
14
15

# Projects 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
# Need to special-case building without a per-project object directory
26
ifeq ($(OBJDIR),)
27
   # If no target specified, force "clean all" and disallow parallel build   
28
29
   ifeq ($(MAKECMDGOALS),)
      MAKECMDGOALS := clean all
30
      .NOTPARALLEL:
31
   endif
32
33

   # If one of the targets is to build, force "clean" beforehand and disallow parallel build   
34
35
   ifneq ($(findstring all, $(MAKECMDGOALS)),)
      MAKECMDGOALS := clean $(MAKECMDGOALS)
36
      .NOTPARALLEL:
37
   endif
38
endif
39

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

43
44
45
46
$(PROJECT_DIRECTORIES):
	@$(MAKE) -C $@ $(MAKECMDGOALS)
    
.PHONY: $(PROJECT_DIRECTORIES)