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