common.mk 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # Functionality common to both top-level project makefile
  2. # and component makefiles
  3. #
  4. # Include project config file, if it exists.
  5. #
  6. # (Note that we only rebuild auto.conf automatically for some targets,
  7. # see project_config.mk for details.)
  8. -include $(PROJECT_PATH)/build/include/config/auto.conf
  9. ifeq ("$(LDFLAGS)","")
  10. LDFLAGS = -nostdlib \
  11. -L$(IDF_PATH)/lib \
  12. -L$(IDF_PATH)/ld \
  13. $(addprefix -L$(BUILD_DIR_BASE)/,$(COMPONENTS) $(SRCDIRS)) \
  14. -u call_user_start_cpu0 \
  15. -Wl,--gc-sections \
  16. -Wl,-static \
  17. -Wl,--start-group \
  18. $(COMPONENT_LDFLAGS) \
  19. -lgcc \
  20. -Wl,--end-group
  21. endif
  22. ifeq ("$(CFLAGS)","")
  23. CFLAGS = -DESP_PLATFORM -Og -std=gnu99 -g3 \
  24. -Wpointer-arith -Werror -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable \
  25. -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -Wall -ffunction-sections -fdata-sections $(EXTRA_CFLAGS)
  26. endif
  27. ifeq ("$(CXXFLAGS)","")
  28. CXXFLAGS = -DESP_PLATFORM -Og -std=gnu++11 -g3 \
  29. -Wpointer-arith -Werror -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable \
  30. -Wl,-EL -nostdlib -mlongcalls -Wall -ffunction-sections -fdata-sections $(EXTRA_CFLAGS) -fno-exceptions
  31. endif
  32. #Handling of V=1/VERBOSE=1 flag
  33. #
  34. # if V=1, $(summary) does nothing and $(details) will echo extra details
  35. # if V is unset or not 1, $(summary) echoes a summary and $(details) does nothing
  36. V ?= $(VERBOSE)
  37. ifeq ("$(V)","1")
  38. Q :=
  39. summary := @true
  40. details := @echo
  41. else
  42. Q := @
  43. summary := @echo
  44. details := @true
  45. endif
  46. # General make utilities
  47. # convenience variable for printing an 80 asterisk wide separator line
  48. SEPARATOR:="*******************************************************************************"
  49. # macro to remove quotes from an argument, ie $(call dequote (CONFIG_BLAH))
  50. define dequote
  51. $(subst ",,$(1))
  52. endef
  53. # " comment kept here to keep syntax highlighting happy