This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 3b1154fc6169194f0d60048128b20efc2b6792a7
Author: Saravanan Sekar <[email protected]>
AuthorDate: Thu Oct 29 18:54:59 2026 +0530

    libs/libc: Use the assembly file extension of the toolchain.
    
    The libc Makefile hardcodes .S for its assembly sources.  The TriCore
    TASKING sources are .asm, so they passed the .S substitutions unchanged:
    the dependency step concatenated the source itself into bin/Make.dep,
    which make then rejects with "missing rule before recipe", no object
    rule matched and the clean step deleted the .asm source.  Use $(ASMEXT),
    which is .S unless a toolchain overrides it.
    
    The TASKING .asm sources are not preprocessed and include nothing, give
    them a dependency rule that only names the source.
    The CMake build already lists the sources with its own ASMEXT.
    [skip-cmake-parity]
    
    Signed-off-by: Saravanan Sekar <[email protected]>
---
 arch/tricore/src/common/ToolchainTasking.defs |  6 ++++++
 libs/libc/Makefile                            | 10 +++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/arch/tricore/src/common/ToolchainTasking.defs 
b/arch/tricore/src/common/ToolchainTasking.defs
index 0fbbd85a115..348ff05aa20 100644
--- a/arch/tricore/src/common/ToolchainTasking.defs
+++ b/arch/tricore/src/common/ToolchainTasking.defs
@@ -64,6 +64,12 @@ OBJCOPY           = echo
 OBJDUMP           = elfdump
 ASMEXT            = .asm
 
+# The .asm sources are not run through the C preprocessor and include no
+# headers, so they only depend on themselves.
+
+%.dds: %.asm
+       $(Q) echo "$(OBJPATH)$(DELIM)$*$(OBJEXT): $<" > $@
+
 ARCHOPTIMIZATION += --lsl-core=vtc
 LDFLAGS          += --lsl-core=vtc
 ARCHOPTIMIZATION += --iso=99
diff --git a/libs/libc/Makefile b/libs/libc/Makefile
index 9cedb332839..717d6a7d5c7 100644
--- a/libs/libc/Makefile
+++ b/libs/libc/Makefile
@@ -138,7 +138,7 @@ endif
 
 BINDIR ?= bin
 
-AOBJS = $(patsubst %.S, $(BINDIR)$(DELIMS)%$(OBJEXT), $(ASRCS))
+AOBJS = $(patsubst %$(ASMEXT), $(BINDIR)$(DELIMS)%$(OBJEXT), $(ASRCS))
 COBJS = $(patsubst %.c, $(BINDIR)$(DELIMS)%$(OBJEXT), $(CSRCS))
 
 SRCS = $(ASRCS) $(CSRCS)
@@ -150,7 +150,7 @@ BIN ?= libc$(LIBEXT)
 all: $(BIN)
 .PHONY: clean distclean
 
-$(AOBJS): $(BINDIR)$(DELIMS)%$(OBJEXT): %.S
+$(AOBJS): $(BINDIR)$(DELIMS)%$(OBJEXT): %$(ASMEXT)
        $(call ASSEMBLE, $<, $@)
 
 # REVISIT: Backslash causes problems in $(COBJS) target
@@ -193,11 +193,11 @@ endif
 
 # Dependencies
 
-makedepfile: $(CSRCS:.c=.ddc) $(ASRCS:.S=.dds)
+makedepfile: $(CSRCS:.c=.ddc) $(ASRCS:$(ASMEXT)=.dds)
        $(call CATFILE, bin/Make.dep, $^)
        $(call DELFILE, $^)
 
-makekdepfile: $(CSRCS:.c=.ddc) $(ASRCS:.S=.dds)
+makekdepfile: $(CSRCS:.c=.ddc) $(ASRCS:$(ASMEXT)=.dds)
        $(call CATFILE, kbin/Make.dep, $^)
        $(call DELFILE, $^)
 
@@ -228,7 +228,7 @@ distclean:: clean
        $(Q) $(MAKE) -C zoneinfo distclean BIN=$(BIN)
        $(Q) $(MAKE) -C elf distclean
        $(call DELFILE, exec_symtab.c)
-       $(call DELFILE, $(CSRCS:.c=.ddc) $(ASRCS:.S=.dds))
+       $(call DELFILE, $(CSRCS:.c=.ddc) $(ASRCS:$(ASMEXT)=.dds))
        $(call DELFILE, .depend)
        $(call DELDIR, bin)
        $(call DELDIR, kbin)

Reply via email to