blob: 7e40a28398b70d94ef35337d3789639554fa8741 [file] [log] [blame]
# This contains targets to build the website and add the documentation generated from the Cassandra source.
# The add-doc command build the document from the cassandra sources pointed by the CASSANDRA_DIR environment variable
# and copy it in doc/<version>/. The add-latest-doc does the same but also create/modify the doc/latest symlink so it
# points to the doc it just created (so to use to replace the "current" documentation).
# Note that the add-doc and add-latest-doc are not called automatically from other targets and needs to be called
# manually. That's because there is many cases where you want to just update the website, without reconstructing the
# documentation. Note however that the doc target do rebuild the website.
$(error You should set the CASSANDRA_DIR environment variable to the git source dir, checkout on the proper branch)
.build-doc: .check-env
# Not declaring DOC_VERSION at top-level cause it calls ant and that's stupidly slow
$(eval DOC_VERSION=$(shell echo `cd $(CASSANDRA_DOC_DIR)/..; ant echo-base-version | grep '\[echo\]' | awk '{print $$2}'`))
@echo "Generating website docs for $(DOC_VERSION)"
$(eval DOC_DIR="doc/$(DOC_VERSION)")
# Nodetool docs are autogenerated, but that needs nodetool to be built
@cd $(CASSANDRA_DIR); ant jar
# cassandra-3.11 is missing, ref: CASSANDRA-16093
@if [ ! -f $(CASSANDRA_DOC_DIR)/ ]; then\
wget -nc ;\
python ;\
cd - ;\
@cd $(CASSANDRA_DOC_DIR); make website
@if [ -d $(DOC_DIR) ]; then rm -rf $(DOC_DIR); fi
@cp -r $(CASSANDRA_DOC_DIR)/build/html $(DOC_DIR)
@ln -s -f -T $(DOC_VERSION) "doc/latest"
@ln -s -f -T $(DOC_VERSION) "doc/stable"
@bundle exec jekyll build
@bundle exec jekyll clean
@bundle exec jekyll serve
add-doc: .build-doc build
add-latest-doc: .build-doc .latest-doc-link build
add-stable-doc: .build-doc .stable-doc-link build