diff --git a/arch/arm/src/Makefile b/arch/arm/src/Makefile index 25694d8051..50c9232867 100644 --- a/arch/arm/src/Makefile +++ b/arch/arm/src/Makefile @@ -109,7 +109,8 @@ else endif -LDFLAGS += $(addprefix $(SCRIPT_OPT),$(call CONVERT_PATH,$(ARCHSCRIPT))) $(EXTRALINKCMDS) +ARCHSCRIPT := $(call CONVERT_PATH,$(ARCHSCRIPT)) +LDFLAGS += $(addprefix $(SCRIPT_OPT),$(ARCHSCRIPT).tmp) $(EXTRALINKCMDS) LIBPATHS += $(LIBPATH_OPT) $(call CONVERT_PATH,$(TOPDIR)$(DELIM)staging) BOARDMAKE = $(if $(wildcard board$(DELIM)Makefile),y,) @@ -165,7 +166,10 @@ define LINK_ALLSYMS $(Q) $(call DELFILE, allsyms.tmp allsyms$(OBJEXT)) endef -nuttx$(EXEEXT): $(HEAD_OBJ) board$(DELIM)libboard$(LIBEXT) $(ARCHSCRIPT) +$(addsuffix .tmp,$(ARCHSCRIPT)): $(ARCHSCRIPT) + $(call PREPROCESS, $(patsubst %.tmp,%,$@), $@) + +nuttx$(EXEEXT): $(HEAD_OBJ) board$(DELIM)libboard$(LIBEXT) $(addsuffix .tmp,$(ARCHSCRIPT)) $(Q) echo "LD: nuttx" ifneq ($(CONFIG_ALLSYMS),y) $(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) $(EXTRA_LIBPATHS) \ @@ -184,6 +188,7 @@ ifneq ($(CONFIG_WINDOWS_NATIVE),y) grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \ sort > $(TOPDIR)$(DELIM)System.map endif + $(Q) $(call DELFILE, $(addsuffix .tmp,$(ARCHSCRIPT))) # This is part of the top-level export target # Note that there may not be a head object if layout is handled @@ -220,6 +225,7 @@ clean: ifeq ($(BOARDMAKE),y) $(Q) $(MAKE) -C board clean endif + $(call DELFILE, $(addsuffix .tmp,$(ARCHSCRIPT))) $(call DELFILE, $(KBIN)) $(call DELFILE, $(BIN)) ifneq ($(EXTRADELFILE),) diff --git a/arch/risc-v/src/Makefile b/arch/risc-v/src/Makefile index 457052203b..59729ef26b 100644 --- a/arch/risc-v/src/Makefile +++ b/arch/risc-v/src/Makefile @@ -79,7 +79,8 @@ UOBJS = $(UAOBJS) $(UCOBJS) KBIN = libkarch$(LIBEXT) BIN = libarch$(LIBEXT) -LDFLAGS += $(addprefix -T,$(call CONVERT_PATH,$(ARCHSCRIPT))) $(EXTRALINKCMDS) +ARCHSCRIPT := $(call CONVERT_PATH,$(ARCHSCRIPT)) +LDFLAGS += $(addprefix -T,$(ARCHSCRIPT).tmp) $(EXTRALINKCMDS) ifeq ($(LD),$(CC)) LDSTARTGROUP ?= -Wl,--start-group @@ -145,7 +146,10 @@ define LINK_ALLSYMS $(Q) $(call DELFILE, allsyms.tmp allsyms$(OBJEXT)) endef -nuttx$(EXEEXT): $(HEAD_OBJ) board/libboard$(LIBEXT) $(ARCHSCRIPT) +$(addsuffix .tmp,$(ARCHSCRIPT)): $(ARCHSCRIPT) + $(call PREPROCESS, $(patsubst %.tmp,%,$@), $@) + +nuttx$(EXEEXT): $(HEAD_OBJ) board/libboard$(LIBEXT) $(addsuffix .tmp,$(ARCHSCRIPT)) $(Q) echo "LD: nuttx" ifneq ($(CONFIG_ALLSYMS),y) $(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) $(EXTRA_LIBPATHS) \ @@ -164,6 +168,7 @@ ifneq ($(CONFIG_WINDOWS_NATIVE),y) grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \ sort > $(TOPDIR)/System.map endif + $(Q) $(call DELFILE, $(addsuffix .tmp,$(ARCHSCRIPT))) # This is part of the top-level export target # Note that there may not be a head object if layout is handled @@ -200,6 +205,7 @@ clean: ifeq ($(BOARDMAKE),y) $(Q) $(MAKE) -C board clean endif + $(call DELFILE, $(addsuffix .tmp,$(ARCHSCRIPT))) $(call DELFILE, $(KBIN)) $(call DELFILE, $(BIN)) $(call DELFILE, $(HEAD_OBJ)) diff --git a/arch/xtensa/src/Makefile b/arch/xtensa/src/Makefile index b622c04662..2bcef5e032 100644 --- a/arch/xtensa/src/Makefile +++ b/arch/xtensa/src/Makefile @@ -80,7 +80,8 @@ BIN = libarch$(LIBEXT) # Override in Make.defs if linker is not 'ld' -LDFLAGS += $(addprefix -T,$(call CONVERT_PATH,$(ARCHSCRIPT))) $(EXTRALINKCMDS) +ARCHSCRIPT := $(call CONVERT_PATH,$(ARCHSCRIPT)) +LDFLAGS += $(addprefix -T,$(ARCHSCRIPT).tmp) $(EXTRALINKCMDS) ifeq ($(LD),$(CC)) LDSTARTGROUP ?= -Wl,--start-group @@ -142,7 +143,10 @@ define LINK_ALLSYMS $(Q) $(call DELFILE, allsyms.tmp allsyms$(OBJEXT)) endef -nuttx$(EXEEXT): $(STARTUP_OBJS) board/libboard$(LIBEXT) $(ARCHSCRIPT) +$(addsuffix .tmp,$(ARCHSCRIPT)): $(ARCHSCRIPT) + $(call PREPROCESS, $(patsubst %.tmp,%,$@), $@) + +nuttx$(EXEEXT): $(STARTUP_OBJS) board/libboard$(LIBEXT) $(addsuffix .tmp,$(ARCHSCRIPT)) $(Q) echo "LD: nuttx" ifneq ($(CONFIG_ALLSYMS),y) $(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) $(EXTRA_LIBPATHS) \ @@ -161,6 +165,7 @@ ifneq ($(CONFIG_WINDOWS_NATIVE),y) grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \ sort > $(TOPDIR)/System.map endif + $(Q) $(call DELFILE, $(addsuffix .tmp,$(ARCHSCRIPT))) # This is part of the top-level export target @@ -193,6 +198,7 @@ clean: ifeq ($(BOARDMAKE),y) $(Q) $(MAKE) -C board clean endif + $(call DELFILE, $(addsuffix .tmp,$(ARCHSCRIPT))) $(call DELFILE, $(KBIN)) $(call DELFILE, $(BIN)) $(call CLEAN)