]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit - scripts/Makefile.lib
kbuild: prepare to remove C files pre-generated by flex and bison
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Sat, 9 Dec 2017 16:02:29 +0000 (01:02 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Sat, 16 Dec 2017 02:12:53 +0000 (11:12 +0900)
commit033dba2ec06c47a9fe1b190bc3281058fb20738d
treed187e007d9082ab05d482238f9d2e7ddc937c37d
parent73a4f6dbe70a1b93c11e2d1d6ca68f3522daf434
kbuild: prepare to remove C files pre-generated by flex and bison

In Linux build system convention, pre-generated files are version-
controlled with a "_shipped" suffix.  During the kernel building,
they are simply shipped (copied) removing the suffix.

This approach can reduce external tool dependency for the kernel build,
but it is tedious to manually regenerate such artifacts from developers'
point of view.  (We need to do "make REGENERATE_PARSERS=1" every time
we touch real source files such as *.l, *.y)

Some months ago, I sent out RFC patches to run flex, bison, and gperf
during the build.

In the review and test, Linus noticed gperf-3.1 had changed the lookup
function prototype.  Then, the use of gperf in kernel was entirely
removed by commit bb3290d91695 ("Remove gperf usage from toolchain").

This time, I tested several versions of flex and bison, and I was not
hit by any compatibility issue except a flaw in flex-2.6.3; if you
generate lexer for dtc and genksyms with flex-2.6.3, you will see
"yywrap redefined" warning.  This was not intentional, but a bug,
fixed by flex-2.6.4.  Otherwise, both flex and bison look fairly
stable for a long time.

This commit prepares some build rules to remove the _shipped files.
Also, document minimal requirement for flex and bison.

Rationale for the minimal version:
The -Wmissing-prototypes option of GCC warns "no previous prototype"
for lexers generated by flex-2.5.34 or older, so I chose 2.5.35 as the
required version for flex.  Flex-2.5.35 was released in 2008.  Bison
looks more stable.  I did not see any problem with bison-2.0, released
in 2004.  I did not test bison-1.x, but bison-2.0 should be old enough.

Tested flex versions:
  2.5.35
  2.5.36
  2.5.37
  2.5.39
  2.6.0
  2.6.1
  2.6.2
  2.6.3   (*)
  2.6.4

 (*) flex-2.6.3 causes "yywrap redefined" warning

Tested bison versions:
  2.0
  2.1
  2.2
  2.3
  2.4
  2.4.1
  2.5.1
  2.6
  2.6.1
  2.6.2
  2.6.3
  2.6.4
  2.6.5
  2.7
  2.7.1
  3.0
  3.0.1
  3.0.2
  3.0.3
  3.0.4

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Documentation/process/changes.rst
scripts/Makefile.lib