summaryrefslogtreecommitdiff
path: root/Makefile
blob: 76df242e1fb4e39573492c01b9ccad2b4debc780 (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. $(error 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 -$@
  21.     @if [ -"$@/.git" ]; then \
  22.         cd $&& \
  23.         git pull\
  24.     else \
  25.         cd $&& \
  26.         git init && \
  27.         git remote add --$(master) -$(masterorigin $(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 -$(fileformat) $(patsubst %,-%,$(shell cd "$(underlay)" && find * -type f -name '*.$(filetype)')) -$(CURDIR)/$@
  38. $(dummies):
  39.     mkdir -$@
  40. install:
  41.     $(error FIXMEyou 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. .PHONYpot po translations $(underlays)