mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
kconfig: Allow out of tree building, build under cmake build directory
This commit is contained in:
parent
cb99531d15
commit
7eaf2f4bdb
@ -1,7 +1,7 @@
|
||||
include(ExternalProject)
|
||||
|
||||
macro(kconfig_set_variables)
|
||||
set(MCONF ${IDF_PATH}/tools/kconfig/mconf)
|
||||
set(MCONF kconfig_bin/mconf)
|
||||
|
||||
set_default(SDKCONFIG ${PROJECT_PATH}/sdkconfig)
|
||||
set(SDKCONFIG_HEADER ${CMAKE_BINARY_DIR}/sdkconfig.h)
|
||||
@ -10,19 +10,20 @@ macro(kconfig_set_variables)
|
||||
set(ROOT_KCONFIG ${IDF_PATH}/Kconfig)
|
||||
endmacro()
|
||||
|
||||
# Use the existing Makefile to build mconf when needed
|
||||
# Use the existing Makefile to build mconf (out of tree) when needed
|
||||
#
|
||||
# TODO: replace this with something more Windows-friendly
|
||||
# TODO: Find a solution on Windows
|
||||
ExternalProject_Add(mconf
|
||||
SOURCE_DIR ${IDF_PATH}/tools/kconfig
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_IN_SOURCE 1
|
||||
BUILD_COMMAND make mconf
|
||||
BUILD_BYPRODUCTS ${MCONF}
|
||||
BINARY_DIR "kconfig_bin"
|
||||
BUILD_COMMAND make -f ${IDF_PATH}/tools/kconfig/Makefile mconf
|
||||
BUILD_BYPRODUCTS "kconfig_bin" ${MCONF}
|
||||
INSTALL_COMMAND ""
|
||||
EXCLUDE_FROM_ALL 1
|
||||
)
|
||||
|
||||
|
||||
# Find all Kconfig files for all components
|
||||
function(kconfig_process_config)
|
||||
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include/config")
|
||||
@ -65,7 +66,7 @@ function(kconfig_process_config)
|
||||
"COMPONENT_KCONFIGS=${kconfigs}"
|
||||
"COMPONENT_KCONFIGS_PROJBUILD=${kconfigs_projbuild}"
|
||||
"KCONFIG_CONFIG=${SDKCONFIG}"
|
||||
${IDF_PATH}/tools/kconfig/mconf ${ROOT_KCONFIG}
|
||||
${MCONF} ${ROOT_KCONFIG}
|
||||
VERBATIM
|
||||
USES_TERMINAL)
|
||||
|
||||
|
@ -2,6 +2,10 @@
|
||||
# Kernel configuration targets
|
||||
# These targets are used from top-level makefile
|
||||
|
||||
# SRCDIR is kconfig source dir, allows for out-of-tree builds
|
||||
# if building in tree, SRCDIR==build dir
|
||||
SRCDIR := $(abspath $(dir $(firstword $(MAKEFILE_LIST))))
|
||||
|
||||
PHONY += xconfig gconfig menuconfig config silentoldconfig \
|
||||
localmodconfig localyesconfig clean
|
||||
|
||||
@ -156,13 +160,22 @@ help:
|
||||
@echo ' tinyconfig - Configure the tiniest possible kernel'
|
||||
|
||||
# lxdialog stuff
|
||||
check-lxdialog := lxdialog/check-lxdialog.sh
|
||||
check-lxdialog := $(SRCDIR)/lxdialog/check-lxdialog.sh
|
||||
|
||||
# Use recursively expanded variables so we do not call gcc unless
|
||||
# we really need to do so. (Do not call gcc as part of make mrproper)
|
||||
CFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \
|
||||
-DLOCALE -MD
|
||||
|
||||
%.o: $(SRCDIR)/%.c
|
||||
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
|
||||
|
||||
lxdialog/%.o: $(SRCDIR)/lxdialog/%.c
|
||||
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
|
||||
|
||||
%.o: %.c
|
||||
$(CC) -I $(SRCDIR) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
|
||||
|
||||
# ===========================================================================
|
||||
# Shared Makefile for the various kconfig executables:
|
||||
# conf: Used for defconfig, oldconfig and related targets
|
||||
@ -199,9 +212,12 @@ clean-files += $(all-objs) $(all-deps) conf mconf
|
||||
# Check that we have the required ncurses stuff installed for lxdialog (menuconfig)
|
||||
PHONY += dochecklxdialog
|
||||
$(addprefix ,$(lxdialog)): dochecklxdialog
|
||||
dochecklxdialog:
|
||||
dochecklxdialog: lxdialog
|
||||
$(CONFIG_SHELL) $(check-lxdialog) -check $(CC) $(CFLAGS) $(LOADLIBES_mconf)
|
||||
|
||||
lxdialog:
|
||||
mkdir -p lxdialog
|
||||
|
||||
always := dochecklxdialog
|
||||
|
||||
# Add environment specific flags
|
||||
@ -308,7 +324,7 @@ gconf.glade.h: gconf.glade
|
||||
gconf.glade
|
||||
|
||||
|
||||
mconf: $(mconf-objs)
|
||||
mconf: lxdialog $(mconf-objs)
|
||||
$(CC) -o $@ $(mconf-objs) $(LOADLIBES_mconf)
|
||||
|
||||
conf: $(conf-objs)
|
||||
@ -316,15 +332,15 @@ conf: $(conf-objs)
|
||||
|
||||
zconf.tab.c: zconf.lex.c
|
||||
|
||||
zconf.lex.c: zconf.l
|
||||
flex -L -P zconf -o zconf.lex.c zconf.l
|
||||
zconf.lex.c: $(SRCDIR)/zconf.l
|
||||
flex -L -P zconf -o zconf.lex.c $<
|
||||
|
||||
zconf.hash.c: zconf.gperf
|
||||
zconf.hash.c: $(SRCDIR)/zconf.gperf
|
||||
# strip CRs on Windows systems where gperf will otherwise barf on them
|
||||
sed -E "s/\\x0D$$//" zconf.gperf | gperf -t --output-file zconf.hash.c -a -C -E -g -k '1,3,$$' -p -t
|
||||
sed -E "s/\\x0D$$//" $< | gperf -t --output-file zconf.hash.c -a -C -E -g -k '1,3,$$' -p -t
|
||||
|
||||
zconf.tab.c: zconf.y
|
||||
bison -t -l -p zconf -o zconf.tab.c zconf.y
|
||||
zconf.tab.c: $(SRCDIR)/zconf.y
|
||||
bison -t -l -p zconf -o zconf.tab.c $<
|
||||
|
||||
clean:
|
||||
rm -f $(clean-files)
|
||||
|
Loading…
x
Reference in New Issue
Block a user