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

Joerg.Scheuermann at continental-corporation.com
2016-05-18T09:06:53Z

> 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)