makefile 930 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. DIST_FILES := $(GEN_FILES:src/%.gen.html=dist/%.html)
  7. PANDOC_GEN := pandoc --standalone --wrap=none --template src/templates/main.html --metadata-file src/meta.yml
  8. .PHONY: build
  9. build: $(GEN_FILES)
  10. $(info HTML generated)
  11. %.gen.html: %.src.html
  12. $(PANDOC_GEN) --output $@ $<
  13. %.gen.html: %.src.md
  14. $(PANDOC_GEN) --output $@ $<
  15. dist: $(DIST_FILES)
  16. $(info Distributed folder generated)
  17. dist/%.html: src/%.gen.html
  18. mkdir --parents $(dir $@)
  19. cp $< $@
  20. .PHONY: clean
  21. clean:
  22. rm -f $(GEN_FILES)
  23. .PHONY: debug
  24. debug:
  25. $(info SRC_HTMLS $(SRC_HTMLS))
  26. $(info SRC_MDS $(SRC_MDS))
  27. $(info GEN_HTMLS $(GEN_HTMLS))
  28. $(info GEN_MDS $(GEN_MDS))
  29. $(info GEN_FILES $(GEN_FILES))
  30. $(info DIST_FILES $(DIST_FILES))