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