]> granicus.if.org Git - esp-idf/commitdiff
ldgen: fix issue when not built in msys2
authorRenz Christian Bagaporo <renz@espressif.com>
Thu, 13 Dec 2018 10:19:59 +0000 (18:19 +0800)
committerRenz Christian Bagaporo <renz@espressif.com>
Thu, 13 Dec 2018 12:44:29 +0000 (20:44 +0800)
Closes https://github.com/espressif/esp-idf/issues/2812

make/ldgen.mk

index 2cbb6f43f80ab319c7de6ec261c6be5e2578be54..12d7d2d97ca54b1473db6f202a9aa7eb3c733c32 100644 (file)
@@ -7,17 +7,26 @@ LDGEN_FRAGMENT_FILES = $(COMPONENT_LDFRAGMENTS)
 # the components
 define ldgen_process_template
 $(BUILD_DIR_BASE)/ldgen.section_infos: $(LDGEN_SECTIONS_INFO_FILES) $(IDF_PATH)/make/ldgen.mk
-       printf "$(foreach section_info,$(LDGEN_SECTIONS_INFO_FILES),$(section_info)\n)" > $(BUILD_DIR_BASE)/ldgen.section_infos
-       sed -E -i.bak 's|^[[:blank:]]*||g' $(BUILD_DIR_BASE)/ldgen.section_infos
-       rm $(BUILD_DIR_BASE)/ldgen.section_infos.bak
 ifeq ($(OS), Windows_NT)
-       mv $(BUILD_DIR_BASE)/ldgen.section_infos $(BUILD_DIR_BASE)/ldgen.section_infos.temp
-       cygpath -w -f $(BUILD_DIR_BASE)/ldgen.section_infos.temp > $(BUILD_DIR_BASE)/ldgen.section_infos
-       rm -f $(BUILD_DIR_BASE)/ldgen.section_infos.temp
+       printf "$(foreach info,$(LDGEN_SECTIONS_INFO_FILES),$(subst \,/,$(shell cygpath -w $(info)))\n)" > $(BUILD_DIR_BASE)/ldgen.section_infos
+else
+       printf "$(foreach info,$(LDGEN_SECTIONS_INFO_FILES),$(info)\n)" > $(BUILD_DIR_BASE)/ldgen.section_infos
 endif
 
 $(2): $(1) $(LDGEN_FRAGMENT_FILES) $(SDKCONFIG) $(BUILD_DIR_BASE)/ldgen.section_infos
        @echo 'Generating $(notdir $(2))'
+ifeq ($(OS), Windows_NT)
+       $(PYTHON) $(IDF_PATH)/tools/ldgen/ldgen.py \
+               --input         $(1) \
+               --config        $(SDKCONFIG) \
+               --fragments     $(LDGEN_FRAGMENT_FILES) \
+               --output        $(2) \
+               --sections      $(BUILD_DIR_BASE)/ldgen.section_infos \
+               --kconfig       $(IDF_PATH)/Kconfig \
+               --env           "COMPONENT_KCONFIGS=$(foreach k, $(COMPONENT_KCONFIGS), $(shell cygpath -w $(k)))" \
+               --env           "COMPONENT_KCONFIGS_PROJBUILD=$(foreach k, $(COMPONENT_KCONFIGS_PROJBUILD), $(shell cygpath -w $(k)))" \
+               --env           "IDF_CMAKE=n"
+else
        $(PYTHON) $(IDF_PATH)/tools/ldgen/ldgen.py \
                --input         $(1) \
                --config        $(SDKCONFIG) \
@@ -28,6 +37,7 @@ $(2): $(1) $(LDGEN_FRAGMENT_FILES) $(SDKCONFIG) $(BUILD_DIR_BASE)/ldgen.section_
                --env           "COMPONENT_KCONFIGS=$(COMPONENT_KCONFIGS)" \
                --env           "COMPONENT_KCONFIGS_PROJBUILD=$(COMPONENT_KCONFIGS_PROJBUILD)" \
                --env           "IDF_CMAKE=n"
+endif
 endef
 
 define ldgen_create_commands