[CORD-3038] Add link/linkcheck to new docs, clean them up
Change-Id: I463ea1b851d88761cc9b450166d4d32aa1d6ad95
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..c9883af
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,59 @@
+# Makefile for building CORD docs site, guide.opencord.org
+# Building docs requires the following tools:
+# - Gitbook toolchain: https://toolchain.gitbook.com/setup.html
+# - NPM (for Gitbook and Swagger)
+# - Python (for build glossary script)
+# - linkchecker (for test target) http://wummel.github.io/linkchecker/
+
+default: serve
+
+# use bash for pushd/popd, and to fail if commands within a pipe fail
+SHELL = bash -o pipefail
+
+GENERATED_DOCS =
+
+serve: setup
+ gitbook serve --port 4040
+
+build: setup
+ gitbook build
+
+setup: cord-tester xos xos-gui xos-tosca swagger $(GENERATED_DOCS)
+ gitbook init
+ gitbook install
+
+test: linkcheck lint
+
+linkcheck: build
+ linkchecker --check-extern -a _book/
+
+lint:
+ @echo "markdownlint(mdl) version: `mdl --version`"
+ @echo "style config:"
+ @echo "---"
+ @cat mdlstyle.rb
+ @echo "---"
+ mdl -s mdlstyle.rb `find -L . ! -path "./partials/*" ! -path "./_book/*" ! -path "./node_modules/*" ! -path "./cord-tester/modules/*" -name "*.md"`
+
+# link directories that contain other documentation
+cord-tester:
+ ln -s ../test/cord-tester/docs cord-tester
+
+xos:
+ ln -s ../orchestration/xos/docs xos
+
+xos-gui:
+ ln -s ../orchestration/xos-gui/docs xos-gui
+
+xos-tosca:
+ ln -s ../orchestration/xos-tosca/docs xos-tosca
+
+swagger: xos
+ pushd ../orchestration/xos/docs/; make swagger_docs; popd;
+
+clean:
+ rm -rf $(GENERATED_DOCS)
+ rm -rf _book
+ rm -rf node_modules
+ rm -rf cord-tester test xos xos-gui xos-tosca
+