summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--util/kconfig/Makefile15
-rw-r--r--util/kconfig/Makefile.inc27
3 files changed, 28 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index f3f9592649..41a9b3afa4 100644
--- a/Makefile
+++ b/Makefile
@@ -119,7 +119,7 @@ help_coreboot help::
# This include must come _before_ the pattern rules below!
# Order _does_ matter for pattern rules.
-include $(srck)/Makefile
+include $(srck)/Makefile.inc
# Three cases where we don't need fully populated $(obj) lists:
# 1. when no .config exists
diff --git a/util/kconfig/Makefile b/util/kconfig/Makefile
index 147b125b96..1713b8d0eb 100644
--- a/util/kconfig/Makefile
+++ b/util/kconfig/Makefile
@@ -10,14 +10,6 @@ DEFCONFIG?=defconfig
PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config \
localmodconfig localyesconfig
-_OS=$(shell uname -s |cut -c-7)
-regex-objs=
-ifeq ($(_OS),MINGW32)
- regex-objs=regex.o
-endif
-
-Kconfig ?= src/Kconfig
-
xconfig: $(objk)/qconf
$< $(Kconfig)
@@ -345,8 +337,6 @@ $(objk)/nconf: $(patsubst %,$(objk)/%,$(nconf-objs))
$(HOSTCC) $(HOSTCFLAGS) -o $@ $^ $(HOSTLOADLIBES_nconf)
$(objk)/conf: $(patsubst %,$(objk)/%,$(conf-objs))
$(HOSTCC) $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) -o $@ $^
-$(objk)/toada: $(objk)/toada.o
- $(HOSTCC) $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) -o $@ $^
$(objk)/mconf.o: $(srck)/mconf.c
$(HOSTCC) $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) -c -o $@ $<
@@ -356,8 +346,6 @@ $(objk)/nconf.gui.o: $(srck)/nconf.gui.c
$(HOSTCC) $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) -c -o $@ $<
$(objk)/conf.o: $(srck)/conf.c
$(HOSTCC) $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) -c -o $@ $<
-$(objk)/regex.o: $(srck)/regex.c
- $(HOSTCC) $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) -DHAVE_STRING_H -c -o $@ $<
$(objk)/zconf.tab.o: $(objk)/zconf.tab.c $(objk)/zconf.lex.c \
$(objk)/zconf.hash.c
@@ -385,8 +373,5 @@ $(objk)/lxdialog/lxdialog: $(objk)/dochecklxdialog \
$(objk)/lxdialog/%.o: $(srck)/lxdialog/%.c
$(HOSTCC) $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) $^ -c -o $@
-$(objk)/toada.o: $(srck)/toada.c
- $(HOSTCC) $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) -c -o $@ $<
-
$(objk)/%.o: HOSTCFLAGS+=-I$(srck) -I$(objk)
$(objk)/%.o: HOSTCXXFLAGS+=-I$(srck) -I$(objk)
diff --git a/util/kconfig/Makefile.inc b/util/kconfig/Makefile.inc
new file mode 100644
index 0000000000..27681f75a1
--- /dev/null
+++ b/util/kconfig/Makefile.inc
@@ -0,0 +1,27 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+# Early configuration of coreboot specific changes
+Kconfig ?= src/Kconfig
+
+# Include verbatim Makefile
+include $(dir $(lastword $(MAKEFILE_LIST)))Makefile
+
+# Extend Linux kconfig build rules
+
+# Support mingw by shipping our own regex implementation
+_OS=$(shell uname -s |cut -c-7)
+regex-objs=
+ifeq ($(_OS),MINGW32)
+ regex-objs=regex.o
+endif
+$(objk)/regex.o: $(srck)/regex.c
+ $(HOSTCC) $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) -DHAVE_STRING_H -c -o $@ $<
+
+conf-objs += $(regex-objs)
+mconf-objs += $(regex-objs)
+
+# Provide tool to convert kconfig output into Ada format
+$(objk)/toada: $(objk)/toada.o
+ $(HOSTCC) $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) -o $@ $^
+$(objk)/toada.o: $(srck)/toada.c
+ $(HOSTCC) $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) -c -o $@ $<