-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
70 lines (58 loc) · 2.68 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
##
# Makefile to build the documentation with Antora
##
.PHONY: help deps-native deps-docker docs docs-lunr docs-docker clean clean-cache clean-all
.DEFAULT_GOAL := docs
SHELL := /bin/bash -o nounset -o pipefail -o errexit
WORKING_DIRECTORY := $(shell pwd)
DOCKER_ANTORA_IMAGE := opennms/antora:3.1.1-b8850
SITE_FILE := antora-playbook.yml
help:
@echo ""
@echo "Makefile to build Antora based documentation site for docs.opennms.com"
@echo "For the native version, please install globally Antora described on https://docs.antora.org/"
@echo ""
@echo "Requirements to build the docs:"
@echo " * Native: Antora installed globally with antora binary in the search path"
@echo " * Lunr: Possibility to build with Antora Lunr search engine, works just native and is optional"
@echo " Requires to have antora-lunr intalled, npm i -g antora-lunr"
@echo " * Docker: Docker installed with access to the official antora/antora image on DockerHub"
@echo ""
@echo "Targets:"
@echo " help: Show this help"
@echo " deps-native: Test requirements to run Antora from the local system"
@echo " deps-with-docker: Test requirements to run Antora with Docker"
@echo " docs: Run Antora installed on the local system, default target"
@echo " docs-lunr: RUn Antora build with Lunr site generator"
@echo " docs-docker: Run Antora with Docker"
@echo " clean: Clean all build artifacts in build and public directory"
@echo " clean-cache: Clear git repository cache and UI components from .cache directory"
@echo " clean-all: Clean build artifacts and Antora cache"
@echo ""
@echo "Arguments: "
@echo " DOCKER_ANTORA_IMAGE: Antora Docker image to build the documenation, default: $(DOCKER_ANTORA_IMAGE)"
@echo " SITE_FILE: Antora site.yml file to build the site"
@echo ""
@echo "Example: "
@echo " make DOCKER_ANTORA_IMAGE=antora/antora:latest with-docker"
@echo ""
deps-native:
@command -v antora
deps-docker:
@command -v docker
deps-native-lunr: deps-native
npm -g list antora-site-generator-lunr
docs: deps-native
antora --stacktrace generate $(SITE_FILE)
docs-lunr: deps-native-lunr
DOCSEARCH_ENABLED=true DOCSEARCH_ENGINE=lunr antora --generator antora-site-generator-lunr --stacktrace generate $(SITE_FILE)
docs-docker: deps-docker
@echo "Build Antora docs with docker ..."
docker run --rm -v $(WORKING_DIRECTORY):/antora $(DOCKER_ANTORA_IMAGE) --stacktrace generate $(SITE_FILE)
clean:
@echo "Delete build and public artifacts ..."
@rm -rf build public
clean-cache:
@echo "Clean Antora cache for git repositories and UI components ..."
@rm -rf .cache
clean-all: clean clean-cache