1
0
Fork 0
remarkable-uboot/scripts
Masahiro Yamada 8be60f06c2 linux/kconfig.h: add CPP macros useful for per-image config options
The previous commit introduced a useful macro used in makefiles,
in order to reference to different variables (CONFIG_... or
CONFIG_SPL_...) depending on the build context.

Per-image config option control is a PITA in C sources, too.
Here are some macros useful in C/CPP expressions.

CONFIG_IS_ENABLED(FOO) can be used as a shorthand for

  (!defined(CONFIG_SPL_BUILD) && defined(CONFIG_FOO)) || \
   (defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_FOO))

For example, it is useful to describe C code as follows,

  #if CONFIG_IS_ENABLED(OF_CONTROL)
      (device tree code)
  #else
      (board file code)
  #endif

The ifdef conditional above is switched by CONFIG_OF_CONTROL during
the U-Boot proper building (CONFIG_SPL_BUILD is not defined), and by
CONFIG_SPL_OF_CONTROL during SPL building (CONFIG_SPL_BUILD is
defined).

The macro can be used in C context as well, so you can also write the
equivalent code as follows:

  if (CONFIG_IS_ENABLED(OF_CONTROL)) {
      (device tree code)
  } else {
      (board file code)
  }

Another useful macro is CONFIG_VALUE().
CONFIG_VALUE(FOO) is expanded into CONFIG_FOO if CONFIG_SPL_BUILD is
undefined, and into CONFIG_SPL_FOO if CONFIG_SPL_BUILD is defined.

You can write as follows:

  text_base = CONFIG_VALUE(TEXT_BASE);

instead of:

  #ifdef CONFIG_SPL_BUILD
      text_base = CONFIG_SPL_TEXT_BASE;
  #else
      text_base = CONFIG_TEXT_BASE;
  #endif

This commit also adds slight hacking on fixdep so that it can
output a correct list of fixed dependencies.

If the fixdep finds CONFIG_IS_ENABLED(FOO) in a source file,
we want
    $(wildcard include/config/foo.h)
in the U-boot proper building context, while we want
    $(wildcard include/config/spl/foo.h)
in the SPL build context.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2015-08-18 13:46:00 -04:00
..
basic linux/kconfig.h: add CPP macros useful for per-image config options 2015-08-18 13:46:00 -04:00
kconfig kconfig: sync with Linux 4.1 2015-07-27 15:01:53 -04:00
.gitignore kernel-doc: move kernel-doc tools to scripts/ 2014-02-19 11:10:04 -05:00
Kbuild.include kbuild: add a makefile macro useful with per-image config options 2015-08-18 13:46:00 -04:00
Lindent scripts/Lindent: import from Linux 3.16 2014-08-21 12:01:29 -04:00
Makefile kconfig: switch to Kconfig 2014-07-30 08:48:03 -04:00
Makefile.autoconf kbuild: create symbolic link only for ARM, AVR32, SPARC, PowerPC, x86 2015-07-27 15:02:00 -04:00
Makefile.build kbuild: sync with Linux 4.1 2015-07-27 15:01:54 -04:00
Makefile.clean kbuild: sync with Linux 4.1 2015-07-27 15:01:54 -04:00
Makefile.extrawarn kbuild: do not hide clang warnings during build with W=1 2014-11-04 15:01:56 -05:00
Makefile.host kbuild: improve multi-objs dependency and cleanups 2014-11-07 16:27:06 -05:00
Makefile.lib Support removing default assembler flags 2015-08-05 08:42:39 -06:00
Makefile.spl Makefile: Add target for building bootable SPL image for SoCFPGA 2015-08-08 14:14:10 +02:00
Makefile.uncmd_spl Remove SPL undefine of CONFIG_OF_CONTROL 2015-06-10 19:26:55 -06:00
binutils-version.sh scripts: fix binutils-version.sh for 'as' without a package. 2015-01-08 11:00:45 -05:00
checkpatch.pl checkpatch: remove unnecessary + after {8,8} 2014-09-25 09:31:24 -04:00
checkstack.pl scripts/checkstack.pl: update to get AArch64 port from Linux 2015-03-05 11:17:53 -05:00
cleanpatch Makefile: Move some scripts imported from Linux 2013-12-13 09:18:45 -05:00
docproc.c cosmetic: kbuild: clean-up coding style (sync with Linux 3.16-rc1) 2014-06-20 11:56:26 -04:00
dtc-version.sh kbuild: Make scripts executable 2014-11-12 13:25:42 -05:00
fill_scrapyard.py scripts: add a utility to fill blank fields of doc/README.scrapyard 2015-01-14 10:58:49 -05:00
gcc-stack-usage.sh kbuild: Make scripts executable 2014-11-12 13:25:42 -05:00
gcc-version.sh kbuild: Make scripts executable 2014-11-12 13:25:42 -05:00
get_maintainer.pl get_maintainer.pl: fix source tree detection 2014-12-08 09:35:41 -05:00
kernel-doc kbuild: sync misc scripts with Linux 3.18-rc1 2014-11-07 16:27:07 -05:00
ld-version.sh kbuild: sync with Linux Kernel v3.15-rc1 2014-04-18 11:43:36 -04:00
mailmapper tools, scripts: refactor error-out statements of Python scripts 2014-08-21 12:01:11 -04:00
mkmakefile kbuild: Make scripts executable 2014-11-12 13:25:42 -05:00
objdiff scripts: objdiff: sync with Linux 3.16 2014-08-21 12:01:11 -04:00
setlocalversion scripts: refetch scripts/setlocalversion from Linux 3.16 2014-08-28 17:18:48 -04:00
show-gnu-make scripts: add scripts/show-gnu-make to get GNU Make command name 2014-07-29 11:48:36 -04:00