Skip to contentSkip to conversation

worth cleaning redundancies out of some board Makefiles?

U-Boot Robert P. J. Day 3 participants 5 messages Apr 13, 2016

lore
Share & tools
lore
#0 lore raw

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

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
#1 lore raw
Quoted 30 lines · Robert P. J. Day

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

Quoted 8 lines

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

Quoted 3 lines

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.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160413/c8b45845/attachment.sig>
#2 lore raw
Quoted 36 lines · Tom Rini
Quoted 34 lines · Robert P. J. Day

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

Quoted 8 lines
Quoted 4 lines

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

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
#3 lore raw
In reply to Robert P. J. Day

Dear Robert,

Quoted 3 lines · In message <[email protected]> you wrote:

again, in my travels, i noticed board Makefiles like, say,
board/freescale/bsc9131rdb/Makefile:

...

Quoted 2 lines

obviously(?), it's redundant to select building tlb.o and law.o in
both parts of the conditional, when it could look like:

...

Quoted 3 lines

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

Signature · 5 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
To get something done, a committee should consist  of  no  more  than
three men, two of them absent.
#4 lore raw
Quoted 9 lines · Wolfgang Denk

Dear Robert,

Quoted 3 lines · In message <[email protected]> you wrote:

again, in my travels, i noticed board Makefiles like, say,
board/freescale/bsc9131rdb/Makefile:

...

Quoted 2 lines

obviously(?), it's redundant to select building tlb.o and law.o in
both parts of the conditional, when it could look like:

Quoted 8 lines

...

Quoted 3 lines

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

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================