+# Set doc entities for VERSION and CODE_STATUS. Toggle content
+# exceptions accordingly. When 'make dok' gets stable, this
+# needs to go before any doc building (doh).
+make dok-release:
+ @$(ECHO) Setting doc version and status to $(VERSION), $(CODE_STATUS)
+ @$(PERL) -pi -e 's/<!entity +p-version.*>/<!entity p-version "$(VERSION)">/;\
+ s/<!entity +p-status.*>/<!entity p-status "$(CODE_STATUS)">/' \
+ doc/source/*sgml
+ifeq ($(CODE_STATUS),stable)
+ @$(ECHO) Setting docs to stable $(VERSION)
+ @$(PERL) -pi -e 's/<!entity +% +p-stable.*>/<!entity % p-stable "INCLUDE">/;\
+ s/<!entity +% +p-not-stable.*>/<!entity % p-not-stable "IGNORE">/' \
+ doc/source/*sgml
+else
+ @$(ECHO) Setting docs to not stable $(VERSION)
+ @$(PERL) -pi -e 's/<!entity +% +p-stable.*>/<!entity % p-stable "IGNORE">/;\
+ s/<!entity +% +p-not-stable.*>/<!entity % p-not-stable "INCLUDE">/' \
+ doc/source/*sgml
+endif
+