[U-Boot] GNU Make shell application

Hello, I noticed on my Ubuntu 7.04 system that when I did a 'make clobber' the tools directory was still littered with symlinks that should have been removed. It looks like commands such as the following in the Makefiles fail: @rm -f $(obj)tools/{crc32.c,env_embedded.c,env/crc32.c,md5.c,sha1.c,inca-swap-bytes} @rm -f(obj)tools/{image.c,fdt.c,fdt_ro.c,fdt_rw.c,fdt_strerror.c,zlib.h} @rm -f $(obj)tools/{fdt_wip.c,libfdt_internal.h}
On Ubuntu 7.04 /bin/sh is a symlink to /bin/dash ordinarily. By default Make uses /bin/sh as its shell. Dash doesn't support the {abc,xyz} convention so all the symlinks in the above Make commands fail silently.
As a fix, would people prefer that bash be used by Make by default? Adding something like this (stolen from Linux) to the top-level Makefile should work: # Set shell to bash if possible, otherwise fall back to sh SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ else if [ -x /bin/bash ]; then echo /bin/bash; \ else echo sh; fi; fi)
Or would they prefer the Make commands are updated not to use the {abc,xyz} convention?
Thanks, Peter

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagnioj@jcrosoft.com --- please try this on ubuntu
Best Regards, J. Makefile | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile index 884b634..212451f 100644 --- a/Makefile +++ b/Makefile @@ -3280,9 +3280,8 @@ clobber: clean @rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS \ $(obj)cscope.* $(obj)*.*~ @rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL) - @rm -f $(obj)tools/{crc32.c,env_embedded.c,env/crc32.c,md5.c,sha1.c,inca-swap-bytes} - @rm -f $(obj)tools/{image.c,fdt.c,fdt_ro.c,fdt_rw.c,fdt_strerror.c,zlib.h} - @rm -f $(obj)tools/{fdt_wip.c,libfdt_internal.h} + @find $(obj)tools -name "*" -type l -print | xargs rm -f + @rm -f $(obj)tools/inca-swap-bytes @rm -f $(obj)cpu/mpc824x/bedbug_603e.c @rm -f $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm @[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name "*" -type l -print | xargs rm -f

On Wed, Nov 12, 2008 at 1:06 PM, Jean-Christophe PLAGNIOL-VILLARD wrote:
@rm -f $(obj)tools/{crc32.c,env_embedded.c,env/crc32.c,md5.c,sha1.c,inca-swap-bytes}
@rm -f $(obj)tools/{image.c,fdt.c,fdt_ro.c,fdt_rw.c,fdt_strerror.c,zlib.h}
@rm -f $(obj)tools/{fdt_wip.c,libfdt_internal.h}
@find $(obj)tools -name "*" -type l -print | xargs rm -f
@rm -f $(obj)tools/inca-swap-bytes
your changelog makes no sense. the problem is that brace expansion is not in POSIX and so it'll fail on systems that do not use bash by default (like Ubuntu). please put a real explanation into your changelog.
you should use `find ... -print0 | xargs -0 ...` or `find ... -exec ... {} +`. using `find ... -print | xargs ...` is broken. -mike

Jean-Christophe PLAGNIOL-VILLARD wrote:
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagnioj@jcrosoft.com
please try this on ubuntu
Best Regards, J. Makefile | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile index 884b634..212451f 100644 --- a/Makefile +++ b/Makefile @@ -3280,9 +3280,8 @@ clobber: clean @rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS \ $(obj)cscope.* $(obj)*.*~ @rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL)
- @rm -f $(obj)tools/{crc32.c,env_embedded.c,env/crc32.c,md5.c,sha1.c,inca-swap-bytes}
- @rm -f $(obj)tools/{image.c,fdt.c,fdt_ro.c,fdt_rw.c,fdt_strerror.c,zlib.h}
- @rm -f $(obj)tools/{fdt_wip.c,libfdt_internal.h}
- @find $(obj)tools -name "*" -type l -print | xargs rm -f
- @rm -f $(obj)tools/inca-swap-bytes @rm -f $(obj)cpu/mpc824x/bedbug_603e.c @rm -f $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm @[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name "*" -type l -print | xargs rm -f
Oooo, you have a risk of removing symlinks that you didn't mean to. Works today, what about tomorrow?
This was discussed previously, but not pushed to fruition: http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/48047/focus=48048
My vote is (a) use bash specifically and keep the bashisms.
Best regards, gvb

On Wed, Nov 12, 2008 at 1:16 PM, Jerry Van Baren wrote:
Jean-Christophe PLAGNIOL-VILLARD wrote:
@rm -f $(obj)tools/{crc32.c,env_embedded.c,env/crc32.c,md5.c,sha1.c,inca-swap-bytes}
@rm -f $(obj)tools/{image.c,fdt.c,fdt_ro.c,fdt_rw.c,fdt_strerror.c,zlib.h}
@rm -f $(obj)tools/{fdt_wip.c,libfdt_internal.h}
@find $(obj)tools -name "*" -type l -print | xargs rm -f
@rm -f $(obj)tools/inca-swap-bytes
My vote is (a) use bash specifically and keep the bashisms.
indeed. brace expansion is prob one of my favorite features of bash ;). -mike

