aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorkartofen <mladenovnasko0@gmail.com>2023-12-25 01:45:05 +0200
committerkartofen <mladenovnasko0@gmail.com>2023-12-25 01:45:05 +0200
commit4b0fdca8673c76cb2305db301a3b36e9e3822e02 (patch)
treebbcf1c6364baba0afe9a2a595f4a579ad0946188 /Makefile
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile35
1 files changed, 35 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..be34b04
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,35 @@
+PORT ?= ttyUSB0
+
+ifeq ($(origin IDF_PATH),undefined)
+IDF_ENV=0
+else
+IDF_ENV=1
+endif
+
+all: kociemba master slave
+
+kociemba slave:
+ $(MAKE) -C $(shell pwd)/$@ all PROD=1
+
+master:
+ifeq ($(IDF_ENV), 1)
+ cd $(shell pwd)/$@ && PATH=$(PATH) idf.py build
+else
+ @echo "FAILED: ESP-IDF export script is not sourced!"
+ @echo -e "\t(use 'source <esp-idf path>/export.sh')"
+ @exit 1
+endif
+
+run: kociemba slave master
+ifeq ($(FLASH),1)
+ifeq ($(IDF_ENV),1)
+ cd $(shell pwd)/master && idf.py flash -p $(PORT)
+else
+ @echo "FAILED: FLASH is set to 1 but ESP-IDS export script is not sourced!"
+ @exit 1
+endif
+endif
+ $(MAKE) -C $(shell pwd)/kociemba run
+
+
+.PHONY: all kociemba slave master run