Skip to contentSkip to conversation

what means "extra-" versus "obj-" in Makefiles

U-Boot Robert P. J. Day 2 participants 2 messages Aug 31, 2016

lore
Share & tools
lore
#0 lore raw

really a Kbuild question, i realize, but i'm looking at
common/Makefile, and i'm having trouble understanding the flipping back and forth, as in:

  obj-$(CONFIG_ENV_IS_IN_DATAFLASH) += env_dataflash.o
  obj-$(CONFIG_ENV_IS_IN_EEPROM) += env_eeprom.o
  extra-$(CONFIG_ENV_IS_EMBEDDED) += env_embedded.o
  obj-$(CONFIG_ENV_IS_IN_EEPROM) += env_embedded.o
  extra-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o
  obj-$(CONFIG_ENV_IS_IN_NVRAM) += env_embedded.o

what is the rationale for the jumping between "obj-" and "extra-"? thanks.

rday

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
#1 lore raw

2016-09-01 4:09 GMT+09:00 Robert P. J. Day <[email protected]>:

Quoted 12 lines

really a Kbuild question, i realize, but i'm looking at
common/Makefile, and i'm having trouble understanding the flipping back and forth, as in:

  obj-$(CONFIG_ENV_IS_IN_DATAFLASH) += env_dataflash.o
  obj-$(CONFIG_ENV_IS_IN_EEPROM) += env_eeprom.o
  extra-$(CONFIG_ENV_IS_EMBEDDED) += env_embedded.o
  obj-$(CONFIG_ENV_IS_IN_EEPROM) += env_embedded.o
  extra-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o
  obj-$(CONFIG_ENV_IS_IN_NVRAM) += env_embedded.o
Quoted 4 lines

what is the rationale for the jumping between "obj-" and "extra-"? thanks.

rday

linux/Documentation/kbuild/makefiles.txt says as follows:

--- 6.6 Building non-kbuild targets

extra-y

extra-y specifies additional targets created in the current directory, in addition to any targets specified by obj-*.

Listing all targets in extra-y is required for two purposes:
1) Enable kbuild to check changes in command lines
- When $(call if_changed,xxx) is used
2) kbuild knows what files to delete during "make clean"

Example:
#arch/x86/kernel/Makefile
extra-y := head.o init_task.o

In this example, extra-y is used to list object files that shall be built, but shall not be linked as part of built-in.o.

Signature · 2 lines
Best Regards
Masahiro Yamada