powerpc: Fix make rules for dtc

David Gibson david at gibson.dropbear.id.au
Tue Oct 10 10:23:03 EST 2006

On Mon, Oct 09, 2006 at 04:21:31PM +0200, Segher Boessenkool wrote:
> >>>  clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \
> >>> -		$(obj)/empty.c
> >>> +		$(obj)/empty.c *.dtb
> >>
> >> If this wildcard works at all, it will still do the wrong thing:
> >> deleting all .dtb files (even the ones that the Makefile cannot
> >> create again, e.g., the user put them in the tree manually) is
> >> at best not very polite.
> >
> > It certainly works at all
> My problem with it is the := which might be expanded at the wrong
> time.  Or maybe that won't glob the *.dtb yet, who knows.  

*I* know, because I checked the Kbuild rules first, and verified that
globs are legal in the clean-files variable.

> It's
> not obviously "working" either way.

> > (the preceding $(obj)/empty.c, however, is
> > wrong, I've sent a separate patch for that).  One could say the same
> > thing for *.o in clean targets,
> Yes, and that's a very well-known problem.
> > though I guess adding .dtb files is
> > rather more likely.  However, I can't seen an obvious way of
> > generating a list of the re-creatable dtbs, without an explicit
> > listing of every file in arch/powerpc/boot/dts which sounds like a bit
> > of a pain.  Suggestions?
> You shouldn't clean _all_ dtb's that you could build, only the dtb's
> that you _did_ build.  You already have a rule for what dtb's to
> build I assume; just copy the logic from there.

No.  clean rules never work this way, because if you change the config
between building and cleaning, things won't get cleaned (which is why
clean rules are just about the only place one uses globs in makefiles,
rather than expanding variables appropriately).

David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!

More information about the Linuxppc-dev mailing list