2020-01-05 08:26:18 +01:00
# -*- coding: utf-8, tab-width: 2 -*-
2016-09-16 10:10:18 +02:00
# If we haven't got IDF_PATH set already, reinvoke with IDF_PATH in the environ
.NOTPARALLEL :
i f e q ( $( IDF_PATH ) , )
THIS_MK_FILE := $( notdir $( lastword $( MAKEFILE_LIST) ) )
THIS_DIR := $( abspath $( dir $( lastword $( MAKEFILE_LIST) ) ) )
IDF_PATH = $( THIS_DIR) /sdk/esp32-esp-idf
2019-04-22 14:45:27 +02:00
2019-08-01 21:29:16 +02:00
TOOLCHAIN_VERSION := 20181106.1
2019-04-22 14:45:27 +02:00
PLATFORM := linux-x86_64
ESP32_BIN := $( THIS_DIR) /tools/toolchains/esp32-$( PLATFORM) -$( TOOLCHAIN_VERSION) /bin
ESP32_GCC := $( ESP32_BIN) /xtensa-esp32-elf-gcc
ESP32_TOOLCHAIN_DL := $( THIS_DIR) /cache/toolchain-esp32-$( PLATFORM) -$( TOOLCHAIN_VERSION) .tar.xz
all : | $( ESP 32_GCC )
% : | $( ESP 32_GCC )
2016-09-16 10:10:18 +02:00
@echo Setting IDF_PATH and re-invoking...
2019-04-22 14:45:27 +02:00
@env IDF_PATH = $( IDF_PATH) PATH = $( PATH) :$( ESP32_BIN) $( MAKE) -f $( THIS_MK_FILE) $@
@if test " $@ " = "clean" ; then rm -rf $( THIS_DIR) /tools/toolchains/esp32-*; fi
2020-01-05 08:26:18 +01:00
install_toolchain : $( ESP 32_GCC )
2019-04-22 14:45:27 +02:00
$(ESP32_GCC) : $( ESP 32_TOOLCHAIN_DL )
@echo Uncompressing toolchain
@mkdir -p $( THIS_DIR) /tools/toolchains/
@tar -xJf $< -C $( THIS_DIR) /tools/toolchains/
# the archive contains ro files
@chmod -R u+w $( THIS_DIR) /tools/toolchains/esp32-*
@touch $@
2020-01-05 08:26:18 +01:00
download_toolchain : $( ESP 32_TOOLCHAIN_DL )
2019-04-22 14:45:27 +02:00
$(ESP32_TOOLCHAIN_DL) :
@mkdir -p $( THIS_DIR) /cache
wget --tries= 10 --timeout= 15 --waitretry= 30 --read-timeout= 20 --retry-connrefused https://github.com/jmattsson/esp-toolchains/releases/download/$( PLATFORM) -$( TOOLCHAIN_VERSION) /toolchain-esp32-$( PLATFORM) -$( TOOLCHAIN_VERSION) .tar.xz -O $@ || { rm -f " $@ " ; exit 1; }
2016-09-16 10:10:18 +02:00
e l s e
PROJECT_NAME := NodeMCU
# This is, sadly, the cleanest way to resolve the different non-standard
# conventions for sized integers across the various components.
BASIC_TYPES = -Du32_t= uint32_t -Du16_t= uint16_t -Du8_t= uint8_t -Ds32_t= int32_t -Ds16_t= int16_t -Duint32= uint32_t -Duint16= uint16_t -Duint8= uint8_t -Dsint32= int32_t -Dsint16= int16_t -Dsint8= int8_t
2020-01-05 08:26:18 +01:00
$(IDF_PATH)/make/project.mk :
@echo "ESP-IDF isn't properly installed, will try to re-install and then re-run make:"
git submodule init
git submodule update --recursive
python -m pip install --user --requirement $( IDF_PATH) /requirements.txt || echo "W: pip failed, but this might be harmless. Let's just try whether it works anyway." >& 2
# If we'd just continue, make would fake-succeed albeit with a warning
# "make[1]: *** No rule to make target `menuconfig'. Stop."
# $(MAKE) -f $(THIS_MK_FILE) $@ || exit $?
2016-09-16 10:10:18 +02:00
i n c l u d e $( IDF_PATH ) / m a k e / p r o j e c t . m k
# Ensure these overrides are always used
2016-09-26 10:04:24 +02:00
CC := $( CC) $( BASIC_TYPES) -D__ESP32__ $( MORE_CFLAGS)
2016-09-16 10:10:18 +02:00
e n d i f