Merge branch 'bugfix/make_config_problems' into 'master'

build system: Fix several make & configuration problems

Collection of quasi-related build system fixes:
* Fix issues with "make menuconfig" running twice when no existing sdkconfig
* Fix issues with menuconfig getting into a bad state if "make -jN" and no existing sdkconfig
* Hopefully fix intermittent issue with build system sometimes not picking up all config, leading to missing BT/WiFi libs at compile/link time.
* Fix issues with path resolution on Windows (including in Eclipse)
* Add new BATCH_BUILD variable for IDEs and automated build environments.

See merge request !485
This commit is contained in:
Angus Gratton 2017-02-22 10:10:34 +08:00
commit 045307ea0f
13 changed files with 253 additions and 78 deletions

View file

@ -31,6 +31,7 @@ build_template_app:
SDK_PATH: "$CI_PROJECT_DIR" SDK_PATH: "$CI_PROJECT_DIR"
IDF_PATH: "$CI_PROJECT_DIR" IDF_PATH: "$CI_PROJECT_DIR"
GIT_STRATEGY: clone GIT_STRATEGY: clone
BATCH_BUILD: "1"
script: script:
- git clone https://github.com/espressif/esp-idf-template.git - git clone https://github.com/espressif/esp-idf-template.git
@ -39,13 +40,11 @@ build_template_app:
# using on esp-idf. If it doesn't exist then just stick to the default # using on esp-idf. If it doesn't exist then just stick to the default
# branch # branch
- git checkout ${CI_BUILD_REF_NAME} || echo "Using esp-idf-template default branch..." - git checkout ${CI_BUILD_REF_NAME} || echo "Using esp-idf-template default branch..."
- make defconfig
# Test debug build (default) # Test debug build (default)
- make all V=1 - make all V=1
# Now test release build # Now test release build
- make clean - make clean
- sed -i.bak -e's/CONFIG_OPTIMIZATION_LEVEL_DEBUG\=y/CONFIG_OPTIMIZATION_LEVEL_RELEASE=y/' sdkconfig - sed -i.bak -e's/CONFIG_OPTIMIZATION_LEVEL_DEBUG\=y/CONFIG_OPTIMIZATION_LEVEL_RELEASE=y/' sdkconfig
- make defconfig
- make all V=1 - make all V=1
# Check if there are any stray printf/ets_printf references in WiFi libs # Check if there are any stray printf/ets_printf references in WiFi libs
- cd ../components/esp32/lib - cd ../components/esp32/lib
@ -63,6 +62,8 @@ build_template_app:
SDK_PATH: "$CI_PROJECT_DIR" SDK_PATH: "$CI_PROJECT_DIR"
IDF_PATH: "$CI_PROJECT_DIR" IDF_PATH: "$CI_PROJECT_DIR"
GIT_STRATEGY: clone GIT_STRATEGY: clone
BATCH_BUILD: "1"
build_ssc: build_ssc:
<<: *build_template <<: *build_template
@ -103,7 +104,6 @@ build_esp_idf_tests:
script: script:
- cd tools/unit-test-app - cd tools/unit-test-app
- git checkout ${CI_BUILD_REF_NAME} || echo "Using default branch..." - git checkout ${CI_BUILD_REF_NAME} || echo "Using default branch..."
- make defconfig
- make TESTS_ALL=1 - make TESTS_ALL=1
- python UnitTestParser.py - python UnitTestParser.py

View file

@ -0,0 +1,4 @@
# Submodules normally added in component.mk, but fully qualified
# paths can be added at this level (we need binary librtc to be
# available to link bootloader).
COMPONENT_SUBMODULES += $(IDF_PATH)/components/esp32/lib

View file

