[U-Boot] "make clean" not traversing into board-specific directories?

Hello,
I am using u-boot 2015.04 and have a mechanism implemented in the board-specific Makefile for our board, which uses xsltproc to generate header-files from xml input files - this part is working by now.
what is still not working is the removal of those generated files upon calling "make clean", and after some initial inspection I found out, that the board-specific directories are completely ignored when calling "make clean"!
- why is that the case, can't those directories not also be visited when cleaning things up? - where and what would I need to change for being able to clean board-specific things, please? (e.g. $BOARDDIR is empty for "make clean" - whereas it does contain the correct value for "make all")
Mit freundlichen Grüßen/Best regards,
Jörg Scheuermann

Hi Jörg,
On Fri, May 13, 2016 at 1:57 PM, Joerg.Scheuermann@continental-corporation.com wrote:
Hello,
I am using u-boot 2015.04 and have a mechanism implemented in the board-specific Makefile for our board, which uses xsltproc to generate header-files from xml input files - this part is working by now.
what is still not working is the removal of those generated files upon calling "make clean", and after some initial inspection I found out, that the board-specific directories are completely ignored when calling "make clean"!
- why is that the case, can't those directories not also be visited when
cleaning things up?
It works fine for me.
I built mx7dsabresd_defconfig with mainline U-boot and after that I see:
ls board/freescale/mx7dsabresd/ built-in.o imximage.cfg.cfgtmp MAINTAINERS mx7dsabresd.c mx7dsabresd.o imximage.cfg Kconfig Makefile mx7dsabresd.su
Then after a 'make clean'
ls board/freescale/mx7dsabresd/ imximage.cfg Kconfig MAINTAINERS Makefile mx7dsabresd.c
,which worked as expected.

Hi,
On 05/13/2016 01:50 PM, Fabio Estevam wrote:
Hi Jörg,
On Fri, May 13, 2016 at 1:57 PM, Joerg.Scheuermann@continental-corporation.com wrote:
Hello,
I am using u-boot 2015.04 and have a mechanism implemented in the board-specific Makefile for our board, which uses xsltproc to generate header-files from xml input files - this part is working by now.
what is still not working is the removal of those generated files upon calling "make clean", and after some initial inspection I found out, that the board-specific directories are completely ignored when calling "make clean"!
- why is that the case, can't those directories not also be visited when
cleaning things up?
It works fine for me.
I built mx7dsabresd_defconfig with mainline U-boot and after that I see:
ls board/freescale/mx7dsabresd/ built-in.o imximage.cfg.cfgtmp MAINTAINERS mx7dsabresd.c mx7dsabresd.o imximage.cfg Kconfig Makefile mx7dsabresd.su
Then after a 'make clean'
ls board/freescale/mx7dsabresd/ imximage.cfg Kconfig MAINTAINERS Makefile mx7dsabresd.c
,which worked as expected.
In March of 2015, I was told that the board directories are not visited for "make clean". Quoting Mr. Masahiro Yamada
CLEAN_FILES is only available at the top-level Makefile.
Add CLEAN_FILES += board/my_board/test.img to the top-level Makefile, and it should work.
clean-files += test.img clean-files := test.img
These are correct in sub-directory Makefiles in general, but unfortunately, "make clean" does not descend into board/ directory for some reason.
So, they do not work in board/*/Makefile
This was quite a while ago, so changes may have been made for more recent releases. But at one time (v2014.07), "make clean" did not visit board directories.
Regards,

2016-05-14 7:41 GMT+09:00 James Chargin jimccrown@gmail.com:
Hi,
On 05/13/2016 01:50 PM, Fabio Estevam wrote:
Hi Jörg,
On Fri, May 13, 2016 at 1:57 PM, Joerg.Scheuermann@continental-corporation.com wrote:
Hello,
I am using u-boot 2015.04 and have a mechanism implemented in the board-specific Makefile for our board, which uses xsltproc to generate header-files from xml input files - this part is working by now.
what is still not working is the removal of those generated files upon calling "make clean", and after some initial inspection I found out, that the board-specific directories are completely ignored when calling "make clean"!
- why is that the case, can't those directories not also be visited when
cleaning things up?
It works fine for me.
I built mx7dsabresd_defconfig with mainline U-boot and after that I see:
ls board/freescale/mx7dsabresd/ built-in.o imximage.cfg.cfgtmp MAINTAINERS mx7dsabresd.c mx7dsabresd.o imximage.cfg Kconfig Makefile mx7dsabresd.su
Then after a 'make clean'
ls board/freescale/mx7dsabresd/ imximage.cfg Kconfig MAINTAINERS Makefile mx7dsabresd.c
,which worked as expected.
In March of 2015, I was told that the board directories are not visited for "make clean". Quoting Mr. Masahiro Yamada
CLEAN_FILES is only available at the top-level Makefile.
Add CLEAN_FILES += board/my_board/test.img to the top-level Makefile, and it should work.
clean-files += test.img clean-files := test.img
These are correct in sub-directory Makefiles in general, but unfortunately, "make clean" does not descend into board/ directory for some reason.
So, they do not work in board/*/Makefile
This was quite a while ago, so changes may have been made for more recent releases. But at one time (v2014.07), "make clean" did not visit board directories.
Nothing has happened since then. "make clean" still does not visit board directories.
For Fabio's case, '*.cfgtmp' is deleted by the pattern rule.
clean: $(clean-dirs) $(call cmd,rmdirs) $(call cmd,rmfiles) @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \ ( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ -o -name '*.ko.*' -o -name '*.su' -o -name '*.cfgtmp' \ -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ -o -name '*.symtypes' -o -name 'modules.order' \ -o -name modules.builtin -o -name '.tmp_*.o.*' \ -o -name '*.gcno' ) -type f -print | xargs rm -f

