Makefile 1.3 KB

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