Makefile 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. include .env
  2. export $(shell sed 's/=.*//' .env)
  3. BASEDIR=$(CURDIR)
  4. INPUTDIR=$(BASEDIR)
  5. OUTPUTDIR=$(BASEDIR)/output
  6. SSH_HOST=$(ENV_HOST)
  7. SSH_PORT=$(ENV_PORT)
  8. SSH_USER=$(ENV_USER)
  9. SSH_TARGET_DIR=$(ENV_TARGET_DIR)
  10. PY?=python3
  11. SERVERMODULE=http.server
  12. ifeq ($(PY), tauthon)
  13. SERVERMODULE = SimpleHTTPServer
  14. else ifeq ($(PY), python2)
  15. SERVERMODULE = SimpleHTTPServer
  16. else ifeq ($(PY), python3)
  17. SERVERMODULE = http.server
  18. endif
  19. help:
  20. @echo 'Makefile for generate styles, fonts, icons, js to Contries '
  21. @echo ' '
  22. @echo 'Usage: '
  23. @echo ' make all compile all frontend '
  24. @echo ' make clean delete all fonts, icons, styles, js '
  25. @echo ' make icons compile icons '
  26. @echo ' make styles compile custom styles '
  27. @echo ' make fonts generate fonts '
  28. @echo ' make js compile javascript files '
  29. @echo ' make publish Publish APP '
  30. @echo ' make serve [PY=python] [PORT=8000] serve site at http://localhost:8000 '
  31. @echo ' '
  32. all: generate
  33. generate: clean fonts icons styles js
  34. clean:
  35. @rm -rfv dist/ || true
  36. @rm -rfv output/ || true
  37. fonts:
  38. @bash scripts/fonts.bash
  39. icons:
  40. @bash scripts/icons.bash
  41. styles:
  42. @bash scripts/noscript.bash
  43. @bash scripts/normalize.bash
  44. @bash scripts/home.bash
  45. @bash scripts/post.bash
  46. @bash scripts/license.bash
  47. js:
  48. @bash scripts/js.bash
  49. output:
  50. @mkdir -p output/dist
  51. @cp -rv dist/* output/dist/
  52. @cp -v index.html output/
  53. @cp -v licenses.html output/
  54. @cp -v opensearch.xml output/
  55. publish: generate output
  56. rsync -e "ssh -p $(SSH_PORT)" -P -rvzc --delete $(OUTPUTDIR)/ $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR)/
  57. serve: generate
  58. ifdef PORT
  59. $(PY) -m $(SERVERMODULE) $(PORT)
  60. else
  61. $(PY) -m $(SERVERMODULE)
  62. endif