Makefile 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. ######################################################################
  2. # User configuration
  3. ######################################################################
  4. # Path to nodemcu-uploader (https://github.com/kmpm/nodemcu-uploader)
  5. NODEMCU-UPLOADER=../nodemcu-uploader/nodemcu-uploader.py
  6. # Serial port
  7. PORT=/dev/ttyUSB0
  8. SPEED=9600
  9. ######################################################################
  10. # End of user config
  11. ######################################################################
  12. HTTP_FILES := $(wildcard http/*)
  13. LUA_FILES := init.lua httpserver.lua httpserver-request.lua httpserver-basicauth.lua httpserver-conf.lua httpserver-static.lua httpserver-header.lua httpserver-error.lua
  14. # Print usage
  15. usage:
  16. @echo "make upload FILE:=<file> to upload a specific file (i.e make upload FILE:=init.lua)"
  17. @echo "make upload_http to upload files to be served"
  18. @echo "make upload_server to upload the server code and init.lua"
  19. @echo "make upload_all to upload all"
  20. @echo $(TEST)
  21. # Upload one files only
  22. upload:
  23. @$(NODEMCU-UPLOADER) -b $(SPEED) -p $(PORT) upload $(FILE)
  24. # Upload HTTP files only
  25. upload_http: $(HTTP_FILES)
  26. @$(NODEMCU-UPLOADER) -b $(SPEED) -p $(PORT) upload $(foreach f, $^, $(f))
  27. # Upload httpserver lua files (init and server module)
  28. upload_server: $(LUA_FILES)
  29. @$(NODEMCU-UPLOADER) -b $(SPEED) -p $(PORT) upload $(foreach f, $^, $(f))
  30. # Upload all
  31. upload_all: $(LUA_FILES) $(HTTP_FILES)
  32. @$(NODEMCU-UPLOADER) -b $(SPEED) -p $(PORT) upload $(foreach f, $^, $(f))