On Wed, 2008-11-12 at 13:16 -0500, Jerry Van Baren wrote:
Jean-Christophe PLAGNIOL-VILLARD wrote:
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagnioj@jcrosoft.com
please try this on ubuntu
Best Regards, J. Makefile | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile index 884b634..212451f 100644 --- a/Makefile +++ b/Makefile @@ -3280,9 +3280,8 @@ clobber: clean @rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS \ $(obj)cscope.* $(obj)*.*~ @rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL)
- @rm -f $(obj)tools/{crc32.c,env_embedded.c,env/crc32.c,md5.c,sha1.c,inca-swap-bytes}
- @rm -f $(obj)tools/{image.c,fdt.c,fdt_ro.c,fdt_rw.c,fdt_strerror.c,zlib.h}
- @rm -f $(obj)tools/{fdt_wip.c,libfdt_internal.h}
- @find $(obj)tools -name "*" -type l -print | xargs rm -f
- @rm -f $(obj)tools/inca-swap-bytes @rm -f $(obj)cpu/mpc824x/bedbug_603e.c @rm -f $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm @[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name "*" -type l -print | xargs rm -f
Oooo, you have a risk of removing symlinks that you didn't mean to. Works today, what about tomorrow?
This was discussed previously, but not pushed to fruition: http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/48047/focus=48048
My vote is (a) use bash specifically and keep the bashisms.
Thanks for the link Jerry, I should have googled before looking into the issue:) Based on your comments and the previous discussion I'll send a patch for option (a) shortly.
Best, Peter

On Wed, 2008-11-12 at 19:06 +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagnioj@jcrosoft.com
please try this on ubuntu
Best Regards, J. Makefile | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile index 884b634..212451f 100644 --- a/Makefile +++ b/Makefile @@ -3280,9 +3280,8 @@ clobber: clean @rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS \ $(obj)cscope.* $(obj)*.*~ @rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL)
- @rm -f $(obj)tools/{crc32.c,env_embedded.c,env/crc32.c,md5.c,sha1.c,inca-swap-bytes}
- @rm -f $(obj)tools/{image.c,fdt.c,fdt_ro.c,fdt_rw.c,fdt_strerror.c,zlib.h}
- @rm -f $(obj)tools/{fdt_wip.c,libfdt_internal.h}
- @find $(obj)tools -name "*" -type l -print | xargs rm -f
- @rm -f $(obj)tools/inca-swap-bytes @rm -f $(obj)cpu/mpc824x/bedbug_603e.c @rm -f $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm @[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name "*" -type l -print | xargs rm -f
That should work, I had tried the same thing with 'find ./ -lname "*"'. I hesitated to use that in case someone had a symlink in their tools directory that they didn't want cleaned up by make clobber. I'm not sure why someone would have those symlinks hanging around, but who am I to judge what other people do:)
Thanks, Peter

Dear Jean-Christophe PLAGNIOL-VILLARD,
In message 1226513192-14724-1-git-send-email-plagnioj@jcrosoft.com you wrote:
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagnioj@jcrosoft.com
please try this on ubuntu
Best Regards, J. Makefile | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile index 884b634..212451f 100644 --- a/Makefile +++ b/Makefile @@ -3280,9 +3280,8 @@ clobber: clean @rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS \ $(obj)cscope.* $(obj)*.*~ @rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL)
- @rm -f $(obj)tools/{crc32.c,env_embedded.c,env/crc32.c,md5.c,sha1.c,inca-swap-bytes}
- @rm -f $(obj)tools/{image.c,fdt.c,fdt_ro.c,fdt_rw.c,fdt_strerror.c,zlib.h}
- @rm -f $(obj)tools/{fdt_wip.c,libfdt_internal.h}
- @find $(obj)tools -name "*" -type l -print | xargs rm -f
- @rm -f $(obj)tools/inca-swap-bytes @rm -f $(obj)cpu/mpc824x/bedbug_603e.c @rm -f $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm @[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name "*" -type l -print | xargs rm -f
This will not help, we use the {...} syntax in other places, too.
Use bash.
Best regards,
Wolfgang Denk
participants (5)
-
Jean-Christophe PLAGNIOL-VILLARD
-
Jerry Van Baren
-
Mike Frysinger
-
Peter Tyser
-
Wolfgang Denk