Skip to content
/ linux Public
forked from torvalds/linux

Commit

Permalink
kbuild: move flex and bison rules to Makefile.host
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
masahir0y committed Aug 13, 2019
1 parent 6ba7dc6 commit cf8dfd1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
17 changes: 17 additions & 0 deletions scripts/Makefile.host
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 0 additions & 16 deletions scripts/Makefile.lib
Original file line number Diff line number Diff line change
Expand Up @@ -187,22 +187,6 @@ $(foreach m, $(notdir $1), \
$(addprefix $(obj)/, $(foreach s, $3, $($(m:%$(strip $2)=%$(s)))))))
endef

# 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)

# Shipped files
# ===========================================================================

Expand Down

0 comments on commit cf8dfd1

Please sign in to comment.