@ -14,10 +14,10 @@ COMPONENT_ADD_LDFLAGS := -L $(COMPONENT_PATH) -lmain $(addprefix -T ,$(LINKER_SC
COMPONENT_ADD_LINKER_DEPS := $(LINKER_SCRIPTS) COMPONENT_ADD_LINKER_DEPS := $(LINKER_SCRIPTS)
ifdef IS_BOOTLOADER_BUILD
# following lines are a workaround to link librtc into the # following lines are a workaround to link librtc into the
# bootloader, until clock setting code is in a source-based esp-idf # bootloader, until clock setting code is in a source-based esp-idf
# component. See also rtc_printf() in bootloader_start.c # component. See also rtc_printf() in bootloader_start.c
#
# See also matching COMPONENT_SUBMODULES line in Makefile.projbuild
COMPONENT_ADD_LDFLAGS += -L $(IDF_PATH)/components/esp32/lib/ -lrtc_clk -lrtc COMPONENT_ADD_LDFLAGS += -L $(IDF_PATH)/components/esp32/lib/ -lrtc_clk -lrtc
COMPONENT_EXTRA_INCLUDES += $(IDF_PATH)/components/esp32/ COMPONENT_EXTRA_INCLUDES += $(IDF_PATH)/components/esp32/
endif

View file

@ -305,6 +305,17 @@ Second Level: Component Makefiles
To better understand the component make process, have a read through the ``component_wrapper.mk`` file and some of the ``component.mk`` files included with esp-idf. To better understand the component make process, have a read through the ``component_wrapper.mk`` file and some of the ``component.mk`` files included with esp-idf.
Running Make Non-Interactively
------------------------------
When running ``make`` in a situation where you don't want interactive prompts (for example: inside an IDE or an automated build system) append ``BATCH_BUILD=1`` to the make arguments (or set it as an environment variable).
Setting ``BATCH_BUILD`` implies the following:
- Verbose output (same as ``V=1``, see below). If you don't want verbose output, also set ``V=0``.
- If the project configuration is missing new configuration items (from new components or esp-idf updates) then the project use the default values, instead of prompting the user for each item.
- If the build system needs to invoke ``menuconfig``, an error is printed and the build fails.
Debugging The Make Process Debugging The Make Process
-------------------------- --------------------------

View file

@ -0,0 +1,77 @@
Eclipse IDE on Windows
**********************
Configuring Eclipse on Windows requires some different steps. The full configuration steps for Windows are shown below.
(For OS X and Linux instructions, see the :doc:`Eclipse IDE page <eclipse-setup>`.)
Installing Eclipse IDE
======================
Follow the steps under :ref:`Installing Eclipse IDE <eclipse-install-steps>` for all platforms.
.. _eclipse-windows-setup:
Setting up Eclipse on Windows
=============================
Once your new Eclipse installation launches, follow these steps:
Import New Project
------------------
* Eclipse makes use of the Makefile support in ESP-IDF. This means you need to start by creating an ESP-IDF project. You can use the idf-template project from github, or open one of the examples in the esp-idf examples subdirectory.
* Once Eclipse is running, choose File -> Import...
* In the dialog that pops up, choose "C/C++" -> "Existing Code as Makefile Project" and click Next.
* On the next page, enter "Existing Code Location" to be the directory of your IDF project. Don't specify the path to the ESP-IDF directory itself (that comes later). The directory you specify should contain a file named "Makefile" (the project Makefile).
* On the same page, under "Toolchain for Indexer Settings" uncheck "Show only available toolchains that support this platform".
* On the extended list that appears, choose "Cygwin GCC". Then click Finish.
*Note: you may see warnings in the UI that Cygwin GCC Toolchain could not be found. This is OK, we're going to reconfigure Eclipse to find our toolchain.*
Project Properties
------------------
* The new project will appear under Project Explorer. Right-click the project and choose Properties from the context menu.
* Click on the "C/C++ Build" properties page (top-level):
* Uncheck "Use default build command" and enter this for the custom build command: ``python ${IDF_PATH}/tools/windows/eclipse_make.py``.
* Click on the "Environment" properties page under "C/C++ Build":
* Click "Add..." and enter name ``BATCH_BUILD`` and value ``1``.
* Click "Add..." again, and enter name ``IDF_PATH``. The value should be the full path where ESP-IDF is installed. The IDF_PATH directory should be specified using forwards slashes not backslashes, ie *C:/Users/MyUser/Development/esp-idf*.
* Edit the PATH environment variable. Delete the existing value and replace it with ``C:\msys32\usr\bin;C:\msys32\mingw32\bin;C:\msys32\opt\xtensa-esp32-elf\bin`` (If you installed msys32 to a different directory then you'll need to change these paths to match).
* Click on "C/C++ General" -> "Preprocessor Include Paths, Macros,etc." property page:
* Click the "Providers" tab
* In the list of providers, click "CDT GCC Built-in Compiler Settings Cygwin". Under "Command to get compiler specs", replace the text ``${COMMAND}`` at the beginning of the line with ``xtensa-esp32-elf-gcc``. This means the full "Command to get compiler specs" should be ``xtensa-esp32-elf-gcc ${FLAGS} -E -P -v -dD "${INPUTS}"``.
* In the list of providers, click "CDT GCC Build Output Parser" and type ``xtensa-esp32-elf-`` at the beginning of the Compiler command pattern. This means the full Compiler command pattern should be ``xtensa-esp32-elf-(g?cc)|([gc]\+\+)|(clang)``
Building in Eclipse
-------------------
Continue from :ref:`Building in Eclipse <eclipse-build-project>` for all platforms.
Technical Details
=================
**Of interest to Windows gurus or very curious parties, only.**
Explanations of the technical reasons for some of these steps. You don't need to know this in order to use esp-idf with Eclipse on Windows, but it may be helpful background knowledge if you plan to do dig into the Eclipse support:
* The xtensa-esp32-elf-gcc cross-compiler is *not* a Cygwin toolchain, even though we tell Eclipse that it is one. This is because msys2 uses Cygwin and supports Cygwin paths (of the type ``/c/blah`` instead of ``c:/blah`` or ``c:\\blah``). In particular, xtensa-esp32-elf-gcc reports to the Eclipse "built-in compiler settings" function that its built-in include directories are all under ``/usr/``, which is a Unix/Cygwin-style path that Eclipse otherwise can't resolve. By telling Eclipse the compiler is Cygwin, it resolves these paths internally using the ``cygpath`` utility.
* The same problem occurs when parsing make output from esp-idf. Eclipse parses this output to find header directories, but it can't resolve include directories of the form ``/c/blah`` without using ``cygpath``. There is a heuristic that Eclipse Build Output Parser uses to determine whether it should call ``cygpath``, but for currently unknown reasons the esp-idf configuration doesn't trigger it. For this reason the ``eclipse_make.py`` wrapper script is used to call ``make`` and then use ``cygpath`` to process the output for Eclipse.

View file

@ -1,6 +1,8 @@
Build and Flash with Eclipse IDE Build and Flash with Eclipse IDE
******************************** ********************************
.. _eclipse-install-steps:
Installing Eclipse IDE Installing Eclipse IDE
====================== ======================
@ -8,10 +10,17 @@ The Eclipse IDE gives you a graphical integrated development environment for wri
* Start by installing the esp-idf for your platform (see files in this directory with steps for Windows, OS X, Linux). * Start by installing the esp-idf for your platform (see files in this directory with steps for Windows, OS X, Linux).
* We suggest building a project from the command line first, to get a feel for how that process works. You also need to use the command line to configure your esp-idf project (via ``make menuconfig``), this is not currently supported inside Eclipse.
* Download the Eclipse Installer for your platform from eclipse.org_. * Download the Eclipse Installer for your platform from eclipse.org_.
* When running the Eclipse Installer, choose "Eclipse for C/C++ Development" (in other places you'll see this referred to as CDT.) * When running the Eclipse Installer, choose "Eclipse for C/C++ Development" (in other places you'll see this referred to as CDT.)
Windows Users
=============
Using ESP-IDF with Eclipse on Windows requires different configuration steps. :ref:`See the Eclipse IDE on Windows guide <eclipse-windows-setup>`.
Setting up Eclipse Setting up Eclipse
================== ==================
@ -20,13 +29,13 @@ Once your new Eclipse installation launches, follow these steps:
Import New Project Import New Project
------------------ ------------------
* Eclipse makes use of the Makefile support in ESP-IDF. This means you need to start by creating an ESP-IDF project. You can use the skeleton project from github. * Eclipse makes use of the Makefile support in ESP-IDF. This means you need to start by creating an ESP-IDF project. You can use the idf-template project from github, or open one of the examples in the esp-idf examples subdirectory.
* Once Eclipse is running, choose File -> Import... * Once Eclipse is running, choose File -> Import...
* In the dialog that pops up, choose "C/C++" -> "Existing Code as Makefile Project" and click Next. * In the dialog that pops up, choose "C/C++" -> "Existing Code as Makefile Project" and click Next.
* On the next page, enter "Existing Code Location" to be the directory of your IDF project. Don't specify the path to the ESP-IDF directory itself. * On the next page, enter "Existing Code Location" to be the directory of your IDF project. Don't specify the path to the ESP-IDF directory itself (that comes later). The directory you specify should contain a file named "Makefile" (the project Makefile).
* On the same page, under "Toolchain for Indexer Settings" choose "Cross GCC". Then click Finish. * On the same page, under "Toolchain for Indexer Settings" choose "Cross GCC". Then click Finish.
@ -36,15 +45,9 @@ Project Properties
* The new project will appear under Project Explorer. Right-click the project and choose Properties from the context menu. * The new project will appear under Project Explorer. Right-click the project and choose Properties from the context menu.
* Click on the "Environment" properties page under "C/C++ Build". Click "Add..." and enter name ``V`` and value ``1``. * Click on the "Environment" properties page under "C/C++ Build". Click "Add..." and enter name ``BATCH_BUILD`` and value ``1``.
* Click "Add..." again, and enter name ``IDF_PATH``. The value should be the full path where ESP-IDF is installed. *Windows users: Use forward-slashes not backslashes for this path, ie C:/Users/MyUser/Development/esp-idf*. * Click "Add..." again, and enter name ``IDF_PATH``. The value should be the full path where ESP-IDF is installed.
*Windows users only, follow these two additional steps:*
* On the same Environment property page, edit the PATH environment variable. Delete the existing value and replace it with ``C:\msys32\usr\bin;C:\msys32\mingw32\bin;C:\msys32\opt\xtensa-esp32-elf\bin`` (If you installed msys32 to a different directory then you'll need to change these paths to match).
* Click on the "C/C++ Build" top-level properties page then uncheck "Use default build command" and enter this for the custom build command: ``bash ${IDF_PATH}/tools/windows/eclipse_make.sh``.
*All users, continue with these steps:* *All users, continue with these steps:*
@ -56,7 +59,22 @@ Navigate to "C/C++ General" -> "Preprocessor Include Paths" property page:
* In the list of providers, click "CDT GCC Build Output Parser" and type ``xtensa-esp32-elf-`` at the beginning of the Compiler command pattern. This means the full Compiler command pattern should be ``xtensa-esp32-elf-(g?cc)|([gc]\+\+)|(clang)`` * In the list of providers, click "CDT GCC Build Output Parser" and type ``xtensa-esp32-elf-`` at the beginning of the Compiler command pattern. This means the full Compiler command pattern should be ``xtensa-esp32-elf-(g?cc)|([gc]\+\+)|(clang)``
* Click OK to close the Properties dialog, and choose Project -> Build to build your project. .. _eclipse-build-project:
Building in Eclipse
-------------------
Before your project is first built, Eclipse may show a lot of errors and warnings about undefined values. This is because some source files are automatically generated as part of the esp-idf build process. These errors and warnings will go away after you build the project.
* Click OK to close the Properties dialog in Eclipse.
* Outside Eclipse, open a command line prompt. Navigate to your project directory, and run ``make menuconfig`` to configure your project's esp-idf settings. This step currently has to be run outside Eclipse.
*If you try to build without running a configuration step first, esp-idf will prompt for configuration on the command line - but Eclipse is not able to deal with this, so the build will hang or fail.*
* Back in Eclipse, choose Project -> Build to build your project.
**TIP**: If your project had already been built outside Eclipse, you may need to do a Project -> Clean before chosing Project -> Build. This is so Eclipse can see the compiler arguments for all source files. It uses these to determine the header include paths.
Flash from Eclipse Flash from Eclipse
------------------ ------------------
@ -77,7 +95,3 @@ Follow the same steps to add ``bootloader`` and ``partition_table`` targets, if
.. _eclipse.org: http://www.eclipse.org/ .. _eclipse.org: http://www.eclipse.org/
Eclipse Troubleshooting
-----------------------
* ``*** Make was invoked from ... However please do not run make from the sdk or a component directory; ...`` - Eclipse will detect any directory with a Makefile in it as being a possible directory to run "make" in. All component directories also contain a Makefile (the wrong one), so it is important when using Project -> Make Target to always select the top-level project directory in Project Explorer.

View file

@ -9,6 +9,9 @@
# #
[ -z ${IDF_PATH} ] && echo "IDF_PATH is not set" && exit 1 [ -z ${IDF_PATH} ] && echo "IDF_PATH is not set" && exit 1
export BATCH_BUILD=1
export V=0 # only build verbose if there's an error
EXAMPLE_NUM=1 EXAMPLE_NUM=1
RESULT=0 RESULT=0
FAILED_EXAMPLES="" FAILED_EXAMPLES=""
@ -36,7 +39,7 @@ for category in ${IDF_PATH}/examples/*; do
set -e set -e
make clean defconfig make clean defconfig
make $* all 2>&1 | tee $BUILDLOG make $* all 2>&1 | tee $BUILDLOG
) || { RESULT=$?; FAILED_EXAMPLES+=" ${example}"; make V=1; } # only build verbose if there's an error ) || { RESULT=$?; FAILED_EXAMPLES+=" ${example}"; make V=1; } # verbose output for errors
popd popd
EXAMPLE_NUM=$(( $EXAMPLE_NUM + 1 )) EXAMPLE_NUM=$(( $EXAMPLE_NUM + 1 ))

View file

@ -7,9 +7,14 @@
# (Note that we only rebuild this makefile automatically for some # (Note that we only rebuild this makefile automatically for some
# targets, see project_config.mk for details.) # targets, see project_config.mk for details.)
SDKCONFIG_MAKEFILE ?= $(abspath $(BUILD_DIR_BASE)/include/config/auto.conf) SDKCONFIG_MAKEFILE ?= $(abspath $(BUILD_DIR_BASE)/include/config/auto.conf)
-include $(SDKCONFIG_MAKEFILE) include $(SDKCONFIG_MAKEFILE)
export SDKCONFIG_MAKEFILE # sub-makes (like bootloader) will reuse this path export SDKCONFIG_MAKEFILE # sub-makes (like bootloader) will reuse this path
# BATCH_BUILD flag disables interactive terminal features, defaults to verbose build
ifdef BATCH_BUILD
V ?= 1
endif
#Handling of V=1/VERBOSE=1 flag #Handling of V=1/VERBOSE=1 flag
# #
# if V=1, $(summary) does nothing and $(details) will echo extra details # if V=1, $(summary) does nothing and $(details) will echo extra details

View file

@ -49,14 +49,23 @@ endif
# make IDF_PATH a "real" absolute path # make IDF_PATH a "real" absolute path
# * works around the case where a shell character is embedded in the environment variable value. # * works around the case where a shell character is embedded in the environment variable value.
# * changes Windows-style C:/blah/ paths to MSYS/Cygwin style /c/blah # * changes Windows-style C:/blah/ paths to MSYS/Cygwin style /c/blah
export IDF_PATH:=$(realpath $(wildcard $(IDF_PATH))) ifeq ("$(OS)","Windows_NT")
# On Windows MSYS2, make wildcard function returns empty string for paths of form /xyz
# where /xyz is a directory inside the MSYS root - so we don't use it.
SANITISED_IDF_PATH:=$(realpath $(IDF_PATH))
else
SANITISED_IDF_PATH:=$(realpath $(wildcard $(IDF_PATH)))
endif
export IDF_PATH := $(SANITISED_IDF_PATH)
ifndef IDF_PATH ifndef IDF_PATH
$(error IDF_PATH variable is not set to a valid directory.) $(error IDF_PATH variable is not set to a valid directory.)
endif endif
ifneq ("$(IDF_PATH)","$(realpath $(wildcard $(IDF_PATH)))") ifneq ("$(IDF_PATH)","$(SANITISED_IDF_PATH)")
# due to the way make manages variables, this is hard to account for # implies IDF_PATH was overriden on make command line.
# Due to the way make manages variables, this is hard to account for
# #
# if you see this error, do the shell expansion in the shell ie # if you see this error, do the shell expansion in the shell ie
# make IDF_PATH=~/blah not make IDF_PATH="~/blah" # make IDF_PATH=~/blah not make IDF_PATH="~/blah"
@ -370,12 +379,7 @@ $(BUILD_DIR_BASE)/$(2)/lib$(2).a: $(2)-build
# If any component_project_vars.mk file is out of date, the make # If any component_project_vars.mk file is out of date, the make
# process will call this target to rebuild it and then restart. # process will call this target to rebuild it and then restart.
# #
# Note: $(SDKCONFIG) is a normal prereq as we need to rebuild these $(BUILD_DIR_BASE)/$(2)/component_project_vars.mk: $(1)/component.mk $(COMMON_MAKEFILES) $(SDKCONFIG_MAKEFILE) | $(BUILD_DIR_BASE)/$(2)
# files whenever the config changes. $(SDKCONFIG_MAKEFILE) is an
# order-only prereq because if it hasn't been rebuilt, we need to
# build it first - but including it as a normal prereq can lead to
# infinite restarts as the conf process will keep updating it.
$(BUILD_DIR_BASE)/$(2)/component_project_vars.mk: $(1)/component.mk $(COMMON_MAKEFILES) $(SDKCONFIG) | $(BUILD_DIR_BASE)/$(2) $(SDKCONFIG_MAKEFILE)
$(call ComponentMake,$(1),$(2)) component_project_vars.mk $(call ComponentMake,$(1),$(2)) component_project_vars.mk
endef endef

View file

@ -20,59 +20,77 @@ $(KCONFIG_TOOL_DIR)/mconf $(KCONFIG_TOOL_DIR)/conf:
MAKEFLAGS=$(ORIGINAL_MAKEFLAGS) CC=$(HOSTCC) LD=$(HOSTLD) \ MAKEFLAGS=$(ORIGINAL_MAKEFLAGS) CC=$(HOSTCC) LD=$(HOSTLD) \
$(MAKE) -C $(KCONFIG_TOOL_DIR) $(MAKE) -C $(KCONFIG_TOOL_DIR)
# use a wrapper environment for where we run Kconfig tools
KCONFIG_TOOL_ENV=KCONFIG_AUTOHEADER=$(abspath $(BUILD_DIR_BASE)/include/sdkconfig.h) \
COMPONENT_KCONFIGS="$(COMPONENT_KCONFIGS)" KCONFIG_CONFIG=$(SDKCONFIG) \
COMPONENT_KCONFIGS_PROJBUILD="$(COMPONENT_KCONFIGS_PROJBUILD)"
menuconfig: $(KCONFIG_TOOL_DIR)/mconf $(IDF_PATH)/Kconfig $(call prereq_if_explicit,defconfig)
$(summary) MENUCONFIG
$(KCONFIG_TOOL_ENV) $(KCONFIG_TOOL_DIR)/mconf $(IDF_PATH)/Kconfig
ifeq ("$(wildcard $(SDKCONFIG))","") ifeq ("$(wildcard $(SDKCONFIG))","")
ifeq ("$(call prereq_if_explicit,defconfig)","") ifeq ("$(filter defconfig, $(MAKECMDGOALS))","")
# if not configuration is present and defconfig is not a target, run defconfig then menuconfig # if no configuration file is present and defconfig is not a named
$(SDKCONFIG): defconfig menuconfig # target, run defconfig then menuconfig to get the initial config
$(SDKCONFIG): menuconfig
menuconfig: defconfig
else else
# otherwise, just defconfig # otherwise, just run defconfig
$(SDKCONFIG): defconfig $(SDKCONFIG): defconfig
endif endif
endif endif
# macro for the commands to run kconfig tools conf or mconf.
# $1 is the name (& args) of the conf tool to run
define RunConf
mkdir -p $(BUILD_DIR_BASE)/include/config
cd $(BUILD_DIR_BASE); KCONFIG_AUTOHEADER=$(abspath $(BUILD_DIR_BASE)/include/sdkconfig.h) \
COMPONENT_KCONFIGS="$(COMPONENT_KCONFIGS)" KCONFIG_CONFIG=$(SDKCONFIG) \
COMPONENT_KCONFIGS_PROJBUILD="$(COMPONENT_KCONFIGS_PROJBUILD)" \
$(KCONFIG_TOOL_DIR)/$1 $(IDF_PATH)/Kconfig
endef
ifeq ("$(MAKE_RESTARTS)","")
# menuconfig, defconfig and "GENCONFIG" configuration generation only
# ever run on the first make pass, subsequent passes don't run these
# (make often wants to re-run them as the conf tool can regenerate the
# sdkconfig input file as an output file, but this is not what the
# user wants - a single config pass is enough to produce all output
# files.)
#
# To prevent problems missing genconfig, ensure none of these targets
# depend on any prerequisite that may cause a make restart as part of
# the prerequisite's own recipe.
menuconfig: $(KCONFIG_TOOL_DIR)/mconf
$(summary) MENUCONFIG
ifdef BATCH_BUILD
@echo "Can't run interactive configuration inside non-interactive build process."
@echo ""
@echo "Open a command line terminal and run 'make menuconfig' from there."
@echo "See esp-idf documentation for more details."
@exit 1
else
$(call RunConf,mconf)
endif
# defconfig creates a default config, based on SDKCONFIG_DEFAULTS if present # defconfig creates a default config, based on SDKCONFIG_DEFAULTS if present
defconfig: $(KCONFIG_TOOL_DIR)/mconf $(IDF_PATH)/Kconfig $(BUILD_DIR_BASE) defconfig: $(KCONFIG_TOOL_DIR)/conf
$(summary) DEFCONFIG $(summary) DEFCONFIG
ifneq ("$(wildcard $(SDKCONFIG_DEFAULTS))","") ifneq ("$(wildcard $(SDKCONFIG_DEFAULTS))","")
cat $(SDKCONFIG_DEFAULTS) >> $(SDKCONFIG) # append defaults to sdkconfig, will override existing values cat $(SDKCONFIG_DEFAULTS) >> $(SDKCONFIG) # append defaults to sdkconfig, will override existing values
endif endif
mkdir -p $(BUILD_DIR_BASE)/include/config $(call RunConf,conf --olddefconfig)
$(KCONFIG_TOOL_ENV) $(KCONFIG_TOOL_DIR)/conf --olddefconfig $(IDF_PATH)/Kconfig
# Work out of whether we have to build the Kconfig makefile # if neither defconfig or menuconfig are requested, use the GENCONFIG rule to
# (auto.conf), or if we're in a situation where we don't need it # ensure generated config files are up to date
NON_CONFIG_TARGETS := clean %-clean help menuconfig defconfig $(SDKCONFIG_MAKEFILE) $(BUILD_DIR_BASE)/include/sdkconfig.h: $(KCONFIG_TOOL_DIR)/conf $(SDKCONFIG) $(COMPONENT_KCONFIGS) $(COMPONENT_KCONFIGS_PROJBUILD) | $(call prereq_if_explicit,defconfig) $(call prereq_if_explicit,menuconfig)
AUTO_CONF_REGEN_TARGET := $(SDKCONFIG_MAKEFILE)
# disable AUTO_CONF_REGEN_TARGET if all targets are non-config targets
# (and not building default target)
ifneq ("$(MAKECMDGOALS)","")
ifeq ($(filter $(NON_CONFIG_TARGETS), $(MAKECMDGOALS)),$(MAKECMDGOALS))
AUTO_CONF_REGEN_TARGET :=
# dummy target
$(SDKCONFIG_MAKEFILE):
endif
endif
$(AUTO_CONF_REGEN_TARGET) $(BUILD_DIR_BASE)/include/sdkconfig.h: $(SDKCONFIG) $(KCONFIG_TOOL_DIR)/conf $(COMPONENT_KCONFIGS) $(COMPONENT_KCONFIGS_PROJBUILD)
$(summary) GENCONFIG $(summary) GENCONFIG
mkdir -p $(BUILD_DIR_BASE)/include/config ifdef BATCH_BUILD # can't prompt for new config values like on terminal
cd $(BUILD_DIR_BASE); $(KCONFIG_TOOL_ENV) $(KCONFIG_TOOL_DIR)/conf --silentoldconfig $(IDF_PATH)/Kconfig $(call RunConf,conf --olddefconfig)
touch $(AUTO_CONF_REGEN_TARGET) $(BUILD_DIR_BASE)/include/sdkconfig.h endif
# touch to ensure both output files are newer - as 'conf' can also update sdkconfig (a dependency). Without this, $(call RunConf,conf --silentoldconfig)
# sometimes you can get an infinite make loop on Windows where sdkconfig always gets regenerated newer touch $(SDKCONFIG_MAKEFILE) $(BUILD_DIR_BASE)/include/sdkconfig.h # ensure newer than sdkconfig
# than the target(!)
.PHONY: config-clean else # "$(MAKE_RESTARTS)" != ""
# on subsequent make passes, skip config generation entirely
defconfig:
menuconfig:
endif
.PHONY: config-clean defconfig menuconfig
config-clean: config-clean:
$(summary RM CONFIG) $(summary RM CONFIG)
$(MAKE) -C $(KCONFIG_TOOL_DIR) clean $(MAKE) -C $(KCONFIG_TOOL_DIR) clean

View file

@ -20,3 +20,11 @@ nconf
qconf qconf
gconf gconf
kxgettext kxgettext
# configuration programs, Windows
conf.exe
mconf.exe
nconf.exe
qconf.exe
gconf.exe
kxgettext.exe

View file

@ -0,0 +1,36 @@
#!/usr/bin/env python
#
# Wrapper to run make and preprocess any paths in the output from MSYS/Cygwin paths
# to Windows paths, for Eclipse
from __future__ import print_function, division
import sys, subprocess, os.path, re
UNIX_PATH_RE = re.compile(r'(/[^ \'"]+)+')
paths = {}
def check_path(path):
try:
return paths[path]
except KeyError:
pass
paths[path] = path # cache as failed, replace with success if it works
try:
winpath = subprocess.check_output(["cygpath", "-w", path]).strip()
except subprocess.CalledProcessError:
return path # something went wrong running cygpath, assume this is not a path!
if not os.path.exists(winpath):
return path # not actually a valid path
winpath = winpath.replace("\\", "/") # make consistent with forward-slashes used elsewhere
paths[path] = winpath
return winpath
def main():
print("Running make in '%s'" % check_path(os.getcwd()))
make = subprocess.Popen(["make"] + sys.argv[1:] + ["BATCH_BUILD=1"], stdout=subprocess.PIPE)
for line in iter(make.stdout.readline, ''):
line = re.sub(UNIX_PATH_RE, lambda m: check_path(m.group(0)), line)
print(line.rstrip())
sys.exit(make.wait())
if __name__ == "__main__":
main()

View file

@ -1,9 +1,4 @@
#!/bin/bash #!/bin/bash
# A wrapper for make on Windows with Eclipse echo "eclipse_make.sh has been replaced with eclipse_make.py. Check the Windows Eclipse docs for the new command."
# echo "This shell script will continue to work until the next major release."
# Eclipse's output parser expects to see output of the form C:/dir/dir/file but our Make python ${IDF_PATH}/tools/windows/eclipse_make.py $@
# process uses MinGW paths of the form /c/dir/dir/file. So parse these out...
#
# (regexp deliberate only matches after a space character to try and avoid false-positives.)
echo "Running make in $(pwd)"
make $@ V=1 | sed -E "s@ /([a-z])/(.+)/@ \1:/\2/@g" | sed -E "s@-I/([a-z])/(.+)/@-I\1:/\2/@g" | sed -E "s@-L/([a-z])/(.+)/@-L\1:/\2/@g"