summaryrefslogtreecommitdiff
path: root/Makefile
blob: df8a8407143256082c4acbc055817f14e6ca189d (plain)
  1. sources = ikiwiki
  2. origin_ikiwiki = http://source.jones.dk/ikiwiki_$(underlay).git
  3. underlays_ikiwiki = basewiki smiley templates
  4. master_ikiwiki = master$(locale:%=-$(locale))
  5. locales_ikiwiki = da
  6. #dummies = content_dummy
  7. underlays_l10n = $(foreach source, $(sources), $(foreach locale, $(locales_$(source)), $(patsubst %,%_l10n/$(locale),$(underlays_$(source)))))
  8. underlays = $(foreach source, $(sources), $(underlays_$(source))) $(underlays_l10n)
  9. # FIXME: Handle translation of templates (needs po4a parser for HTML::Template markup)
  10. #potfiles = $(foreach source, $(sources), $(patsubst %,po/%.pot,$(underlays_$(source))))
  11. potfiles = $(foreach source, $(sources), $(patsubst %,po/%.pot,$(filter-out templates,$(underlays_$(source)))))
  12. pofiles = $(foreach locale, $(locales_$(source)), $(patsubst %.pot/%.$(locale).po,$(locale)))
  13. source_of_underlay = $(firstword $(foreach source, $(sources), $(if $(filter $(underlay),$(underlays_$(source))),$(source))))
  14. origin = $(origin_$(source_of_underlay))
  15. master = $(master_$(source_of_underlay))
  16. all: $(underlays) $(dummies)
  17. $(underlays): locale=$(if $(filter l10n/,$(lastword $(subst _, ,$(dir $@)))),$(notdir $@))
  18. $(underlays): underlay=$(@:%_l10n/$(locale)=%)
  19. $(underlays):
  20. mkdir -p $@
  21. @if [ -d "$@/.git" ]; then \
  22. cd $@ && \
  23. git pull; \
  24. else \
  25. cd $@ && \
  26. git init && \
  27. git remote add -f -t $(master) -m $(master) origin $(origin) && \
  28. git merge origin && \
  29. git config remote.origin.push +refs/heads/master:refs/heads/$(master); \
  30. fi
  31. pot: $(potfiles)
  32. # FIXME: The po4a plugin for HTML::Template needs to be written...
  33. $(potfiles): underlay=$(patsubst po/%.pot,%,$@)
  34. $(potfiles): fileformat=$(if $(filter templates,$(underlay)),htmltemplate,text)
  35. $(potfiles): filetype=$(if $(filter templates,$(underlay)),tmpl,mdwn)
  36. $(potfiles):
  37. cd $(underlay) && po4a-gettextize -M UTF-8 -L UTF-8 -f $(fileformat) $(patsubst %,-m %,$(shell cd "$(underlay)" && find * -type f -name '*.$(filetype)')) -p $(CURDIR)/$@
  38. $(dummies):
  39. mkdir -p $@
  40. install:
  41. $(error FIXME: you need to adjust ikiwiki.setup first!)
  42. # ikiwiki --setup ikiwiki.setup --rebuild
  43. # WARNING: this may wipe unrelated files too!
  44. ultraclean:
  45. rm -rf $(underlays)
  46. rm -rf $(dir $(underlays_l10n))
  47. rm -rf $(dummies)
  48. .PHONY: pot po translations $(underlays)