public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] U-Boot Makefile question
@ 2009-02-17 13:43 Steven Zedeck
  2009-02-17 15:03 ` Michael Lawnick
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Steven Zedeck @ 2009-02-17 13:43 UTC (permalink / raw)
  To: u-boot


Hi all,
I am new to u-boot. But I am ramping up pretty fast. My primary issue is
understanding the Makefile syntax. Is there a good tutorial somewhere that
explains how u-boot uses the Makefiles and their syntax?

For example, I'm having problems understanding what this means in a
Makefile:

COBJS-$(CONFIG_HAS_DATAFLASH) += at45.o
COBJS-$(CONFIG_FLASH_CFI_DRIVER) += cfi_flash.o
COBJS-$(CONFIG_HAS_DATAFLASH) += dataflash.o
COBJS-$(CONFIG_FLASH_CFI_LEGACY) += jedec_flash.o
COBJS-$(CONFIG_MW_EEPROM) += mw_eeprom.o

COBJS	:= $(COBJS-y)
SRCS	:= $(COBJS:.o=.c)
OBJS	:= $(addprefix $(obj),$(COBJS))

This is from drivers/mtd/Makefile.

How does COBJS get initially defined upon entry into the Makefile?

Does at45.o get added to the list of objects to be built only if the
CONFIG_HAS_DATAFLASH flag is set?

What does the "-" sign mean before the "$" ?

What does this mean?  COBJS	:= $(COBJS-y)

I'm sorry for the "dumb" questions. Any help with the understanding of
Makefiles would be greatly appreciated.

Thanks in advance,
Steve
-- 
View this message in context: http://www.nabble.com/U-Boot-Makefile-question-tp22057574p22057574.html
Sent from the Uboot - Users mailing list archive at Nabble.com.

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

* [U-Boot] U-Boot Makefile question
  2009-02-17 13:43 [U-Boot] U-Boot Makefile question Steven Zedeck
@ 2009-02-17 15:03 ` Michael Lawnick
  2009-02-17 16:02 ` Mike Frysinger
  2009-02-18  9:34 ` Frank Svendsbøe
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Lawnick @ 2009-02-17 15:03 UTC (permalink / raw)
  To: u-boot

Steven Zedeck said the following:
> For example, I'm having problems understanding what this means in a
> Makefile:
> 
> COBJS-$(CONFIG_HAS_DATAFLASH) += at45.o
> COBJS-$(CONFIG_FLASH_CFI_DRIVER) += cfi_flash.o
> COBJS-$(CONFIG_HAS_DATAFLASH) += dataflash.o
> COBJS-$(CONFIG_FLASH_CFI_LEGACY) += jedec_flash.o
> COBJS-$(CONFIG_MW_EEPROM) += mw_eeprom.o
> 
> COBJS	:= $(COBJS-y)
> SRCS	:= $(COBJS:.o=.c)
> OBJS	:= $(addprefix $(obj),$(COBJS))
> 
> This is from drivers/mtd/Makefile.
> 
> How does COBJS get initially defined upon entry into the Makefile?
> 
> Does at45.o get added to the list of objects to be built only if the
> CONFIG_HAS_DATAFLASH flag is set?
> 
> What does the "-" sign mean before the "$" ?
> 
On start of compile, the file autoconf.mk is generated along your board
configuration #defines in board/<board>/<board-name>.h
It looks like this:
CONFIG_PPC=y
CONFIG_BOARD_EARLY_INIT_F=y
CONFIG_BOARD_EARLY_INIT_R=y
CONFIG_SYS_CLK_FREQ=100000000
CONFIG_CMD_ITEST=y
...

autoconf.mk is then used as a predefinition file for the rules of your
Makefile. So
COBJS-$(CONFIG_HAS_DATAFLASH) += at45.o
evaluates to either
COBJS-y += at45.o
or
COBJS- += at45.o
or
COBJS-n += at45.o
> What does this mean?  COBJS	:= $(COBJS-y)

This is the assignment of the dynamically built string to the variable
that is then used for the gcc command.

HTH
-- 

Michael

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

* [U-Boot] U-Boot Makefile question
  2009-02-17 13:43 [U-Boot] U-Boot Makefile question Steven Zedeck
  2009-02-17 15:03 ` Michael Lawnick
@ 2009-02-17 16:02 ` Mike Frysinger
  2009-02-18  9:34 ` Frank Svendsbøe
  2 siblings, 0 replies; 4+ messages in thread
From: Mike Frysinger @ 2009-02-17 16:02 UTC (permalink / raw)
  To: u-boot

On Tuesday 17 February 2009 08:43:31 Steven Zedeck wrote:
> What does the "-" sign mean before the "$" ?

it doesnt mean anything.  make allows "-" in variable names as well as many 
other chars you might not expect.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090217/4d9f80c2/attachment-0001.pgp 

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

* [U-Boot] U-Boot Makefile question
  2009-02-17 13:43 [U-Boot] U-Boot Makefile question Steven Zedeck
  2009-02-17 15:03 ` Michael Lawnick
  2009-02-17 16:02 ` Mike Frysinger
@ 2009-02-18  9:34 ` Frank Svendsbøe
  2 siblings, 0 replies; 4+ messages in thread
From: Frank Svendsbøe @ 2009-02-18  9:34 UTC (permalink / raw)
  To: u-boot

Hi Steven,
I recommend you to read the GNU make manual.
See http://www.gnu.org/software/make/manual/

On Tue, Feb 17, 2009 at 2:43 PM, Steven Zedeck <saz@proliphix.com> wrote:
>
> Hi all,
> I am new to u-boot. But I am ramping up pretty fast. My primary issue is
> understanding the Makefile syntax. Is there a good tutorial somewhere that
> explains how u-boot uses the Makefiles and their syntax?
>
> For example, I'm having problems understanding what this means in a
> Makefile:
>
> COBJS-$(CONFIG_HAS_DATAFLASH) += at45.o
> COBJS-$(CONFIG_FLASH_CFI_DRIVER) += cfi_flash.o
> COBJS-$(CONFIG_HAS_DATAFLASH) += dataflash.o
> COBJS-$(CONFIG_FLASH_CFI_LEGACY) += jedec_flash.o
> COBJS-$(CONFIG_MW_EEPROM) += mw_eeprom.o
>
> COBJS   := $(COBJS-y)
> SRCS    := $(COBJS:.o=.c)
> OBJS    := $(addprefix $(obj),$(COBJS))
>
> This is from drivers/mtd/Makefile.
>
> How does COBJS get initially defined upon entry into the Makefile?
>
> Does at45.o get added to the list of objects to be built only if the
> CONFIG_HAS_DATAFLASH flag is set?
>
> What does the "-" sign mean before the "$" ?
>
> What does this mean?  COBJS     := $(COBJS-y)
>
> I'm sorry for the "dumb" questions. Any help with the understanding of
> Makefiles would be greatly appreciated.
>
> Thanks in advance,
> Steve
> --
> View this message in context: http://www.nabble.com/U-Boot-Makefile-question-tp22057574p22057574.html
> Sent from the Uboot - Users mailing list archive at Nabble.com.
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>

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

end of thread, other threads:[~2009-02-18  9:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-17 13:43 [U-Boot] U-Boot Makefile question Steven Zedeck
2009-02-17 15:03 ` Michael Lawnick
2009-02-17 16:02 ` Mike Frysinger
2009-02-18  9:34 ` Frank Svendsbøe

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