1# Makefile to support the linker script generation mechanism 2LDGEN_FRAGMENT_FILES = $(COMPONENT_LDFRAGMENTS) 3LDGEN_LIBRARIES=$(foreach libcomp,$(COMPONENT_LIBRARIES),$(BUILD_DIR_BASE)/$(libcomp)/lib$(libcomp).a) 4 5# Target to generate linker script generator from fragments presented by each of 6# the components 7ifeq ($(OS),Windows_NT) 8define ldgen_process_template 9$(BUILD_DIR_BASE)/ldgen_libraries: $(LDGEN_LIBRARIES) $(IDF_PATH)/make/ldgen.mk 10 printf "$(foreach info,$(LDGEN_LIBRARIES),$(subst \,/,$(shell cygpath -m $(info)))\n)" > $(BUILD_DIR_BASE)/ldgen_libraries 11 12$(2): $(1) $(LDGEN_FRAGMENT_FILES) $(SDKCONFIG) $(BUILD_DIR_BASE)/ldgen_libraries | prepare_kconfig_files 13 @echo 'Generating $(notdir $(2))' 14 $(PYTHON) $(IDF_PATH)/tools/ldgen/ldgen.py \ 15 --input $(1) \ 16 --config $(SDKCONFIG) \ 17 --fragments $(LDGEN_FRAGMENT_FILES) \ 18 --libraries-file $(BUILD_DIR_BASE)/ldgen_libraries \ 19 --output $(2) \ 20 --kconfig $(IDF_PATH)/Kconfig \ 21 --env "COMPONENT_KCONFIGS=$(foreach k, $(COMPONENT_KCONFIGS), $(shell cygpath -m $(k)))" \ 22 --env "COMPONENT_KCONFIGS_PROJBUILD=$(foreach k, $(COMPONENT_KCONFIGS_PROJBUILD), $(shell cygpath -m $(k)))" \ 23 --env "COMPONENT_KCONFIGS_SOURCE_FILE=$(shell cygpath -m $(COMPONENT_KCONFIGS_SOURCE_FILE))" \ 24 --env "COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE=$(shell cygpath -m $(COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE))" \ 25 --env "IDF_CMAKE=n" \ 26 --objdump $(OBJDUMP) 27endef 28else # Windows_NT 29define ldgen_process_template 30$(BUILD_DIR_BASE)/ldgen_libraries: $(LDGEN_LIBRARIES) $(IDF_PATH)/make/ldgen.mk 31 printf "$(foreach library,$(LDGEN_LIBRARIES),$(library)\n)" > $(BUILD_DIR_BASE)/ldgen_libraries 32 33$(2): $(1) $(LDGEN_FRAGMENT_FILES) $(SDKCONFIG) $(BUILD_DIR_BASE)/ldgen_libraries | prepare_kconfig_files 34 @echo 'Generating $(notdir $(2))' 35 $(PYTHON) $(IDF_PATH)/tools/ldgen/ldgen.py \ 36 --input $(1) \ 37 --config $(SDKCONFIG) \ 38 --fragments $(LDGEN_FRAGMENT_FILES) \ 39 --libraries-file $(BUILD_DIR_BASE)/ldgen_libraries \ 40 --output $(2) \ 41 --kconfig $(IDF_PATH)/Kconfig \ 42 --env "COMPONENT_KCONFIGS=$(COMPONENT_KCONFIGS)" \ 43 --env "COMPONENT_KCONFIGS_PROJBUILD=$(COMPONENT_KCONFIGS_PROJBUILD)" \ 44 --env "COMPONENT_KCONFIGS_SOURCE_FILE=$(COMPONENT_KCONFIGS_SOURCE_FILE)" \ 45 --env "COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE=$(COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE)" \ 46 --env "IDF_CMAKE=n" \ 47 --env "IDF_ENV_FPGA=n" \ 48 --objdump $(OBJDUMP) 49endef 50endif # Windows_NT 51 52define ldgen_create_commands 53ldgen-clean: 54 rm -f $(BUILD_DIR_BASE)/ldgen_libraries 55endef 56