2018-04-18 02:57:45 +00:00
|
|
|
# Makefile to support the linker script generation mechanism
|
|
|
|
LDGEN_FRAGMENT_FILES = $(COMPONENT_LDFRAGMENTS)
|
2019-04-26 05:42:10 +00:00
|
|
|
LDGEN_LIBRARIES=$(foreach libcomp,$(COMPONENT_LIBRARIES),$(BUILD_DIR_BASE)/$(libcomp)/lib$(libcomp).a)
|
2018-04-18 02:57:45 +00:00
|
|
|
|
|
|
|
# Target to generate linker script generator from fragments presented by each of
|
|
|
|
# the components
|
2019-05-06 12:28:32 +00:00
|
|
|
ifeq ($(OS),Windows_NT)
|
2018-04-18 02:57:45 +00:00
|
|
|
define ldgen_process_template
|
2019-04-30 03:54:01 +00:00
|
|
|
$(BUILD_DIR_BASE)/ldgen_libraries: $(LDGEN_LIBRARIES) $(IDF_PATH)/make/ldgen.mk
|
2019-09-17 03:47:05 +00:00
|
|
|
printf "$(foreach info,$(LDGEN_LIBRARIES),$(subst \,/,$(shell cygpath -m $(info)))\n)" > $(BUILD_DIR_BASE)/ldgen_libraries
|
2018-12-01 14:22:45 +00:00
|
|
|
|
2019-10-21 11:44:19 +00:00
|
|
|
$(2): $(1) $(LDGEN_FRAGMENT_FILES) $(SDKCONFIG) $(BUILD_DIR_BASE)/ldgen_libraries | prepare_kconfig_files
|
2018-04-18 02:57:45 +00:00
|
|
|
@echo 'Generating $(notdir $(2))'
|
2018-12-13 10:19:59 +00:00
|
|
|
$(PYTHON) $(IDF_PATH)/tools/ldgen/ldgen.py \
|
|
|
|
--input $(1) \
|
|
|
|
--config $(SDKCONFIG) \
|
|
|
|
--fragments $(LDGEN_FRAGMENT_FILES) \
|
2019-04-26 05:42:10 +00:00
|
|
|
--libraries-file $(BUILD_DIR_BASE)/ldgen_libraries \
|
2018-12-13 10:19:59 +00:00
|
|
|
--output $(2) \
|
|
|
|
--kconfig $(IDF_PATH)/Kconfig \
|
2019-09-17 03:47:05 +00:00
|
|
|
--env "COMPONENT_KCONFIGS=$(foreach k, $(COMPONENT_KCONFIGS), $(shell cygpath -m $(k)))" \
|
|
|
|
--env "COMPONENT_KCONFIGS_PROJBUILD=$(foreach k, $(COMPONENT_KCONFIGS_PROJBUILD), $(shell cygpath -m $(k)))" \
|
2019-09-10 07:58:52 +00:00
|
|
|
--env "COMPONENT_KCONFIGS_SOURCE_FILE=$(shell cygpath -m $(COMPONENT_KCONFIGS_SOURCE_FILE))" \
|
|
|
|
--env "COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE=$(shell cygpath -m $(COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE))" \
|
2019-04-26 05:42:10 +00:00
|
|
|
--env "IDF_CMAKE=n" \
|
|
|
|
--objdump $(OBJDUMP)
|
2018-12-17 04:58:29 +00:00
|
|
|
endef
|
2019-05-06 12:28:32 +00:00
|
|
|
else # Windows_NT
|
2018-12-17 04:58:29 +00:00
|
|
|
define ldgen_process_template
|
2019-04-26 05:42:10 +00:00
|
|
|
$(BUILD_DIR_BASE)/ldgen_libraries: $(LDGEN_LIBRARIES) $(IDF_PATH)/make/ldgen.mk
|
|
|
|
printf "$(foreach library,$(LDGEN_LIBRARIES),$(library)\n)" > $(BUILD_DIR_BASE)/ldgen_libraries
|
2018-12-17 04:58:29 +00:00
|
|
|
|
2019-10-21 11:44:19 +00:00
|
|
|
$(2): $(1) $(LDGEN_FRAGMENT_FILES) $(SDKCONFIG) $(BUILD_DIR_BASE)/ldgen_libraries | prepare_kconfig_files
|
2018-12-17 04:58:29 +00:00
|
|
|
@echo 'Generating $(notdir $(2))'
|
2018-04-18 02:57:45 +00:00
|
|
|
$(PYTHON) $(IDF_PATH)/tools/ldgen/ldgen.py \
|
|
|
|
--input $(1) \
|
|
|
|
--config $(SDKCONFIG) \
|
|
|
|
--fragments $(LDGEN_FRAGMENT_FILES) \
|
2019-04-26 05:42:10 +00:00
|
|
|
--libraries-file $(BUILD_DIR_BASE)/ldgen_libraries \
|
2018-04-18 02:57:45 +00:00
|
|
|
--output $(2) \
|
|
|
|
--kconfig $(IDF_PATH)/Kconfig \
|
|
|
|
--env "COMPONENT_KCONFIGS=$(COMPONENT_KCONFIGS)" \
|
|
|
|
--env "COMPONENT_KCONFIGS_PROJBUILD=$(COMPONENT_KCONFIGS_PROJBUILD)" \
|
2019-09-10 07:58:52 +00:00
|
|
|
--env "COMPONENT_KCONFIGS_SOURCE_FILE=$(COMPONENT_KCONFIGS_SOURCE_FILE)" \
|
|
|
|
--env "COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE=$(COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE)" \
|
2019-04-26 05:42:10 +00:00
|
|
|
--env "IDF_CMAKE=n" \
|
|
|
|
--objdump $(OBJDUMP)
|
2018-04-18 02:57:45 +00:00
|
|
|
endef
|
2019-05-06 12:28:32 +00:00
|
|
|
endif # Windows_NT
|
2018-04-18 02:57:45 +00:00
|
|
|
|
|
|
|
define ldgen_create_commands
|
|
|
|
ldgen-clean:
|
2019-04-26 05:42:10 +00:00
|
|
|
rm -f $(BUILD_DIR_BASE)/ldgen_libraries
|
2019-09-17 03:47:05 +00:00
|
|
|
endef
|