Solar Array and home energy dashboard.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

73 lines
2.1 KiB

  1. .PHONY: all
  2. .SUFFIXES: .jspp .js
  3. PROJNAME=solardash
  4. VIRTUALENV ?= virtualenv-3.7
  5. VRITUALENVARGS =
  6. CPP ?= cpp
  7. HOST ?= localhost
  8. RAINEAGLEDATAPREF ?= p/src/raineagle/fixtures/data
  9. FILES=$(PROJNAME)/__init__.py
  10. JSFILES = root/js/solardash.file.js root/js/solardash.https.js root/js/solardash.http.js
  11. THIRDPARTYJS = \
  12. root/js/jquery.js \
  13. root/js/highstock.js \
  14. root/js/moment.min.js \
  15. root/js/moment-timezone-with-data.min.js
  16. root/js/jquery.js:
  17. wget -O $@ "https://code.jquery.com/jquery-3.4.1.min.js" || (rm "$@"; false)
  18. root/js/moment.min.js:
  19. wget -O $@ "https://momentjs.com/downloads/moment.min.js" || (rm "$@"; false)
  20. root/js/moment-timezone-with-data.min.js:
  21. wget -O $@ "https://momentjs.com/downloads/moment-timezone-with-data-1970-2030.js" || (rm "$@"; false)
  22. root/js/highstock.js: Makefile
  23. wget -O - "https://code.highcharts.com/stock/8.0.0/highstock.js" | grep -v '^//# sourceMappingURL=' > $@ || (rm "$@"; false)
  24. root/js/highcharts.js: Makefile
  25. wget -O - "https://code.highcharts.com/stock/8.0.0/highcharts.js" | grep -v '^//# sourceMappingURL=' > $@ || (rm "$@"; false)
  26. root/js/solardash.http.js: root/js/solardash.https.js
  27. ln -s solardash.https.js $@
  28. # manual deps
  29. JSBASE = root/js/solardash.base.js
  30. all: $(JSFILES)
  31. run: $(JSFILES)
  32. $(JSFILES): $(THIRDPARTYJS) $(JSBASE)
  33. root/js/solardash.file.js: fakedata.js
  34. fakedata.js: fakedata.py
  35. python $< > $@ || (rm $@; false)
  36. .jspp.js:
  37. # bsdmake uses $>, gmake uses $^
  38. (echo '// DO NOT EDIT FILE!!!! THIS IS AUTOMATICALLY GENERATED!!!'; cat $^) > $@ || (rm "$@"; false)
  39. #cat $< $(THIRDPARTYJS) $(JSBASE) > $@ || (rm $@; false)
  40. keepupdate:
  41. find . -name '*.js' -o -name '*.jspp' | entr make all
  42. test:
  43. (ls $(FILES) $(JSFILES) | entr sh -c 'make all && python -m coverage run -m unittest $(PROJNAME) && coverage report --omit=p/\* -m -i')
  44. test-noentr:
  45. python -m coverage run -m unittest $(PROJNAME) && coverage report --omit=p/\* -m -i
  46. run: $(JSFILES)
  47. python -m aiohttp.web -H $(HOST) -P 38382 solardash:getapp $(RAINEAGLEDATAPREF)
  48. env:
  49. ($(VIRTUALENV) $(VIRTUALENVARGS) p && . ./p/bin/activate && pip install -r requirements.txt)