summaryrefslogtreecommitdiff
path: root/Makefile
blob: 4e287aa6960411e082ea1063366a59b29e77c49a (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: $(iki_configfiles) content
  22. shared/.git:
  23. git submodule init
  24. git submodule update --init --recursive
  25. $(iki_configfiles): iki_flavor = $(if $(filter config/ikiwiki-%.setup,$@),$(@:config/ikiwiki-%.setup=%))
  26. $(iki_configfiles): % : %.in shared/.git
  27. $(if $(wildcard config),,mkdir config)
  28. ikiwiki $(IKIWIKI_DEFAULTS) $(patsubst %,--setup %,$(wildcard $<)) $(IKIWIKI_OPTIONS) --dumpsetup $@
  29. content: notempty = $(wildcard $@/*.mdwn)
  30. content: shared/.git
  31. $(if $(notempty),,mkdir -p '$@')
  32. $(if $(notempty),,printf '# Hello world!\n\nHello world!\n' > '$@/index.mdwn')
  33. build:
  34. $(if $(cssprojects),$(MAKE) $(cssprojects))
  35. $(foreach config,$(shell find config -name '*.setup'),ikiwiki --setup $(config)$(avoid-broken-git)$(if $(always-make), --rebuild);)
  36. .PHONY: all build