common.mk 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #
  2. # Common Makefile Rules
  3. #
  4. # Environment Checks ###########################################################
  5. ifeq ($(OPT_LEVEL),)
  6. $(warning The OPT_LEVEL variable is unset. Defaulting to 0.)
  7. OPT_LEVEL = 0
  8. endif
  9. ifeq ($(OUTPUT_NAME),)
  10. $(error "The OUTPUT_NAME variable must be set to the name of the desired \
  11. binary. Example: OUTPUT_NAME = my_nanoapp")
  12. endif
  13. # Define all ###################################################################
  14. # All is defined here as the first target which causes make to build all by
  15. # default when no targets are supplied.
  16. .PHONY: all
  17. all:
  18. # If no make command goals are specified, default to all. At least one target
  19. # is required for environment checks. Building all will require toolchains for
  20. # all supported architectures which may not be desirable.
  21. ifeq ($(MAKECMDGOALS),)
  22. MAKECMDGOALS = all
  23. endif
  24. # Variant-specific Support Source Files ########################################
  25. SYS_SUPPORT_PATH = $(CHRE_PREFIX)/build/sys_support
  26. # Host Toolchain ###############################################################
  27. # The host toolchain is used to compile any programs for the compilation host
  28. # in order to complete the build.
  29. ifeq ($(CHRE_HOST_CC),)
  30. CHRE_HOST_CC = g++
  31. endif
  32. # Makefile Includes ############################################################
  33. # Common Includes
  34. include $(CHRE_PREFIX)/build/clean.mk
  35. include $(CHRE_PREFIX)/build/tools_config.mk
  36. # NanoPB Source Generation
  37. include $(CHRE_PREFIX)/build/nanopb.mk