forked from ecmwf/atlas-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
136 lines (109 loc) · 4.81 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
SHELL := /bin/bash
help:
@echo 'Makefile for atlas documentation '
@echo ' '
@echo 'Usage: '
@echo ' make html (re)generate the web site '
@echo ' make regenerate regenerate the website '
@echo ' make serve [PORT=8000] serve site at http://localhost:8000 '
@echo ' make devserver [PORT=8000] serve and regenerate together '
@echo ' make clean remove build '
@echo ' make clean-venv remove venv '
@echo ' make clean-downloads remove downloads '
@echo ' make distclean remove downloads, venv, build '
@echo ' '
@echo 'Set the WITH_DOXYGEN variable to 1/0 to skip Doxygen C++ API '
@echo 'Set the ATLAS_SOURCE_DIR variable to existing path to avoid git download '
@echo 'Set the ECKIT_SOURCE_DIR variable to existing path to avoid git download '
@echo 'Set the WITH_ECKIT variable to 1/0 to add/avoid eckit within Doxygen C++ API'
@echo ' '
WITH_ECKIT ?= 0
WITH_DOXYGEN ?= 1
WITH_LATEX ?= 1
# Source directories for eckit and atlas
ATLAS_SOURCE_DIR ?= false
ECKIT_SOURCE_DIR ?= false
PUBLIC ?= 0
DEBUG ?= 0
VERSION ?= 0
PY?=python3
PELICAN?=source venv/bin/activate && pelican
GENERATE_DOXYFILE?=source venv/bin/activate && python scripts/generate_doxyfile.py
DOXYGEN?=source venv/bin/activate && doxygen.py
DOXYGEN_API=c++
INPUTDIR=$(CURDIR)/content
OUTPUTDIR=$(CURDIR)/build/html
CONFFILE=$(CURDIR)/scripts/pelican/pelicanconf.py
PORT ?= 8000
PELICANOPTS=
GENERATEDOXYOPTS=
SETUPOPTS=
ifeq ($(PUBLIC), 1)
GENERATEDOXYOPTS += --public
CONFFILE=$(CURDIR)/scripts/pelican/publishconf.py
endif
ifeq ($(DEBUG), 1)
PELICANOPTS += -D
endif
ifeq ($(WITH_DOXYGEN),1)
SETUPOPTS += --doxygen
endif
ifeq ($(WITH_ECKIT),1)
GENERATEDOXYOPTS += --with-eckit
endif
ifneq ($(VERSION),0)
GENERATEDOXYOPTS += --version=$(VERSION)
endif
html: build/html/index.html
@echo "[atlas-docs] Generated html at $(CURDIR)/build/html"
@echo "[atlas-docs] To visualise, execute \"make serve\" and open browser at \"http://localhost:8000\""
build/html/index.html: build/html/$(DOXYGEN_API)/index.html
@echo "[atlas-docs] Building Pelican documentation"
@$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
build/html/$(DOXYGEN_API)/index.html: build/doxygen/html/index.html
@echo "[atlas-docs] Copy doxygen generated C++ api to build/html/$(DOXYGEN_API)"
@mkdir -p build/html
@cp -r build/doxygen/html build/html/$(DOXYGEN_API)
build/doxygen/html/index.html: build/doxygen/Doxyfile
ifeq ($(WITH_DOXYGEN),1)
@echo [atlas-docs] Building Doxygen C++ api generated at build/doxygen/html
@$(DOXYGEN) build/doxygen/Doxyfile
else
@echo "[atlas-docs] Building dummy Doxygen file (WITH_DOXYGEN=0)"
@mkdir -p build/doxygen/html
@touch build/doxygen/html/index.html
@touch build/doxygen/atlas.tag
endif
build/doxygen/Doxyfile: venv/bin/activate
@echo "[atlas-docs] Generating Doxyfile \"build/doxygen/Doxyfile\""
@$(GENERATE_DOXYFILE) $(GENERATEDOXYOPTS)
venv/bin/activate:
@echo "[atlas-docs] Pre-installing required software in virtual environment"
@scripts/setup.sh --atlas $(ATLAS_SOURCE_DIR) --eckit $(ECKIT_SOURCE_DIR) $(SETUPOPTS)
clean:
[ ! -d build ] || rm -rf build m.math.cache
@echo "[atlas-docs] Wiped build"
clean-venv:
[ ! -d venv ] || rm -rf venv
@echo "[atlas-docs] Wiped venv"
clean-downloads:
[ ! -d downloads ] || rm -rf downloads
@echo "[atlas-docs] Wiped downloads"
distclean: clean clean-venv clean-downloads
@echo "[atlas-docs] All clean now"
regenerate:
$(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
serve:
@echo "[atlas-docs] Open browser at http://localhost:$(PORT) (CTRL+C to end)"
@$(PELICAN) -l $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -p $(PORT)
devserver:
@echo "[atlas-docs] Open browser at http://localhost:$(PORT) (CTRL+C to end)"
$(PELICAN) -lr $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -p $(PORT)
doxygen: build/doxygen/html/index.html
@echo "[atlas-docs] Doxygen generated C++ API is created here:"
@echo "[atlas-docs] $(CURDIR)/build/doxygen/html/index.html"
doxyfile: build/doxygen/Doxyfile
@echo "[atlas-docs] Doxyfile generated: $(CURDIR)/build/doxygen/Doxyfile"
setup: venv/bin/activate
@echo "[atlas-docs] Setup finished: Created virtual environment at venv"
.PHONY: help regenerate serve devserver html doxygen setup doxyfile