Skip to contentSkip to conversation

coding style: "obj-y" versus "obj-$(CONFIG_FOO)"?

DISCUSSION Robert P. J. Day 1 participant 1 message Jun 20, 2016

lore
Share & tools
lore
#0 lore raw

a bit more pedantry ... in init/Makefile, i see this test:

    ifneq ($(CONFIG_BLK_DEV_INITRD),y)
    obj-y                          += noinitramfs.o
    else
    obj-$(CONFIG_BLK_DEV_INITRD)   += initramfs.o
    endif

which is perfectly correct, but since BLK_DEV_INITRD is defined as a boolean, it can be assigned only yes or no, so is there any reason that second assignment wasn't written simply as:

    obj-y                          += initramfs.o

sure, it's picky, but whenever i see Makefile content of the form:

    obj-$(CONFIG_FOO)

i take into account that that could be a tristate setting. if it isn't, it just makes more sense aesthetically to me to use "obj-y" for clarity.

is there a coding style note about this sort of thing?

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
========================================================================