IKIWIKI_OPTIONS ?= \ --set srcdir='$(CURDIR)/content' \ --set destdir='$(CURDIR)/build/html' \ $(IKIWIKI_SHARED_OPTIONS) $(IKIWIKI_CONFIG_OPTIONS) cssprojects ?= $(wildcard shared/themes/goab styling) all: build -include shared/include.mk -include config/include.mk -include shared/themes/include.mk always-make = $(filter -B,$(MAKEFLAGS)) avoid-broken-git = $(shell cd content && git symbolic-ref -q HEAD > /dev/null || echo " --no-rcs") iki_configfiles := $(or $(patsubst %.in,%,$(wildcard config/ikiwiki*.setup.in)),config/ikiwiki.setup) init: $(iki_configfiles) content shared/.git: git submodule init git submodule update --init --recursive $(iki_configfiles): % : %.in shared/.git $(if $(wildcard config),,mkdir config) ikiwiki $(IKIWIKI_OPTIONS) --dumpsetup $@ content: notempty = $(wildcard $@/*.mdwn) content: shared/.git $(if $(notempty),,mkdir -p '$@') $(if $(notempty),,printf '# Hello world!\n\nHello world!\n' > '$@/index.mdwn') build: $(if $(cssprojects),$(MAKE) $(cssprojects)) $(foreach config,$(shell find config -name '*.setup'),ikiwiki --setup $(config)$(avoid-broken-git)$(if $(always-make), --rebuild);) .PHONY: all build