From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeroen Hofstee Date: Wed, 29 Jun 2011 20:48:02 +0000 Subject: [U-Boot] GNU specific sed argument in rules.mk Message-ID: <4E0B8F82.4000600@myspectrum.nl> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Wolfgang / All, rules.mk uses the GNU specific sed \w leading to not directly obvious Make / _depend errors in the build process, like circular dependencies warnings / crc32.c not found (some example and (incorrect) fixes), e.g.: http://lists.denx.de/pipermail/u-boot/2009-May/051931.html http://lists.denx.de/pipermail/u-boot/2009-June/054662.html http://lists.denx.de/pipermail/u-boot/2009-November/064655.html http://lists.denx.de/pipermail/u-boot/2011-March/088884.html Some test: Current command (gsed = GNU sed, sed = FreeBSD takes \w as w). The first command is not the intention. [jeroen at blue ~]$ echo some/example/test.c | sed -e 's/\(.*\)\.\w/\1.o/'; some/example/test.c [jeroen at blue ~]$ echo some/example/test.c | gsed -e 's/\(.*\)\.\w/\1.o/'; some/example/test.o [jeroen at blue ~]$ echo some/example/test.w | sed -e 's/\(.*\)\.\w/\1.o/'; some/example/test.o [jeroen at blue ~]$ echo some/example/test.w | gsed -e 's/\(.*\)\.\w/\1.o/'; some/example/test.o None GNU specific as per GNU docs (fine): [jeroen at blue ~]$ echo some/example/test.c | sed -e 's/\(.*\)\.[[:alnum:]_]/\1.o/'; some/example/test.o [jeroen at blue ~]$ echo some/example/test.c | gsed -e 's/\(.*\)\.[[:alnum:]_]/\1.o/'; some/example/test.o or shorter (regex are greedy): [jeroen at blue ~]$ echo some/example/test.c | sed -e 's/\(.*\)\..*/\1.o/'; some/example/test.o [jeroen at blue ~]$ echo some/example/test.c | gsed -e 's/\(.*\)\..*/\1.o/'; some/example/test.o Would you accept a patch for this? Regards, Jeroen ---------------------------------------------------- patch would look something like this, GNU man suggested or ... diff --git a/rules.mk b/rules.mk index c2860e5..385e5f5 100644 --- a/rules.mk +++ b/rules.mk @@ -29,11 +29,11 @@ $(obj).depend: $(src)Makefile $(TOPDIR)/config.mk $(SRCS) $(HOSTSRCS) @rm -f $@ @touch $@ @for f in $(SRCS); do \ - g=`basename $$f | sed -e 's/\(.*\)\.\w/\1.o/'`; \ + g=`basename $$f | sed -e 's/\(.*\)\..*/\1.o/'`; \ $(CC) -M $(CPPFLAGS) -MQ $(obj)$$g $$f>> $@ ; \ done @for f in $(HOSTSRCS); do \ - g=`basename $$f | sed -e 's/\(.*\)\.\w/\1.o/'`; \ + g=`basename $$f | sed -e 's/\(.*\)\..*/\1.o/'`; \ $(HOSTCC) -M $(HOSTCPPFLAGS) -MQ $(obj)$$g $$f>> $@ ; \ done GNU extension to regex are documented here: See http://www.gnu.org/software/gawk/manual/html_node/GNU-Regexp-Operators.html