makefile 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. ### Variables ###
  2. #
  3. # build directory
  4. #
  5. OUT=_site
  6. #
  7. # directories to put files in
  8. #
  9. DIRECTORIES_DST=${OUT} ${OUT}/images ${OUT}/images/games ${OUT}/images/games/rue ${OUT}/games ${OUT}/avdl
  10. #
  11. # raw files that are to be copied as-is on the same
  12. # path as the source file
  13. #
  14. RAW_FILES_SRC=LICENSE style.css favicon.ico logo.png robots.txt $(wildcard images/*) $(wildcard images/games/rue/*)
  15. RAW_FILES_DST=$(RAW_FILES_SRC:%=${OUT}/%)
  16. #
  17. # page files, to be parsed from json
  18. #
  19. PAGES_SRC_JSON=$(wildcard structure/*.json) $(wildcard structure/games/*.json) $(wildcard structure/avdl/*.json)
  20. PAGES_OUT_JSON=$(PAGES_SRC_JSON:structure/%.json=${OUT}/%.html)
  21. #
  22. # sitemap
  23. #
  24. SITEMAP_DST=${OUT}/sitemap.xml
  25. #
  26. # The template all pages use
  27. #
  28. TEMPLATE=md_files/template.md
  29. ### Rules ###
  30. #
  31. # build the whole site
  32. #
  33. all: ${DIRECTORIES_DST} ${RAW_FILES_DST} ${PAGES_OUT_JSON} ${PAGES_OUT_JSON} ${SITEMAP_DST}
  34. #
  35. # files that have no other rule, are copied to destination
  36. #
  37. ${OUT}/%: %
  38. rm -rf $@ && cp -r $^ $@
  39. #
  40. # build output directories
  41. #
  42. ${DIRECTORIES_DST}:
  43. mkdir -p $@
  44. #
  45. # build pages from json
  46. #
  47. ${OUT}/%.html: structure/%.json ${TEMPLATE}
  48. ./generate_page.sh $@ $<
  49. #
  50. # sitemap generation
  51. #
  52. ${SITEMAP_DST}: ${PAGES_SRC_JSON}
  53. cat sitemap.xml.in > $@
  54. echo "<lastmod>$(shell date +%Y-%m-%d)</lastmod></url>" >> $@
  55. echo "$(foreach var,${PAGES_OUT_JSON},<url><loc>http://darkdimension.org/${var}</loc><lastmod>$(shell date +%Y-%m-%d)</lastmod></url>)" >> $@