summaryrefslogtreecommitdiff
path: root/Makefile
blob: 1fb0d33274ced502ed5e7e6f277287180e9834ae (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. config/ikiwiki.setup.in:
  27. $(if $(wildcard config),,mkdir config)
  28. $(if $(wildcard config/ikiwiki.setup.in),,touch config/ikiwiki.setup.in)
  29. configfiles: $(iki_configfiles)
  30. $(iki_configfiles): iki_flavor = $(if $(filter config/ikiwiki-%.setup,$@),$(@:config/ikiwiki-%.setup=%))
  31. $(iki_configfiles): % : %.in
  32. ikiwiki $(IKIWIKI_DEFAULTS) $(patsubst %,--setup %,$(wildcard $<)) $(IKIWIKI_OPTIONS) --dumpsetup $@
  33. content: notempty = $(wildcard $@/*.mdwn)
  34. content:
  35. $(if $(notempty),,mkdir -p '$@')
  36. $(if $(notempty),,printf '# Hello world!\n\nHello world!\n' > '$@/index.mdwn')
  37. build:
  38. $(if $(cssprojects),$(MAKE) $(cssprojects))
  39. $(foreach config,$(shell find config -name '*.setup'),ikiwiki --setup $(config)$(avoid-broken-git)$(if $(always-make), --rebuild);)
  40. .PHONY: all build configfiles