summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2019-12-17 13:01:41 -0500
committerEugeniy E. Mikhailov <evgmik@gmail.com>2019-12-17 13:01:41 -0500
commit3c4207c4aa55644c35600d7bdc2fcbba2b757824 (patch)
tree1f3e14d952bdb8c7bd51c7b2cfee46520bbcd820 /Makefile
downloadnodeMCU_rf_source_lmx2487-3c4207c4aa55644c35600d7bdc2fcbba2b757824.tar.gz
nodeMCU_rf_source_lmx2487-3c4207c4aa55644c35600d7bdc2fcbba2b757824.zip
init
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile75
1 files changed, 75 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..5dcd4f6
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,75 @@
+# -*- make -*-
+# (C) 2016 by Eugeniy Mikhailov, <evgmik@gmail.com>
+
+include ./local.mk
+
+# this file is a bit complex since it tries to be general enough to use
+# either luatool or nodemcu-uploader
+# you have a choice
+
+ifeq ($(UPLOAD_TOOL), nodemcu-uploader)
+offline_upload_cmd = python $(NODEMCU-UPLOADER) --baud $(BAUD_RATE) --port $(PORT) --start_baud $(START_BAUD_RATE)
+online_upload_cmd = $(offline_upload_cmd)
+else
+offline_upload_cmd = $(LUATOOL) -b $(BAUD_RATE) --port $(PORT)
+online_upload_cmd = $(LUATOOL) --ip $(IP)
+endif
+
+
+# luatool support work via telnet
+ifeq ($(UPLOAD_TYPE),online)
+upload_cmd = $(online_upload_cmd)
+term_cmd = echo not sure how to do online terminal
+else
+upload_cmd = $(offline_upload_cmd)
+term_cmd = miniterm.py -b $(BAUD_RATE) --port $(PORT)
+endif
+
+
+UPLOAD_STAMPS = .upload_stamps
+
+lua_files = $(wildcard *.lua)
+httpserver_lua_files = $(wildcard nodemcu-httpserver/httpserver*.lua)
+html_files = $(wildcard http/*)
+
+lua_files_upload_stamps = $(lua_files:%=$(UPLOAD_STAMPS)/%.uploaded)
+httpserver_files_upload_stamps = $(httpserver_lua_files:%=$(UPLOAD_STAMPS)/%.uploaded)
+html_files_upload_stamps = $(html_files:%=$(UPLOAD_STAMPS)/%.uploaded)
+
+upload: $(UPLOAD_STAMPS) $(html_files_upload_stamps) $(lua_files_upload_stamps) $(httpserver_files_upload_stamps)
+
+$(UPLOAD_STAMPS):
+ mkdir -p $(UPLOAD_STAMPS)
+ mkdir -p $(UPLOAD_STAMPS)/http
+ mkdir -p $(UPLOAD_STAMPS)/nodemcu-httpserver
+
+$(lua_files_upload_stamps): $(UPLOAD_STAMPS)/%.uploaded : %
+ifeq ($(UPLOAD_TOOL), nodemcu-uploader)
+ ($(upload_cmd) upload $(<)) && touch $@
+else
+ ($(upload_cmd) --src $<) && touch $@
+endif
+
+$(httpserver_files_upload_stamps): $(UPLOAD_STAMPS)/%.uploaded : %
+ifeq ($(UPLOAD_TOOL), nodemcu-uploader)
+ ($(upload_cmd) upload $(<):$(<:nodemcu-httpserver/%=%)) && touch $@
+else
+ ($(upload_cmd) --src $< --dest $(<:nodemcu-httpserver/%=%)) && touch $@
+endif
+
+
+$(html_files_upload_stamps): $(UPLOAD_STAMPS)/%.uploaded : %
+ifeq ($(UPLOAD_TOOL), nodemcu-uploader)
+ ($(upload_cmd) upload $(<)) && touch $@
+else
+ ($(upload_cmd) --src $< --dest $<) && touch $@
+endif
+
+
+term:
+ $(term_cmd)
+
+clean:
+ rm -rf $(UPLOAD_STAMPS)
+
+.PHONY: upload clean term