[U-Boot] why is the compilation of cmd_pcmcia.c hardcoded?

Robert P. J. Day rpjday at crashcourse.ca
Wed Nov 18 09:17:21 CET 2009


  i'm curious as to why common/Makefile hardcodes the compilation of
cmd_pcmcia.c thusly:

  COBJS-y += cmd_pcmcia.o

since i'm interested in building for a beagleboard, i have no interest
in PCMCIA support, yet that source file will be compiled for me, even
though the selection macro CONFIG_CMD_PCMCIA does exist and is defined
by a number of other board configurations.

  what seems stranger is that, even though that config macro exists,
it isn't used in the Makefile but *is* tested in the source file
itself to determine whether the "pinit" command will be compiled:

=====
#if defined(CONFIG_CMD_PCMCIA)

extern int pcmcia_on (void);
extern int pcmcia_off (void);

int do_pinit (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
...
}

U_BOOT_CMD(
        pinit,  2,      0,      do_pinit,
        "PCMCIA sub-system",
        "on  - power on PCMCIA socket\n"
        "pinit off - power off PCMCIA socket"
);

#endif

=====

  so the "pinit" command *won't* be compiled into my image, but the
remainder of that file will still be compiled.  if the rest of that
file truly needs to be built for every board, would it not make more
sense to break the pinit code into a separate file, and have the
Makefile look something like:

ifdef CONFIG_CMD_PCMCIA
COBJS-$(CONFIG_CMD_PCMCIA) += cmd_pcmcia.o
endif

  or is there something else happening there that i'm missing?

rday

p.s.  based on the obvious naming convention of those files, i would
have imagined a file by the name of cmd_pinit.c.

--

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

            Linux Consulting, Training and Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Twitter:                                       http://twitter.com/rpjday
========================================================================


More information about the U-Boot mailing list