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.
#
CASSANDRA_DOC_DIR="$(CASSANDRA_DIR)/doc"
.check-env:
ifndef CASSANDRA_DIR
$(error You should set the CASSANDRA_DIR environment variable to the git source dir, checkout on the proper branch)
endif
.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 gen-nodetool-docs.py, ref: CASSANDRA-16093
@if [ ! -f $(CASSANDRA_DOC_DIR)/gen-nodetool-docs.py ]; then\
cd $(CASSANDRA_DOC_DIR) ;\
wget -nc https://raw.githubusercontent.com/apache/cassandra/a47be7eddd5855fc7723d4080ca1a63c611efdab/doc/gen-nodetool-docs.py ;\
python gen-nodetool-docs.py ;\
cd - ;\
fi
@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)
.latest-doc-link:
@ln -s -f -T $(DOC_VERSION) "doc/latest"
.stable-doc-link:
@ln -s -f -T $(DOC_VERSION) "doc/stable"
build:
@bundle exec jekyll build
clean:
@bundle exec jekyll clean
serve:
@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