From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Mon, 24 Sep 2012 19:08:59 +0200 Subject: [U-Boot] [PATCH 1/3] common: Add symbol handling for generic lists into Makefile In-Reply-To: References: <1348449718-16463-1-git-send-email-marex@denx.de> <201209241804.25793.marex@denx.de> Message-ID: <201209241908.59930.marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Joe Hershberger, > Hi Marex, > > On Mon, Sep 24, 2012 at 11:04 AM, Marek Vasut 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