aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 27aa98370a8ed16dd3288de40386e7654320e117 (plain)
  1. # Depends: myrepos git mkdocs w3c-linkchecker libtext-hogan-perl
  2. -include site.mk
  3. domain ?= example.org
  4. shellhost ?= shell.$(domain)
  5. githost ?= source.$(domain)
  6. gitshellhost ?= $(shellhost)
  7. matrixhost ?= matrix.$(domain)
  8. organisation ?= Example orga
  9. contact_sysadmins ?= contact sysadmins
  10. MUSTACHE = cat source/source/USE.md | perl -MText::Hogan::Compiler -0777 -nE '\
  11. my $$compiler = Text::Hogan::Compiler->new;\
  12. my $$template = $$compiler->compile($$_);\
  13. say $$template->render({ \
  14. domain => "$(domain)", shellhost => "$(shellhost)", githost => "$(githost)", gitshellhost => "$(gitshellhost)", \
  15. matrixhost => "$(matrixhost)", \
  16. organisation => "$(organisation)", contact_sysadmins => "$(contact_sysadmins)" })'
  17. all: doc
  18. doc: docs $(patsubst %,docs/%,$(subst -,/,$(notdir $(wildcard source/*))))
  19. mkdocs build
  20. check:
  21. checklink site/index.html
  22. # TODO: drop symlink removal when 2020-06-19 is well in the past
  23. docs:
  24. mkdir -p docs
  25. find docs -type l -delete
  26. $(MUSTACHE) < README.md > docs/index.md
  27. $(MUSTACHE) < SETUP.md > docs/setup.md
  28. docs/%: source
  29. mkdir -p docs/$*
  30. $(MUSTACHE) < source/$(subst /,-,$*)/README.md > docs/$*/index.md
  31. $(if $(wildcard source/$(subst /,-,$*)/USE.md),\
  32. $(MUSTACHE) < source/$(subst /,-,$*)/USE.md > docs/$*/use.md)
  33. $(if $(wildcard source/$(subst /,-,$*)/ADMIN.md),\
  34. $(MUSTACHE) < source/$(subst /,-,$*)/ADMIN.md > docs/$*/admin.md)
  35. $(if $(wildcard source/$(subst /,-,$*)/SETUP.md),\
  36. $(MUSTACHE) < source/$(subst /,-,$*)/SETUP.md > docs/$*/setup.md)
  37. $(if $(wildcard source/$(subst /,-,$*)/DEVELOP.md),\
  38. $(MUSTACHE) < source/$(subst /,-,$*)/DEVELOP.md > docs/$*/devel.md)
  39. init:
  40. mr update
  41. clean:
  42. rm -rf site
  43. rm -rf docs
  44. distclean: clean
  45. rm -rf source
  46. .PHONY: all doc check clean distclean