Von: Masahiro Yamada yamada.masahiro@socionext.com Datum: 14.05.2016 11:11
2016-05-14 7:41 GMT+09:00 James Chargin jimccrown@gmail.com:
Hi,
On 05/13/2016 01:50 PM, Fabio Estevam wrote:
Hi Jörg,
On Fri, May 13, 2016 at 1:57 PM, Joerg.Scheuermann@continental-corporation.com wrote:
Hello,
I am using u-boot 2015.04 and have a mechanism implemented in the board-specific Makefile for our board, which uses xsltproc to generate header-files from xml input files -
this
part is working by now.
what is still not working is the removal of those generated files
upon
calling "make clean", and after some initial inspection I found out, that the
board-specific
directories are completely ignored when calling "make clean"!
- why is that the case, can't those directories not also be visited
when
cleaning things up?
It works fine for me.
I built mx7dsabresd_defconfig with mainline U-boot and after that I
see:
ls board/freescale/mx7dsabresd/ built-in.o imximage.cfg.cfgtmp MAINTAINERS mx7dsabresd.c mx7dsabresd.o imximage.cfg Kconfig Makefile mx7dsabresd.su
Then after a 'make clean'
ls board/freescale/mx7dsabresd/ imximage.cfg Kconfig MAINTAINERS Makefile mx7dsabresd.c
,which worked as expected.
In March of 2015, I was told that the board directories are not
visited for
"make clean". Quoting Mr. Masahiro Yamada
CLEAN_FILES is only available at the top-level Makefile.
Add CLEAN_FILES += board/my_board/test.img to the top-level Makefile, and it should work.
clean-files += test.img clean-files := test.img
These are correct in sub-directory Makefiles in general, but unfortunately, "make clean" does not descend into board/
directory
for some reason.
So, they do not work in board/*/Makefile
This was quite a while ago, so changes may have been made for more
recent
releases. But at one time (v2014.07), "make clean" did not visit board directories.
Nothing has happened since then. "make clean" still does not visit board directories.
For Fabio's case, '*.cfgtmp' is deleted by the pattern rule.
clean: $(clean-dirs) $(call cmd,rmdirs) $(call cmd,rmfiles) @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .)
$(RCS_FIND_IGNORE) \
\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ -o -name '*.ko.*' -o -name '*.su' -o -name '*.cfgtmp' \ -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ -o -name '*.symtypes' -o -name 'modules.order' \ -o -name modules.builtin -o -name '.tmp_*.o.*' \ -o -name '*.gcno' \) -type f -print | xargs rm -f
-- Best Regards Masahiro Yamada
Hi again,
I 'solved' my case now by generating those headers into include/generated - as there is some existing magic already, that purges this directory upon "make distclean" (which actually is all I needed...)
is that ok that way or are there some "rules" to not write board-specific stuff into this directory perhaps? (this may not work when building consecutive u-boots for different boards WITHOUT "make distclean" in between - but in my understanding this needs to be done in this case anyway, correct?)
best regards, Jörg
p.s. just a thought: maybe the reason for "make clean" ignoring the board-specific directories is to make it functional without the need to have a valid configuration at hand? (in other words: "make all" requires a "make xyz_config" before - "make clean/distclean/mrproper" does not)

Dear Jörg,
On 05/18/2016 02:06 AM, Joerg.Scheuermann@continental-corporation.com wrote:
Von: Masahiro Yamada yamada.masahiro@socionext.com Datum: 14.05.2016 11:11
2016-05-14 7:41 GMT+09:00 James Chargin jimccrown@gmail.com:
Hi,
On 05/13/2016 01:50 PM, Fabio Estevam wrote:
Hi Jörg,
On Fri, May 13, 2016 at 1:57 PM, Joerg.Scheuermann@continental-corporation.com wrote:
Hello,
I am using u-boot 2015.04 and have a mechanism implemented in the board-specific Makefile for our board, which uses xsltproc to generate header-files from xml input files -
this
part is working by now.
what is still not working is the removal of those generated files
upon
calling "make clean", and after some initial inspection I found out, that the
board-specific
directories are completely ignored when calling "make clean"! ...
Hi again,
I 'solved' my case now by generating those headers into include/generated
- as there is some existing magic already, that purges this directory upon
"make distclean" (which actually is all I needed...)
Nice hack, good work.
is that ok that way or are there some "rules" to not write board-specific stuff into this directory perhaps? (this may not work when building consecutive u-boots for different boards WITHOUT "make distclean" in between
- but in my understanding this needs to be done in this case anyway,
correct?)
In a U-Boot 2015.07 build I've got, the other files I see in include/generated seem like they have been derived from the "make <my-board>_config".
So, your work seems to me to be compatible with the way things work more recently (I shouldn't be considered an authority on this).
I can't speak to what "rules" might say about it. I can't find any documented, which seems pretty much like "there are no rules" :)
best regards, Jörg
p.s. just a thought: maybe the reason for "make clean" ignoring the board-specific directories is to make it functional without the need to have a valid configuration at hand? (in other words: "make all" requires a "make xyz_config" before - "make clean/distclean/mrproper" does not)
This is an excellent observation, thanks.
I'd guess it means that if changes are ever made so "make clean" visits board directories, those changes will have be tolerant of there being no configuration established.
Best regards, Jim
participants (4)
-
Fabio Estevam
-
James Chargin
-
Joerg.Scheuermann@continental-corporation.com
-
Masahiro Yamada