From 3c4207c4aa55644c35600d7bdc2fcbba2b757824 Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Tue, 17 Dec 2019 13:01:41 -0500 Subject: init --- Makefile | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 Makefile (limited to 'Makefile') 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, + +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 -- cgit v1.2.3