component.mk 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 include/config/auto.conf
  10. COMPONENT_SRCDIRS := . hwcrypto
  11. LIBS := crypto core net80211 phy rtc pp wpa smartconfig
  12. LINKER_SCRIPTS += -T esp32_out.ld -T esp32.common.ld -T esp32.rom.ld -T esp32.peripherals.ld
  13. COMPONENT_ADD_LDFLAGS := -lesp32 \
  14. $(abspath libhal.a) \
  15. -L$(abspath lib) \
  16. $(addprefix -l,$(LIBS)) \
  17. -L $(abspath ld) \
  18. $(LINKER_SCRIPTS)
  19. include $(IDF_PATH)/make/component_common.mk
  20. ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS))
  21. # automatically trigger a git submodule update
  22. # if any libraries are missing
  23. $(eval $(call SubmoduleCheck,$(ALL_LIB_FILES),$(COMPONENT_PATH)/lib))
  24. # this is a hack to make sure the app is re-linked if the binary
  25. # libraries change or are updated. If they change, the main esp32
  26. # library will be rebuild by AR andthis will trigger a re-linking of
  27. # the entire app.
  28. #
  29. # It would be better for components to be able to expose any of these
  30. # non-standard dependencies via get_variable, but this will do for now.
  31. $(COMPONENT_LIBRARY): $(ALL_LIB_FILES)
  32. # Preprocess esp32.ld linker script into esp32_out.ld
  33. #
  34. # The library doesn't really depend on esp32_out.ld, but it
  35. # saves us from having to add the target to a Makefile.projbuild
  36. $(COMPONENT_LIBRARY): esp32_out.ld
  37. # .. is BUILD_DIR_BASE here, as component makefiles
  38. # are evaluated with CWD=component build dir
  39. esp32_out.ld: $(COMPONENT_PATH)/ld/esp32.ld ../include/sdkconfig.h
  40. $(CC) -I ../include -C -P -x c -E $< -o $@
  41. COMPONENT_EXTRA_CLEAN := esp32_out.ld