component.mk 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #
  2. # Component Makefile
  3. #
  4. #ifdef IS_BOOTLOADER_BUILD
  5. CFLAGS += -DBOOTLOADER_BUILD
  6. #endif
  7. COMPONENT_SRCDIRS := . hwcrypto
  8. LIBS := core rtc
  9. ifdef CONFIG_PHY_ENABLED # BT || WIFI
  10. LIBS += phy coexist
  11. endif
  12. ifdef CONFIG_WIFI_ENABLED
  13. LIBS += net80211 pp wpa smartconfig coexist wps wpa2
  14. endif
  15. LINKER_SCRIPTS += esp32.common.ld esp32.rom.ld esp32.peripherals.ld
  16. ifeq ("$(CONFIG_NEWLIB_NANO_FORMAT)","y")
  17. LINKER_SCRIPTS += esp32.rom.nanofmt.ld
  18. endif
  19. ifndef CONFIG_SPI_FLASH_ROM_DRIVER_PATCH
  20. LINKER_SCRIPTS += esp32.rom.spiflash.ld
  21. endif
  22. COMPONENT_ADD_LDFLAGS := -lesp32 \
  23. $(COMPONENT_PATH)/libhal.a \
  24. -L$(COMPONENT_PATH)/lib \
  25. $(addprefix -l,$(LIBS)) \
  26. -L $(COMPONENT_PATH)/ld \
  27. -T esp32_out.ld \
  28. $(addprefix -T ,$(LINKER_SCRIPTS))
  29. ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS))
  30. COMPONENT_SUBMODULES += lib
  31. # final linking of project ELF depends on all binary libraries, and
  32. # all linker scripts (except esp32_out.ld, as this is code generated here.)
  33. COMPONENT_ADD_LINKER_DEPS := $(ALL_LIB_FILES) $(addprefix ld/,$(LINKER_SCRIPTS))
  34. # Preprocess esp32.ld linker script into esp32_out.ld
  35. #
  36. # The library doesn't really depend on esp32_out.ld, but it
  37. # saves us from having to add the target to a Makefile.projbuild
  38. $(COMPONENT_LIBRARY): esp32_out.ld
  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