[U-Boot] worth cleaning redundancies out of some board Makefiles?

again, in my travels, i noticed board Makefiles like, say, board/freescale/bsc9131rdb/Makefile:
ifdef MINIMAL
obj-y += spl_minimal.o tlb.o law.o
else
obj-y += bsc9131rdb.o obj-y += ddr.o obj-y += law.o obj-y += tlb.o #obj-y += bsc9131rdb_mux.o
endif
obviously(?), it's redundant to select building tlb.o and law.o in both parts of the conditional, when it could look like:
ifdef MINIMAL
obj-y += spl_minimal.o
else
obj-y += bsc9131rdb.o obj-y += ddr.o #obj-y += bsc9131rdb_mux.o
endif
obj-y += law.o obj-y += tlb.o
is it worth submitting a patch or two that cleans up that sort of thing, perhaps on a vendor-by-vendor basis? i can do that bit by bit if it's worth it.
rday

On Wed, Apr 13, 2016 at 09:17:51AM -0400, Robert P. J. Day wrote:
again, in my travels, i noticed board Makefiles like, say, board/freescale/bsc9131rdb/Makefile:
ifdef MINIMAL
obj-y += spl_minimal.o tlb.o law.o
else
obj-y += bsc9131rdb.o obj-y += ddr.o obj-y += law.o obj-y += tlb.o #obj-y += bsc9131rdb_mux.o
endif
obviously(?), it's redundant to select building tlb.o and law.o in both parts of the conditional, when it could look like:
ifdef MINIMAL
obj-y += spl_minimal.o
else
obj-y += bsc9131rdb.o obj-y += ddr.o #obj-y += bsc9131rdb_mux.o
endif
obj-y += law.o obj-y += tlb.o
or even: obj-y += bsc9131rdb.o ddr.o endif
obj-y += law.o tlb.o
is it worth submitting a patch or two that cleans up that sort of thing, perhaps on a vendor-by-vendor basis? i can do that bit by bit if it's worth it.
I certainly don't object to making examples that people are likely to copy from from better. So in that regard, yes, it is.

On Wed, 13 Apr 2016, Tom Rini wrote:
On Wed, Apr 13, 2016 at 09:17:51AM -0400, Robert P. J. Day wrote:
again, in my travels, i noticed board Makefiles like, say, board/freescale/bsc9131rdb/Makefile:
ifdef MINIMAL
obj-y += spl_minimal.o tlb.o law.o
else
obj-y += bsc9131rdb.o obj-y += ddr.o obj-y += law.o obj-y += tlb.o #obj-y += bsc9131rdb_mux.o
endif
obviously(?), it's redundant to select building tlb.o and law.o in both parts of the conditional, when it could look like:
ifdef MINIMAL
obj-y += spl_minimal.o
else
obj-y += bsc9131rdb.o obj-y += ddr.o #obj-y += bsc9131rdb_mux.o
endif
obj-y += law.o obj-y += tlb.o
or even: obj-y += bsc9131rdb.o ddr.o endif
the visual style for that is all over the place, some files have both styles, so when i get the chance, i'm just going to use whatever style is in the file at the time to be minimally disruptive.
rday

Dear Robert,
In message alpine.LFD.2.20.1604130912400.7138@localhost.localdomain you wrote:
again, in my travels, i noticed board Makefiles like, say, board/freescale/bsc9131rdb/Makefile:
...
obviously(?), it's redundant to select building tlb.o and law.o in both parts of the conditional, when it could look like:
...
is it worth submitting a patch or two that cleans up that sort of thing, perhaps on a vendor-by-vendor basis? i can do that bit by bit if it's worth it.
Yes! All such cleanup patches are much appreciated, both for the better code and for the educational effect. Of course, this is just my 0.02€ ...
Best regards,
Wolfgang Denk

On Wed, 13 Apr 2016, Wolfgang Denk wrote:
Dear Robert,
In message alpine.LFD.2.20.1604130912400.7138@localhost.localdomain you wrote:
again, in my travels, i noticed board Makefiles like, say, board/freescale/bsc9131rdb/Makefile:
...
obviously(?), it's redundant to select building tlb.o and law.o in both parts of the conditional, when it could look like:
...
is it worth submitting a patch or two that cleans up that sort of thing, perhaps on a vendor-by-vendor basis? i can do that bit by bit if it's worth it.
Yes! All such cleanup patches are much appreciated, both for the better code and for the educational effect. Of course, this is just my 0.02€ ...
doesn't take long to start seeing the recurring patterns in those Makefiles. :-) a couple oddities, lines like this:
obj-y = m5208evbe.o obj-y := mpc5121ads.o
is there a rationale for using either of "=" or ":=" in those Makefiles, as opposed to the ubiquitous "+="? surely in those cases, there is absolutely no functional difference, but the sudden change in operator can be confusing.
rday
participants (3)
-
Robert P. J. Day
-
Tom Rini
-
Wolfgang Denk