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

Robert P. J. Day rpjday at crashcourse.ca
Mon Jun 20 08:54:53 EDT 2016


  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

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

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




More information about the Kernelnewbies mailing list