From 9c8af9adc9a60c8ff5487232656c4e3ec603721c Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Mon, 11 Oct 2021 04:03:12 -0400 Subject: add Makefile target "init" to pull in dependencies --- Makefile | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index faa38e0..507f95d 100644 --- a/Makefile +++ b/Makefile @@ -23,16 +23,33 @@ PROGNAME = mush -FQBN = esp8266:esp8266:espmxdevkit +CORE = esp8266:esp8266 + +FQBN = $(CORE):espmxdevkit MDNS_NAME = $(PROGNAME) OTA_PORT = 8266 OTA_PASS = -SERIAL_DEV = $(firstword $(wildcard /dev/ttyUSB* /dev/ttyACM*)) +.DEFAULT_GOAL = all -cli = arduino-cli -b "$(FQBN)" +init: + [ -e /home/d/.arduino15/arduino-cli.yaml ] || arduino-cli config init + arduino-cli config set board_manager.additional_urls https://arduino.esp8266.com/stable/package_esp8266com_index.json + arduino-cli core update-index + arduino-cli core install $(CORE) + arduino-cli lib update-index + arduino-cli lib install 'DHT sensor library' +SERIAL_DEV = $(firstword $(wildcard /dev/ttyUSB* /dev/ttyACM*)) + +ifneq (,$(wildcard init)) BUILD_DIR != $(cli) compile --show-properties | sed -ne 's/^build.path=//p' +PLAT_PATH != $(cli) compile --show-properties | sed -ne 's/^runtime.platform.path=//p' +PY_PATH != $(cli) compile --show-properties | sed -ne 's/^runtime.tools.python3.path=//p' +MDNS_IP != getent ahostsv4 $(MDNS_NAME).local | (read ip _; echo $$ip) +endif + +cli = arduino-cli -b "$(FQBN)" SRC := CCS811.cpp $(PROGNAME).ino HDRS := CCS811.h ota.h wifiinfo.h @@ -51,10 +68,6 @@ $(BIN) $(ELF): $(SRC) $(HDRS) upload: $(ELF) $(cli) upload -p "$(SERIAL_DEV)" -PLAT_PATH != $(cli) compile --show-properties | sed -ne 's/^runtime.platform.path=//p' -PY_PATH != $(cli) compile --show-properties | sed -ne 's/^runtime.tools.python3.path=//p' -MDNS_IP != getent ahostsv4 $(MDNS_NAME).local | (read ip _; echo $$ip) - ota: $(BIN) [ "$(MDNS_IP)" ] "$(PY_PATH)/python3" "$(PLAT_PATH)/tools/espota.py" -i "$(MDNS_IP)" -p "$(OTA_PORT)" --auth="$(OTA_PASS)" -f "$(BIN)" -- cgit v1.2.3