aboutsummaryrefslogtreecommitdiff
path: root/tools/kconfig/makefile
blob: e82dca9221f2c48d986e8ee4e00aba264f2756b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# SPDX-License-Identifier: GPL-2.0
# adapted from Linux kernel config tools
# repo:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
# commit: f296bfd5cd04cbb49b8fc9585adc280ab2b58624
# path:   scripts/kconfig

HOST_CC	:= clang
YACC	:= bison
LEX	:= flex

.PHONY: clean

common-objs	:= confdata.o expr.o lexer.lex.o parser.tab.o preprocess.o symbol.o util.o
lxdialog-objs	:= $(addprefix lxdialog/, checklist.o inputbox.o menubox.o textbox.o util.o yesno.o)
mconf-objs	:= $(addprefix $(OBJ_DIR)/, mconf.o $(lxdialog-objs) $(common-objs))
conf-objs	:= $(addprefix $(OBJ_DIR)/, conf.o $(common-objs))

$(OBJ_DIR)/conf: $(conf-objs)
	@echo "HOSTCC $(@F)"
	@mkdir -p $(@D)
	@$(HOST_CC) -o $@ $^
$(OBJ_DIR)/mconf: $(mconf-objs)
	@echo "HOSTCC $(@F)"
	@mkdir -p $(@D)
	@$(HOST_CC) -o $@ $^ -lncurses

lexer.lex.c: lexer.l parser.tab.h
	@echo "  LEX  $<"
	@$(LEX) --outfile=lexer.lex.c --header-file=lexer.lex.h lexer.l
parser.tab.h parser.tab.c: parser.y
	@echo "  YACC $<"
	@$(YACC) --debug -d $<
$(OBJ_DIR)/%.o: %.c
	@echo "HOSTCC $<"
	@mkdir -p $(@D)
	@$(HOST_CC) -c $< -o $@

clean:
	@rm -f $(addprefix $(OBJ_DIR)/, $(common-objs) $(lxdialog-objs) conf.o mconf.o) \
	    lexer.lex.h lexer.lex.c parser.tab.h parser.tab.c \