You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/11/29 01:22:35 UTC
[GitHub] [nuttx] zouboan commented on a diff in pull request #7572: tools: Fix various error in Windows native build
zouboan commented on code in PR #7572:
URL: https://github.com/apache/nuttx/pull/7572#discussion_r1034208088
##########
libs/libc/Makefile:
##########
@@ -114,8 +114,8 @@ endif
BINDIR ?= bin
-AOBJS = $(patsubst %.S, $(BINDIR)$(DELIM)%$(OBJEXT), $(ASRCS))
-COBJS = $(patsubst %.c, $(BINDIR)$(DELIM)%$(OBJEXT), $(CSRCS))
+AOBJS = $(patsubst %.S, $(BINDIR)$(DELIM)$(DELIM)%$(OBJEXT), $(ASRCS))
Review Comment:
In Windows environment` DELIM := \ `but`\`has two role in Windows environment:
first: `\` as directory separator, and second `\` as Escape character
in Windows environment:
`COBJS = $(patsubst %.c, $(BINDIR)$(DELIM)%$(OBJEXT), $(CSRCS))`
equivalent to
`COBJS = $(patsubst %.c, $(BINDIR)\%$(OBJEXT), $(CSRCS))`
and the `\` of `\%` was identified to be Escape character, which result the `% `was identified to be ordinary characters and not used for pattern. and then result the error: `makefile:132: *** target mode do not include“%”. stop.`
As described in: [https://www.gnu.org/software/make/manual/html_node/Text-Functions.html](url)
we can use double $(DELIM) to solve problem
`COBJS = $(patsubst %.c, $(BINDIR)$(DELIM)$(DELIM)%$(OBJEXT), $(CSRCS))`
equivalent to
`COBJS = $(patsubst %.c, $(BINDIR)\\%$(OBJEXT), $(CSRCS))`
the first `\` of `\\%` Escape the second `\` as ordinary characters, so that `%` used as pattern, there's no extra problem use `\\%` in Linux as tested.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org