makefile 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. SRC_HTMLS := $(shell find src -name '*.src.html')
  2. SRC_MDS := $(shell find src -name '*.src.md')
  3. GEN_HTMLS := $(SRC_HTMLS:%.src.html=%.gen.html)
  4. GEN_MDS := $(SRC_MDS:%.src.md=%.gen.html)
  5. GEN_FILES := $(GEN_HTMLS) $(GEN_MDS)
  6. INCLUDED_FILES := $(shell find src/include -type f)
  7. DOWNLOAD_FILES := $(shell find src/download -type f)
  8. DIST_GEN_FILES := $(GEN_FILES:src/%.gen.html=dist/%.html)
  9. DIST_INC_FILES := $(INCLUDED_FILES:src/%=dist/%)
  10. DIST_DWN_FILES := $(DOWNLOAD_FILES:src/%=dist/%)
  11. DIST_FILES := $(DIST_GEN_FILES) $(DIST_INC_FILES) $(DIST_DWN_FILES)
  12. PANDOC_GEN := pandoc --standalone --wrap=none --template src/templates/main.html --metadata-file src/meta.yml
  13. .PHONY: build
  14. build: $(GEN_FILES)
  15. $(info HTML generated)
  16. %.gen.html: %.src.html
  17. $(PANDOC_GEN) --output $@ $<
  18. %.gen.html: %.src.md
  19. $(PANDOC_GEN) --output $@ $<
  20. dist: $(DIST_FILES)
  21. $(info Distributed folder generated)
  22. dist/include/%: src/include/%
  23. mkdir --parents $(dir $@)
  24. cp $< $@
  25. dist/download/%: src/download/%
  26. mkdir --parents $(dir $@)
  27. cp $< $@
  28. dist/%.html: src/%.gen.html
  29. mkdir --parents $(dir $@)
  30. cp $< $@
  31. .PHONY: clean
  32. clean:
  33. rm -f $(GEN_FILES)
  34. .PHONY: debug
  35. debug:
  36. $(info SRC_HTMLS $(SRC_HTMLS))
  37. $(info SRC_MDS $(SRC_MDS))
  38. $(info GEN_HTMLS $(GEN_HTMLS))
  39. $(info GEN_MDS $(GEN_MDS))
  40. $(info GEN_FILES $(GEN_FILES))
  41. $(info DIST_FILES $(DIST_FILES))