Zack Williams | ad36613 | 2018-05-14 14:45:47 -0700 | [diff] [blame] | 1 | # Makefile for building CORD docs site, guide.opencord.org |
| 2 | # Building docs requires the following tools: |
| 3 | # - Gitbook toolchain: https://toolchain.gitbook.com/setup.html |
| 4 | # - NPM (for Gitbook and Swagger) |
| 5 | # - Python (for build glossary script) |
| 6 | # - linkchecker (for test target) http://wummel.github.io/linkchecker/ |
| 7 | |
| 8 | default: serve |
| 9 | |
| 10 | # use bash for pushd/popd, and to fail if commands within a pipe fail |
| 11 | SHELL = bash -o pipefail |
| 12 | |
| 13 | GENERATED_DOCS = |
| 14 | |
Zack Williams | a719e4a | 2018-05-16 14:44:36 -0700 | [diff] [blame] | 15 | LINT_STYLE ?= mdl_relaxed.rb |
| 16 | |
Zack Williams | ad36613 | 2018-05-14 14:45:47 -0700 | [diff] [blame] | 17 | serve: setup |
| 18 | gitbook serve --port 4040 |
| 19 | |
| 20 | build: setup |
| 21 | gitbook build |
| 22 | |
| 23 | setup: cord-tester xos xos-gui xos-tosca swagger $(GENERATED_DOCS) |
| 24 | gitbook init |
| 25 | gitbook install |
| 26 | |
| 27 | test: linkcheck lint |
| 28 | |
| 29 | linkcheck: build |
| 30 | linkchecker --check-extern -a _book/ |
| 31 | |
| 32 | lint: |
| 33 | @echo "markdownlint(mdl) version: `mdl --version`" |
| 34 | @echo "style config:" |
| 35 | @echo "---" |
Zack Williams | a719e4a | 2018-05-16 14:44:36 -0700 | [diff] [blame] | 36 | @cat $(LINT_STYLE) |
Zack Williams | ad36613 | 2018-05-14 14:45:47 -0700 | [diff] [blame] | 37 | @echo "---" |
Zack Williams | a719e4a | 2018-05-16 14:44:36 -0700 | [diff] [blame] | 38 | mdl -s $(LINT_STYLE) `find -L . ! -path "./partials/*" ! -path "./_book/*" ! -path "./node_modules/*" ! -path "./cord-tester/modules/*" -name "*.md"` |
Zack Williams | ad36613 | 2018-05-14 14:45:47 -0700 | [diff] [blame] | 39 | |
| 40 | # link directories that contain other documentation |
| 41 | cord-tester: |
| 42 | ln -s ../test/cord-tester/docs cord-tester |
| 43 | |
| 44 | xos: |
| 45 | ln -s ../orchestration/xos/docs xos |
| 46 | |
| 47 | xos-gui: |
| 48 | ln -s ../orchestration/xos-gui/docs xos-gui |
| 49 | |
| 50 | xos-tosca: |
| 51 | ln -s ../orchestration/xos-tosca/docs xos-tosca |
| 52 | |
| 53 | swagger: xos |
| 54 | pushd ../orchestration/xos/docs/; make swagger_docs; popd; |
| 55 | |
| 56 | clean: |
| 57 | rm -rf $(GENERATED_DOCS) |
| 58 | rm -rf _book |
| 59 | rm -rf node_modules |
| 60 | rm -rf cord-tester test xos xos-gui xos-tosca |
| 61 | |