common.mk 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 $(BUILD_DIR_BASE)/include/config/auto.conf
  9. #Handling of V=1/VERBOSE=1 flag
  10. #
  11. # if V=1, $(summary) does nothing and $(details) will echo extra details
  12. # if V is unset or not 1, $(summary) echoes a summary and $(details) does nothing
  13. V ?= $(VERBOSE)
  14. ifeq ("$(V)","1")
  15. Q :=
  16. summary := @true
  17. details := @echo
  18. else
  19. Q := @
  20. summary := @echo
  21. details := @true
  22. endif
  23. # Pseudo-target to handle the case where submodules need to be
  24. # re-initialised.
  25. #
  26. # $(eval $(call SubmoduleRequiredForFiles,FILENAMES)) to create a target that
  27. # automatically runs 'git submodule update --init' if those files
  28. # are missing, and fails if this is not possible.
  29. define SubmoduleRequiredForFiles
  30. $(1):
  31. @echo "WARNING: Missing submodule for $$@..."
  32. $(Q) [ -d ${IDF_PATH}/.git ] || ( echo "ERROR: esp-idf must be cloned from git to work."; exit 1)
  33. $(Q) [ -x $(which git) ] || ( echo "ERROR: Need to run 'git submodule --init' in esp-idf root directory."; exit 1)
  34. @echo "Attempting 'git submodule update --init' in esp-idf root directory..."
  35. cd ${IDF_PATH} && git submodule update --init
  36. endef
  37. # General make utilities
  38. # convenience variable for printing an 80 asterisk wide separator line
  39. SEPARATOR:="*******************************************************************************"
  40. # macro to remove quotes from an argument, ie $(call dequote (CONFIG_BLAH))
  41. define dequote
  42. $(subst ",,$(1))
  43. endef
  44. # " comment kept here to keep syntax highlighting happy