Skip to contentSkip to conversation

why is the compilation of cmd_pcmcia.c hardcoded?

U-Boot Robert P. J. Day 4 participants 4 messages Nov 18, 2009 – Dec 7, 2009

lore
Share & tools
lore
#0 lore raw

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

========================================================================

#1 lore raw

Robert,

Quoted 10 lines · Robert P. J. Day

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.

Quoted 7 lines

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

#2 lore raw
In reply to Robert P. J. Day
Quoted 5 lines · 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

Quoted 8 lines

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

#3 lore raw
In reply to Robert P. J. Day

Dear "Robert P. J. Day",

Quoted 3 lines · 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

Signature · 5 lines
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