[U-Boot] make clean problem

Hello,
I just stumbled on a problem with the make clean command in U-Boot. When executing make clean I noticed that some programmes that should have been deleted were not deleted. These were the programmes to be deleted with instructions such as:
@rm -f $(obj)tools/env/{fw_printenv,fw_setenv}
The reason is (after scratching my head for a few hours) that on my platform BASH is not the default shell. I am using Ubuntu and /bin/sh is linked to dash (see https://wiki.ubuntu.com/DashAsBinSh for details). As I am not an expert on shells, my guess is that the above construct is a "bashism" and not compliant to /bin/sh.
There are two trivial solutions to this problem:
(a) Add a line SHELL=/bin/bash somewhere in top level Makefile (b) Write out each individual file's path name separately in the @rm command line.
What is best course of action? Choosing (a) means that we are specifying BASH as a requirement for the U-Boot HOST environment. If this is already the case then solution (a) is perhaps the best and limits U-Boot regression testing to one shell type. Otherwise if we want to be compatible with /bin/sh then I believe solution (b) is preferable.
Regards, Eugene O'Brien

Dear "Eugene O'Brien",
In message 8B3930FEA8618C44B48EB06B5D33A06E01CCE207@satmail.Advantech.ca you wrote:
@rm -f $(obj)tools/env/{fw_printenv,fw_setenv}
The reason is (after scratching my head for a few hours) that on my platform BASH is not the default shell. I am using Ubuntu and /bin/sh is linked to dash (see https://wiki.ubuntu.com/DashAsBinSh for details). As I am not an expert on shells, my guess is that the above construct is a "bashism" and not compliant to /bin/sh.
Good catch...
There are two trivial solutions to this problem:
(a) Add a line SHELL=/bin/bash somewhere in top level Makefile (b) Write out each individual file's path name separately in the @rm command line.
I think the above way to abbreviate long lists of file names that have a long common partis pretty useful to keep the code readable, so I tend to prefer solution (a).
But let's see what other people say...
Best regards,
Wolfgang Denk

Wolfgang Denk wrote:
Dear "Eugene O'Brien",
In message 8B3930FEA8618C44B48EB06B5D33A06E01CCE207@satmail.Advantech.ca you wrote:
@rm -f $(obj)tools/env/{fw_printenv,fw_setenv}
The reason is (after scratching my head for a few hours) that on my platform BASH is not the default shell. I am using Ubuntu and /bin/sh is linked to dash (see https://wiki.ubuntu.com/DashAsBinSh for details). As I am not an expert on shells, my guess is that the above construct is a "bashism" and not compliant to /bin/sh.
Good catch...
There are two trivial solutions to this problem:
(a) Add a line SHELL=/bin/bash somewhere in top level Makefile (b) Write out each individual file's path name separately in the @rm command line.
I think the above way to abbreviate long lists of file names that have a long common partis pretty useful to keep the code readable, so I tend to prefer solution (a).
But let's see what other people say...
I *LIKE* bash, so I too like (a).
Having said that, and with the disclaimer that I'm not sure it is an improvement, I believe the following line is a "make-ism" equivalent to the bash-ism (untested):
@rm -f $(foreach file, fw_printenv fw_setenv, $(obj)tools/env/$(file))
Best regards,
Wolfgang Denk
Ditto, gvb

Dear Jerry Van Baren,
In message 48ECF72E.20704@ge.com you wrote:
@rm -f $(obj)tools/env/{fw_printenv,fw_setenv}
...
Having said that, and with the disclaimer that I'm not sure it is an improvement, I believe the following line is a "make-ism" equivalent to the bash-ism (untested):
@rm -f $(foreach file, fw_printenv fw_setenv, $(obj)tools/env/$(file))
Well, I certainly think it ain't no improvment at all. Thebash code may be cryptic, but in a way that is readable to a prgrammer.
The make notation makes me believe I had too much beer (and I haven't even started yet).
Best regards,
Wolfgang Denk
participants (3)
-
Eugene O'Brien
-
Jerry Van Baren
-
Wolfgang Denk