Makefile 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. # ---------- ---------- ---------- ---------- ---------- ----------
  2. #
  3. # This makefile generates the peers website.
  4. #
  5. # ---------- ---------- ---------- ---------- ---------- ----------
  6. STAGE_DIR=content
  7. BUILD_DIR=output
  8. SITEMAP=src/sitemap/index.md
  9. target: build
  10. .PHONY: help
  11. help:
  12. @echo "make Build website"
  13. @echo "make server Run a local test server"
  14. @echo "make clean Delete build files and output"
  15. .PHONY: sitemap
  16. sitemap:
  17. @cp etc/templates/sitemap.md $(SITEMAP)
  18. @echo "" >> $(SITEMAP)
  19. @echo "## Directories" >> $(SITEMAP)
  20. @echo "" >> $(SITEMAP)
  21. @cd src && \
  22. find . -type d \
  23. -not -path "." \
  24. | sort \
  25. | sed 's/\.\//\.\.\//g' \
  26. | awk '/$$/{ print "- ["$$0"]("$$0")" }' \
  27. >> ../$(SITEMAP) && \
  28. cd ..
  29. @echo "" >> $(SITEMAP)
  30. @echo "## Pages" >> $(SITEMAP)
  31. @echo "" >> $(SITEMAP)
  32. @cd src && \
  33. find . -type f \
  34. -not -path "./media/*" \
  35. -not -name ".htaccess" \
  36. -not -name "*.css" \
  37. | sort \
  38. | sed 's/\.\//\.\.\//g' \
  39. | awk '/$$/{ print "- ["$$0"]("$$0")" }' \
  40. >> ../$(SITEMAP) && \
  41. cd ..
  42. .PHONY: build
  43. build: sitemap
  44. @rsync -avh --delete src/ $(STAGE_DIR)/
  45. @cp $(STAGE_DIR)/media/hack.png $(STAGE_DIR)/favicon.ico
  46. @cp $(STAGE_DIR)/media/PeersCo_websitebanner_v3.png $(STAGE_DIR)/banner.png
  47. @cp $(STAGE_DIR)/media/glider-circles.svg $(STAGE_DIR)/logo.svg
  48. @fenrisg \
  49. markdown-smart \
  50. $(STAGE_DIR)/ \
  51. etc/templates/peers.html \
  52. etc/filters/links-md-to-html.lua \
  53. light \
  54. dark/ \
  55. $(BUILD_DIR)
  56. @fenrisg \
  57. markdown-smart \
  58. $(STAGE_DIR)/ \
  59. etc/templates/peers.html \
  60. etc/filters/links-md-to-html.lua \
  61. dark \
  62. ../ \
  63. $(BUILD_DIR)/dark
  64. .PHONY: server
  65. server:
  66. @cd $(BUILD_DIR) && python3 -m http.server
  67. .PHONY: clean
  68. clean:
  69. @rm --recursive --force $(BUILD_DIR) $(STAGE_DIR)
  70. .PHONY: rebuild
  71. rebuild: clean build