common.mk 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # Functionality common to both top-level project makefile (project.mk)
  2. # and component makefiles (component_wrapper.mk)
  3. #
  4. # Include project config makefile, if it exists.
  5. #
  6. # (Note that we only rebuild this makefile automatically for some
  7. # targets, see project_config.mk for details.)
  8. SDKCONFIG_MAKEFILE ?= $(abspath $(BUILD_DIR_BASE)/include/config/auto.conf)
  9. -include $(SDKCONFIG_MAKEFILE)
  10. export SDKCONFIG_MAKEFILE # sub-makes (like bootloader) will reuse this path
  11. #Handling of V=1/VERBOSE=1 flag
  12. #
  13. # if V=1, $(summary) does nothing and $(details) will echo extra details
  14. # if V is unset or not 1, $(summary) echoes a summary and $(details) does nothing
  15. V ?= $(VERBOSE)
  16. ifeq ("$(V)","1")
  17. summary := @true
  18. details := @echo
  19. else
  20. summary := @echo
  21. details := @true
  22. # disable echoing of commands, directory names
  23. MAKEFLAGS += --silent
  24. endif
  25. # General make utilities
  26. # convenience variable for printing an 80 asterisk wide separator line
  27. SEPARATOR:="*******************************************************************************"
  28. # macro to remove quotes from an argument, ie $(call dequote,$(CONFIG_BLAH))
  29. define dequote
  30. $(subst ",,$(1))
  31. endef
  32. # " comment kept here to keep syntax highlighting happy
  33. # macro to keep an absolute path as-is, but resolve a relative path
  34. # against a particular parent directory
  35. #
  36. # $(1) path to resolve
  37. # $(2) directory to resolve non-absolute path against
  38. #
  39. # Path and directory don't have to exist (definition of a "relative
  40. # path" is one that doesn't start with /)
  41. #
  42. # $(2) can contain a trailing forward slash or not, result will not
  43. # double any path slashes.
  44. #
  45. # example $(call resolvepath,$(CONFIG_PATH),$(CONFIG_DIR))
  46. define resolvepath
  47. $(if $(filter /%,$(1)),$(1),$(subst //,/,$(2)/$(1)))
  48. endef