summaryrefslogtreecommitdiff
path: root/Makefile
blob: dd996fe63cc55165ecdbcbf73ab1c8ea183be713 (plain)
  1. IKIWIKI_DEFAULTS ?= \
  2. --rcs git \
  3. --set cgi_wrappermode=00755 \
  4. --set git_wrappermode=06755 \
  5. $(IKIWIKI_SHARED_DEFAULTS)
  6. IKIWIKI_OPTIONS ?= \
  7. --set srcdir='$(CURDIR)/content' \
  8. --set destdir='$(CURDIR)/build/html$(iki_flavor:%=-%)' \
  9. --set cgi_wrapper='$(CURDIR)/build/cgi$(iki_flavor:%=-%)/ikiwiki.cgi' \
  10. --set git_wrapper='$(CURDIR)/build/git/post-update-ikiwiki$(iki_flavor:%=-%)' \
  11. --set wikistatedir='$(CURDIR)/.ikiwiki$(iki_flavor:%=-%)' \
  12. $(IKIWIKI_SHARED_OPTIONS)
  13. cssprojects ?= $(wildcard shared/themes/goab styling)
  14. all: build
  15. -include shared/include.mk
  16. -include config/include.mk
  17. -include shared/themes/include.mk
  18. always-make = $(filter -B,$(MAKEFLAGS))
  19. avoid-broken-git = $(shell cd content && git symbolic-ref -q HEAD > /dev/null || echo " --no-rcs")
  20. iki_configfiles := $(or $(patsubst %.in,%,$(wildcard config/ikiwiki*.setup.in)),config/ikiwiki.setup)
  21. init: shared/.git content
  22. $(MAKE) $(iki_configfiles)
  23. shared/.git:
  24. git submodule init
  25. git submodule update --init --recursive
  26. configfiles: $(iki_configfiles)
  27. $(iki_configfiles): iki_flavor = $(if $(filter config/ikiwiki-%.setup,$@),$(@:config/ikiwiki-%.setup=%))
  28. $(iki_configfiles): % : %.in
  29. $(if $(wildcard config),,mkdir config)
  30. ikiwiki $(IKIWIKI_DEFAULTS) $(patsubst %,--setup %,$(wildcard $<)) $(IKIWIKI_OPTIONS) --dumpsetup $@
  31. content: notempty = $(wildcard $@/*.mdwn)
  32. content:
  33. $(if $(notempty),,mkdir -p '$@')
  34. $(if $(notempty),,printf '# Hello world!\n\nHello world!\n' > '$@/index.mdwn')
  35. build:
  36. $(if $(cssprojects),$(MAKE) $(cssprojects))
  37. $(foreach config,$(shell find config -name '*.setup'),ikiwiki --setup $(config)$(avoid-broken-git)$(if $(always-make), --rebuild);)
  38. .PHONY: all build configfiles