[U-Boot] [PATCH 1/3] common: Add symbol handling for generic lists into Makefile
Marek Vasut
marex at denx.de
Mon Sep 24 19:08:59 CEST 2012
Dear Joe Hershberger,
> Hi Marex,
>
> On Mon, Sep 24, 2012 at 11:04 AM, Marek Vasut <marex at denx.de> wrote:
> > Dear Joe Hershberger,
>
> [...]
>
> >> Could you not reuse this complicated logic by defining a make function
> >
> >> and then call + eval it? Something like this:
> > Can you elaborate more? I don't quite get it ... :-(
>
> Consolidate the complicated rule that only differs by target and
> sources into a single place. I also replaced your duplication of the
> sources in the rule with "$^"
Ok, I get it ... and where do I put this consolidation ?
> >> define list_rule_template
> >> $(1) : $(2)
> >>
> >> $(OBJDUMP) -h $^ | \
> >> sed -n -e 's/.*\(\.u_boot_list[^ ]\+\).*$$/\1/p' | \
> >> sed 's/\.[^\.]\+$$//' | \
> >> sed -n ':s /^.\+$$/ { p;s/^\(.*\)\.[^\.]*$$/\1/;b s }' | \
> >> sed -n 's/\./.#/g;h;s/$$/\a/p;g;s/$$/@/p;g;s/$$/~/p;' | \
> >> LC_COLLATE=C sort -u | \
> >> sed 's/#//g' | \
> >> sed -n -e '/\a$$/ { s/\./_/g;s/\a$$/__start = .;/p; }'\
> >>
> >> -e '/~$$/ { s/\./_/g;s/~$$/__end = .;/p; }'\
> >> -e '/@$$/ { s/\(.*\)@$$/*(SORT(\1.*));/p }' >$@
> >>
> >> endef
> >> ...
>
> Then you instantiate the rule at each place in the Makefile where you
>
> need it, passing the target and sources:
> >> $(eval $(call list_rule_template,$(obj)u-boot.lst,$(LIBBOARD) $(LIBS)))
> >> ...
> >> $(eval $(call list_rule_template,$(obj)u-boot-spl.lst,$(LIBS)))
> >>
> >> > +
> >> > +$(obj)u-boot-spl.lds: $(LDSCRIPT) $(obj)u-boot-spl.lst depend
> >> >
> >> > $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - < $<
> >> > > $@
>
> -Joe
Best regards,
Marek Vasut
More information about the U-Boot
mailing list