makefile 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #
  2. # LUFA Library
  3. # Copyright (C) Dean Camera, 2018.
  4. #
  5. # dean [at] fourwalledcubicle [dot] com
  6. # www.lufa-lib.org
  7. #
  8. # Makefile to build all the LUFA USB Bootloaders. Call with "make all" to
  9. # rebuild all bootloaders.
  10. # Bootloaders are pre-cleaned before each one is built, to ensure any
  11. # custom LUFA library build options are reflected in the compiled
  12. # code.
  13. PROJECT_DIRECTORIES := $(shell ls -d */)
  14. # This makefile is potentially infinitely recursive if something really bad
  15. # happens when determining the set of project directories - hard-abort if
  16. # more than 10 levels deep to avoid angry emails.
  17. ifeq ($(MAKELEVEL), 10)
  18. $(error EMERGENCY ABORT: INFINITE RECURSION DETECTED)
  19. endif
  20. # Need to special-case building without a per-project object directory
  21. ifeq ($(OBJDIR),)
  22. # If no target specified, force "clean all" and disallow parallel build
  23. ifeq ($(MAKECMDGOALS),)
  24. MAKECMDGOALS := clean all
  25. .NOTPARALLEL:
  26. endif
  27. # If one of the targets is to build, force "clean" beforehand and disallow parallel build
  28. ifneq ($(findstring all, $(MAKECMDGOALS)),)
  29. MAKECMDGOALS := clean $(MAKECMDGOALS)
  30. .NOTPARALLEL:
  31. endif
  32. endif
  33. %: $(PROJECT_DIRECTORIES)
  34. @echo . > /dev/null
  35. $(PROJECT_DIRECTORIES):
  36. @$(MAKE) -C $@ $(MAKECMDGOALS)
  37. .PHONY: $(PROJECT_DIRECTORIES)