component.mk 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #
  2. # Component Makefile
  3. #
  4. # This Makefile should, at the very least, just include $(IDF_PATH)/make/component_common.mk. By default,
  5. # this will take the sources in this directory, compile them and link them into
  6. # lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable,
  7. # please read the esp-idf build system document if you need to do this.
  8. #
  9. -include $(PROJECT_PATH)/build/include/config/auto.conf
  10. LIBS := crypto core net80211 phy rtc pp wpa wps
  11. ifeq ($(CONFIG_MEMMAP_BT),y)
  12. ifeq ($(CONFIG_MEMMAP_TRACEMEM),y)
  13. LINKER_SCRIPTS = -T esp32.bt.trace.ld
  14. else
  15. LINKER_SCRIPTS = -T esp32.bt.ld
  16. endif
  17. else
  18. ifeq ($(CONFIG_MEMMAP_TRACEMEM),y)
  19. LINKER_SCRIPTS = -T esp32.trace.ld
  20. else
  21. LINKER_SCRIPTS = -T esp32.ld
  22. endif
  23. endif
  24. LINKER_SCRIPTS += -T esp32.common.ld -T esp32.rom.ld
  25. COMPONENT_ADD_LDFLAGS := -lesp32 \
  26. $(abspath libhal.a) \
  27. -L$(abspath lib) \
  28. $(addprefix -l,$(LIBS)) \
  29. -L $(abspath ld) \
  30. $(LINKER_SCRIPTS)
  31. include $(IDF_PATH)/make/component_common.mk
  32. ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS))
  33. # The binary libraries are in a git submodule, so this target will
  34. # be invoked if any modules are missing (probably because
  35. # git submodule update --init needs to be run).
  36. $(ALL_LIB_FILES):
  37. $(Q) [ -d ${IDF_PATH}/.git ] || ( @echo "ERROR: Missing libraries in esp32 component. esp-idf must be cloned from git to work."; exit 1 )
  38. $(Q) [ -x $(which git) ] || ( @echo "ERROR: Missing libraries in esp32 component. Need to run 'git submodule update --init' in esp-idf root directory."; exit 1 )
  39. @echo "Warning: Missing libraries in components/esp32/lib/ submodule. Going to try running 'git submodule update --init' in esp-idf root directory..."
  40. cd ${IDF_PATH} && git submodule update --init
  41. # this is a hack to make sure the app is re-linked if the binary
  42. # libraries change or are updated. If they change, the main esp32
  43. # library will be rebuild by AR andthis will trigger a re-linking of
  44. # the entire app.
  45. #
  46. # It would be better for components to be able to expose any of these
  47. # non-standard dependencies via get_variable, but this will do for now.
  48. $(COMPONENT_LIBRARY): $(ALL_LIB_FILES)