public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] why is the compilation of cmd_pcmcia.c hardcoded?
@ 2009-11-18  8:17 Robert P. J. Day
  2009-11-18 17:37 ` Ben Warren
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Robert P. J. Day @ 2009-11-18  8:17 UTC (permalink / raw)
  To: u-boot


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] why is the compilation of cmd_pcmcia.c hardcoded?
  2009-11-18  8:17 [U-Boot] why is the compilation of cmd_pcmcia.c hardcoded? Robert P. J. Day
@ 2009-11-18 17:37 ` Ben Warren
  2009-11-19  0:15 ` Mike Frysinger
  2009-12-07 20:16 ` Wolfgang Denk
  2 siblings, 0 replies; 4+ messages in thread
From: Ben Warren @ 2009-11-18 17:37 UTC (permalink / raw)
  To: u-boot

Robert,

Robert P. J. Day wrote:
>   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)
>   
If you look at the source code tree from a couple of years ago you'll 
see that the pattern you've discovered used to be the norm.  Over time, 
people have been removing the source file wrappers and moving 
conditionality to the Makefiles.  It's a work in progress, and help 
fixing things up is always appreciated.

regards,
Ben

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] why is the compilation of cmd_pcmcia.c hardcoded?
  2009-11-18  8:17 [U-Boot] why is the compilation of cmd_pcmcia.c hardcoded? Robert P. J. Day
  2009-11-18 17:37 ` Ben Warren
@ 2009-11-19  0:15 ` Mike Frysinger
  2009-12-07 20:16 ` Wolfgang Denk
  2 siblings, 0 replies; 4+ messages in thread
From: Mike Frysinger @ 2009-11-19  0:15 UTC (permalink / raw)
  To: u-boot

On Wednesday 18 November 2009 03:17:21 Robert P. J. Day wrote:
>   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:

you didnt read enough of the code.  specifically, you missed the fact that 
other config options can compile code in this file even if CONFIG_CMD_PCMCIA 
is disabled.

if you feel like re-architecting and splitting the code to take this into 
consideration, that's one thing.  but it isnt a simple 'move the config option 
into the makefile' fix.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091118/ca4ab624/attachment.pgp 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] why is the compilation of cmd_pcmcia.c hardcoded?
  2009-11-18  8:17 [U-Boot] why is the compilation of cmd_pcmcia.c hardcoded? Robert P. J. Day
  2009-11-18 17:37 ` Ben Warren
  2009-11-19  0:15 ` Mike Frysinger
@ 2009-12-07 20:16 ` Wolfgang Denk
  2 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2009-12-07 20:16 UTC (permalink / raw)
  To: u-boot

Dear "Robert P. J. Day",

In message <alpine.LFD.2.00.0911180307560.31136@localhost> you wrote:
> 
>   i'm curious as to why common/Makefile hardcodes the compilation of
> cmd_pcmcia.c thusly:

Historic / hysteric reasons?

Please feel free to submit cleanup patches!

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
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
The only thing necessary for the triumph of evil is for good  men  to
do nothing.                                            - Edmund Burke

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-12-07 20:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-18  8:17 [U-Boot] why is the compilation of cmd_pcmcia.c hardcoded? Robert P. J. Day
2009-11-18 17:37 ` Ben Warren
2009-11-19  0:15 ` Mike Frysinger
2009-12-07 20:16 ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox