summaryrefslogtreecommitdiffstats
path: root/scripts/Makefile.host
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2019-07-20 18:27:40 +0200
committerMasahiro Yamada <yamada.masahiro@socionext.com>2019-08-13 18:10:42 +0200
commitcf8dfd15e5fb280fa1e79e1d373456cb1e701222 (patch)
treed98293942f605d235b741e77d6b9ea3bcdb85e23 /scripts/Makefile.host
parentkbuild: make bison create C file and header in a single pattern rule (diff)
downloadlinux-cf8dfd15e5fb280fa1e79e1d373456cb1e701222.tar.xz
linux-cf8dfd15e5fb280fa1e79e1d373456cb1e701222.zip
kbuild: move flex and bison rules to Makefile.host
Flex and bison are used for kconfig, dtc, genksyms, all of which are host programs. I never imagine the kernel embeds a parser or a lexer. Move the flex and bison rules to scripts/Makefile.host. This file is included only when hostprogs-y etc. is present in the Makefile in the directory. So, parsing these rules are skipped in most of directories. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts/Makefile.host')
-rw-r--r--scripts/Makefile.host17
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/Makefile.host b/scripts/Makefile.host
index 2208ebbd8c4c..b402c619147d 100644
--- a/scripts/Makefile.host
+++ b/scripts/Makefile.host
@@ -1,4 +1,21 @@
# SPDX-License-Identifier: GPL-2.0
+
+# LEX
+# ---------------------------------------------------------------------------
+quiet_cmd_flex = LEX $@
+ cmd_flex = $(LEX) -o$@ -L $<
+
+$(obj)/%.lex.c: $(src)/%.l FORCE
+ $(call if_changed,flex)
+
+# YACC
+# ---------------------------------------------------------------------------
+quiet_cmd_bison = YACC $(basename $@).[ch]
+ cmd_bison = $(YACC) -o $(basename $@).c --defines=$(basename $@).h -t -l $<
+
+$(obj)/%.tab.c $(obj)/%.tab.h: $(src)/%.y FORCE
+ $(call if_changed,bison)
+
# ==========================================================================
# Building binaries on the host system
# Binaries are used during the compilation of the kernel, for example