- IKIWIKI_DEFAULTS ?= \
- --rcs git \
- --set cgi_wrappermode=00755 \
- --set git_wrappermode=06755 \
- --set srcdir='@CURDIR@/content' \
- --set destdir='@CURDIR@/build/html$(iki_flavor:%=-%)' \
- --set cgi_wrapper='@CURDIR@/build/cgi$(iki_flavor:%=-%)/ikiwiki.cgi' \
- --set git_wrapper='@CURDIR@/build/git/post-update-ikiwiki$(iki_flavor:%=-%)' \
- --set wikistatedir='@CURDIR@/.ikiwiki$(iki_flavor:%=-%)' \
- $(IKIWIKI_SHARED_DEFAULTS)
- export CURDIR
- cssprojects ?= $(wildcard shared/themes/goab styling)
- all: build
- -include shared/include.mk
- -include config/include.mk
- -include shared/themes/include.mk
- always-make = $(findstring 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: shared/.git content
- $(MAKE) $(iki_configfiles)
- shared/.git:
- git submodule init
- git submodule update --init --recursive
- config/ikiwiki.setup.in:
- $(if $(wildcard config),,mkdir config)
- $(if $(wildcard config/ikiwiki.setup.in),,touch config/ikiwiki.setup.in)
- configfiles: $(iki_configfiles)
- $(iki_configfiles): iki_flavor = $(if $(filter config/ikiwiki-%.setup,$@),$(@:config/ikiwiki-%.setup=%))
- $(iki_configfiles): % : %.in
- ikiwiki $(IKIWIKI_DEFAULTS) \
- $(if $(IKIWIKI_UNDERLAYS)$(IKIWIKI_SHARED_UNDERLAYS),\
- --set-yaml add_underlays="$$(echo $(strip \
- $(IKIWIKI_UNDERLAYS) \
- $(IKIWIKI_SHARED_UNDERLAYS)) \
- | perl -pe 's/\s+/\n/g;s/^/- /gm')") \
- $(patsubst %,--setup %,$(wildcard $<)) --dumpsetup $@
- perl -i -pe '$$s=$$ENV{'CURDIR'}; s/\@CURDIR\@/$$s/g' $@
- content: notempty = $(wildcard $@/*.mdwn)
- content:
- $(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, --refresh);)
- $(if $(wildcard forms),cd forms && find * -name '*.cgi' \
- -exec install -DT '{}' ../build/forms/'{}' ';' \
- -exec perl -i -pe "s:'../build':'$(CURDIR)/build':g" ../build/forms/'{}' ';')
- .PHONY: all build configfiles
|