From fffba81bd3f4c2760384cba38946703aa88ecfe8 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Fri, 19 Aug 2016 14:20:28 +0800 Subject: [PATCH] Make: Add some "magic" to try and pull git submodules if missing --- components/esp32/Makefile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/components/esp32/Makefile b/components/esp32/Makefile index db3772c35..5ef93f4ed 100644 --- a/components/esp32/Makefile +++ b/components/esp32/Makefile @@ -18,3 +18,20 @@ COMPONENT_ADD_LDFLAGS := -lesp32 \ -T eagle.fpga32.rom.addr.v7.ld include $(SDK_PATH)/make/component.mk + +ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS)) + +# The binary libraries are in a git submodule, so this target will +# be invoked if any modules are missing (probably because +# git submodule update --init needs to be run). +$(ALL_LIB_FILES): + $(Q) [ -d ${SDK_PATH}/.git ] || ( @echo "ERROR: Missing libraries in esp32 component. esp-idf must be cloned from git to work."; exit 1 ) + $(Q) [ -x $(which git) ] || ( @echo "ERROR: Missing libraries in esp32 component. Need to run 'git submodule update --init' in esp-idf root directory."; exit 1 ) + @echo "Warning: Missing libraries in components/esp32/lib/ submodule. Going to try running 'git submodule update --init' in esp-idf root directory..." + cd ${SDK_PATH} && git submodule update --init + +# adding $(ALL_LIB_FILES) as a build dependency here is a hack to make +# sure they get evaluated. Once TW6630 lands and we have library file +# dependencies available at the project level, we can probably lose +# this. +build: $(ALL_LIB_FILES)