make.mk 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #
  2. # Common make definition for all examples
  3. #
  4. # Compiler
  5. CROSS_COMPILE = arm-none-eabi-
  6. CC = $(CROSS_COMPILE)gcc
  7. CXX = $(CROSS_COMPILE)g++
  8. OBJCOPY = $(CROSS_COMPILE)objcopy
  9. SIZE = $(CROSS_COMPILE)size
  10. MKDIR = mkdir
  11. SED = sed
  12. CP = cp
  13. RM = rm
  14. # Select the board to build for.
  15. ifeq ($(BOARD),)
  16. $(info You must provide a BOARD parameter with 'BOARD=')
  17. $(info Possible values are:)
  18. $(info $(sort $(subst /.,,$(subst $(TOP)/hw/bsp/,,$(wildcard $(TOP)/hw/bsp/*/.)))))
  19. $(error BOARD not defined)
  20. else
  21. ifeq ($(wildcard $(TOP)/hw/bsp/$(BOARD)/.),)
  22. $(error Invalid BOARD specified)
  23. endif
  24. endif
  25. # Build directory
  26. BUILD = build-$(BOARD)
  27. # Board specific
  28. include $(TOP)/hw/bsp/$(BOARD)/board.mk
  29. # Compiler Flags
  30. CFLAGS += \
  31. -fsingle-precision-constant \
  32. -fno-strict-aliasing \
  33. -Wdouble-promotion \
  34. -Wno-endif-labels \
  35. -Wstrict-prototypes \
  36. -Wall \
  37. -Werror \
  38. -Werror-implicit-function-declaration \
  39. -Wfloat-equal \
  40. -Wundef \
  41. -Wshadow \
  42. -Wwrite-strings \
  43. -Wsign-compare \
  44. -Wmissing-format-attribute \
  45. -Wno-deprecated-declarations \
  46. -Wnested-externs \
  47. -Wunreachable-code \
  48. -Wno-error=lto-type-mismatch \
  49. -ffunction-sections \
  50. -fdata-sections
  51. # This causes lots of warning with nrf5x build due to nrfx code
  52. # CFLAGS += -Wcast-align
  53. # Debugging/Optimization
  54. ifeq ($(DEBUG), 1)
  55. CFLAGS += -O0 -ggdb
  56. else
  57. CFLAGS += -flto -Os
  58. endif