Linux kernel modifications for the Kernel Hacking exam
Find a file
Masahiro Yamada 3a2429e1fa kbuild: change if_changed_rule for multi-line recipe
The 'define' ... 'endef' directive is useful to confine a series of
shell commands into a single macro:

  define foo
          [action1]
          [action2]
          [action3]
  endif

Each action is executed in a separate subshell.

However, rule_cc_o_c and rule_as_o_S in scripts/Makefile.build are
written as follows (with a trailing semicolon in each cmd_*):

  define rule_cc_o_c
          [action1] ; \
          [action2] ; \
          [action3] ;
  endef

All shell commands are concatenated with '; \' so that it looks like
a single command from the Makefile point of view. This does not
exploit the benefits of 'define' ... 'endef' form because a single
shell command can be more simply written, like this:

  rule_cc_o_c = \
          [action1] ; \
          [action2] ; \
          [action3] ;

I guess the intention for the command concatenation was to let the
'@set -e' in if_changed_rule cover all the commands.

We can improve the readability by moving '@set -e' to the 'cmd' macro.
The combo of $(call echo-cmd,*) $(cmd_*) in rule_cc_o_c and rule_as_o_S
have been replaced with $(call cmd,*). The trailing back-slashes have
been removed.

Here is a note about the performance: the commands in rule_cc_o_c and
rule_as_o_S were previously executed all together in a single subshell,
but now each line in a separate subshell. This means Make will spawn
extra subshells [1]. I measured the build performance for
  x86_64_defconfig + CONFIG_MODVERSIONS + CONFIG_TRIM_UNUSED_KSYMS
and I saw slight performance regression, but I believe code readability
and maintainability wins.

[1] Precisely, GNU Make may optimize this by executing the command
    directly instead of forking a subshell, if no shell special
    characters are found in the command line and omitting the subshell
    will not change the behavior.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-12-01 23:13:14 +09:00
arch kbuild: fix UML build error with CONFIG_GCC_PLUGINS 2018-12-01 22:21:59 +09:00
block for-linus-20181109 2018-11-09 16:31:51 -06:00
certs
crypto KEYS: asym_tpm: Add support for the sign operation [ver #2] 2018-10-26 09:30:47 +01:00
Documentation kbuild: announce removal of SUBDIRS if used 2018-12-01 22:21:56 +09:00
drivers kbuild: announce removal of SUBDIRS if used 2018-12-01 22:21:56 +09:00
firmware
fs for-4.20-rc1-tag 2018-11-11 16:54:38 -06:00
include kbuild: simplify dependency generation for CONFIG_TRIM_UNUSED_KSYMS 2018-12-01 23:13:14 +09:00
init memblock: stop using implicit alignment to SMP_CACHE_BYTES 2018-10-31 08:54:16 -07:00
ipc ipc: IPCMNI limit check for semmni 2018-10-31 08:54:14 -07:00
kernel Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2018-11-11 16:37:41 -06:00
lib lib/raid6: Fix arm64 test build 2018-11-06 17:12:44 +00:00
LICENSES This is a fairly typical cycle for documentation. There's some welcome 2018-10-24 18:01:11 +01:00
mm memory_hotplug: cond_resched in __remove_pages 2018-11-03 10:09:38 -07:00
net act_mirred: clear skb->tstamp on redirect 2018-11-11 10:21:31 -08:00
samples kbuild: announce removal of SUBDIRS if used 2018-12-01 22:21:56 +09:00
scripts kbuild: change if_changed_rule for multi-line recipe 2018-12-01 23:13:14 +09:00
security + Features/Improvements 2018-11-02 10:04:26 -07:00
sound ALSA: hda - Fix incorrect clearance of thinkpad_acpi hooks 2018-11-06 16:33:53 +01:00
tools perf/urgent improvements and fixes: 2018-11-06 20:03:11 +01:00
usr
virt Revert "mm, mmu_notifier: annotate mmu notifiers with blockable invalidate callbacks" 2018-10-26 16:25:19 -07:00
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap mailmap: Update email for Punit Agrawal 2018-11-05 10:02:11 +00:00
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2018-11-10 06:57:34 -06:00
Makefile kbuild: let fixdep directly write to .*.cmd files 2018-12-01 23:13:14 +09:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.