Skip to content

Commit cf8dfd1

Browse files
committed
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>
1 parent 6ba7dc6 commit cf8dfd1

2 files changed

Lines changed: 17 additions & 16 deletions

File tree

‎scripts/Makefile.host‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
11
# SPDX-License-Identifier: GPL-2.0
2+
3+
# LEX
4+
# ---------------------------------------------------------------------------
5+
quiet_cmd_flex = LEX $@
6+
cmd_flex = $(LEX) -o$@ -L $<
7+
8+
$(obj)/%.lex.c: $(src)/%.l FORCE
9+
$(call if_changed,flex)
10+
11+
# YACC
12+
# ---------------------------------------------------------------------------
13+
quiet_cmd_bison = YACC $(basename $@).[ch]
14+
cmd_bison = $(YACC) -o $(basename $@).c --defines=$(basename $@).h -t -l $<
15+
16+
$(obj)/%.tab.c $(obj)/%.tab.h: $(src)/%.y FORCE
17+
$(call if_changed,bison)
18+
219
# ==========================================================================
320
# Building binaries on the host system
421
# Binaries are used during the compilation of the kernel, for example

‎scripts/Makefile.lib‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -187,22 +187,6 @@ $(foreach m, $(notdir $1), \
187187
$(addprefix $(obj)/, $(foreach s, $3, $($(m:%$(strip $2)=%$(s)))))))
188188
endef
189189

190-
# LEX
191-
# ---------------------------------------------------------------------------
192-
quiet_cmd_flex = LEX $@
193-
cmd_flex = $(LEX) -o$@ -L $<
194-
195-
$(obj)/%.lex.c: $(src)/%.l FORCE
196-
$(call if_changed,flex)
197-
198-
# YACC
199-
# ---------------------------------------------------------------------------
200-
quiet_cmd_bison = YACC $(basename $@).[ch]
201-
cmd_bison = $(YACC) -o $(basename $@).c --defines=$(basename $@).h -t -l $<
202-
203-
$(obj)/%.tab.c $(obj)/%.tab.h: $(src)/%.y FORCE
204-
$(call if_changed,bison)
205-
206190
# Shipped files
207191
# ===========================================================================
208192

0 commit comments

Comments
 (0)