summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2021-10-11 04:03:12 -0400
committerAndrew Cady <d@jerkface.net>2021-10-11 04:03:12 -0400
commit9c8af9adc9a60c8ff5487232656c4e3ec603721c (patch)
treefac8191cfc579e34fe7c0f230b004478dfe137e3
parentbc6f738e2d8db836b1ca0559701f18ffb425a106 (diff)
add Makefile target "init" to pull in dependencies
-rw-r--r--Makefile27
1 files changed, 20 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index faa38e0..507f95d 100644
--- a/Makefile
+++ b/Makefile
@@ -23,16 +23,33 @@
23 23
24PROGNAME = mush 24PROGNAME = mush
25 25
26FQBN = esp8266:esp8266:espmxdevkit 26CORE = esp8266:esp8266
27
28FQBN = $(CORE):espmxdevkit
27MDNS_NAME = $(PROGNAME) 29MDNS_NAME = $(PROGNAME)
28OTA_PORT = 8266 30OTA_PORT = 8266
29OTA_PASS = 31OTA_PASS =
30 32
31SERIAL_DEV = $(firstword $(wildcard /dev/ttyUSB* /dev/ttyACM*)) 33.DEFAULT_GOAL = all
32 34
33cli = arduino-cli -b "$(FQBN)" 35init:
36 [ -e /home/d/.arduino15/arduino-cli.yaml ] || arduino-cli config init
37 arduino-cli config set board_manager.additional_urls https://arduino.esp8266.com/stable/package_esp8266com_index.json
38 arduino-cli core update-index
39 arduino-cli core install $(CORE)
40 arduino-cli lib update-index
41 arduino-cli lib install 'DHT sensor library'
34 42
43SERIAL_DEV = $(firstword $(wildcard /dev/ttyUSB* /dev/ttyACM*))
44
45ifneq (,$(wildcard init))
35BUILD_DIR != $(cli) compile --show-properties | sed -ne 's/^build.path=//p' 46BUILD_DIR != $(cli) compile --show-properties | sed -ne 's/^build.path=//p'
47PLAT_PATH != $(cli) compile --show-properties | sed -ne 's/^runtime.platform.path=//p'
48PY_PATH != $(cli) compile --show-properties | sed -ne 's/^runtime.tools.python3.path=//p'
49MDNS_IP != getent ahostsv4 $(MDNS_NAME).local | (read ip _; echo $$ip)
50endif
51
52cli = arduino-cli -b "$(FQBN)"
36 53
37SRC := CCS811.cpp $(PROGNAME).ino 54SRC := CCS811.cpp $(PROGNAME).ino
38HDRS := CCS811.h ota.h wifiinfo.h 55HDRS := CCS811.h ota.h wifiinfo.h
@@ -51,10 +68,6 @@ $(BIN) $(ELF): $(SRC) $(HDRS)
51upload: $(ELF) 68upload: $(ELF)
52 $(cli) upload -p "$(SERIAL_DEV)" 69 $(cli) upload -p "$(SERIAL_DEV)"
53 70
54PLAT_PATH != $(cli) compile --show-properties | sed -ne 's/^runtime.platform.path=//p'
55PY_PATH != $(cli) compile --show-properties | sed -ne 's/^runtime.tools.python3.path=//p'
56MDNS_IP != getent ahostsv4 $(MDNS_NAME).local | (read ip _; echo $$ip)
57
58ota: $(BIN) 71ota: $(BIN)
59 [ "$(MDNS_IP)" ] 72 [ "$(MDNS_IP)" ]
60 "$(PY_PATH)/python3" "$(PLAT_PATH)/tools/espota.py" -i "$(MDNS_IP)" -p "$(OTA_PORT)" --auth="$(OTA_PASS)" -f "$(BIN)" 73 "$(PY_PATH)/python3" "$(PLAT_PATH)/tools/espota.py" -i "$(MDNS_IP)" -p "$(OTA_PORT)" --auth="$(OTA_PASS)" -f "$(BIN)"