This repository has been archived by the owner on Jul 16, 2023. It is now read-only.
forked from NHERI-SimCenter/SimCenterDocumentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
161 lines (125 loc) · 4.85 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
include Makefile.in
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = ./docs
BUILDDIR = ./build/$(1)
PYTHON = python3
# use shell pattern expansion to remove 'Tool' from R2DTool-Documentation
PUBLDIR = $(shell v="$(SIMDOC_APP)"; echo "../$${v%Tool}-Documentation/docs/")
# Directories to remove when cleaning
CLEANDIR = _sources _static _images common
CSVDIR = docs/common/reqments/_out/
JSONDIR = docs/common/reqments/data/
# This environment variable should specify a directory
# that contains both the SimCenterDocumentation/ and
# application source repositories.
export SIMCENTER_DEV = $(shell pwd | xargs dirname)
#-Help-----------------------------------------------------
help:
@echo 'usage: make <app> <target>'
@echo ' or: make <all|update>'
@printf '\n'
@echo 'where <app> is one of:'
@printf ' {pelicun, qfem, r2d, pbe, we, hydro, ee, rtm}\n\n'
@echo 'and <target> is one of:'
@echo ' web Run html target with build directory'
@echo ' set to app publishing repository.'
@echo ' html Run html target in dev build directory.'
@echo ' spell Run spell checker.'
@echo ' latex Run latex target in dev build directory.'
@printf "\nRunning 'make all' will run 'make <app> html'\n"
@printf "for all <app> options listed above.\n\n"
#----------------------------------------------------------
.PHONY: help Makefile pbe r2d qfem we ee rtm hydro html pdf latexpdf latex
# Export target-specific environment vars
ee: export SIMDOC_APP=EE-UQ
we: export SIMDOC_APP=WE-UQ
r2d: export SIMDOC_APP=R2DTool
pbe: export SIMDOC_APP=PBE
hydro: export SIMDOC_APP=HydroUQ
qfem: export SIMDOC_APP=quoFEM
pelicun: export SIMDOC_APP=pelicun
rtm: export SIMDOC_APP=requirements
export SIMDOC_APP
# LaTeX path variables
export TEXINPUTS:=${SIMCENTER_DEV}/SimCenterDocumentation/latex//:./build/${SIMDOC_APP}/latex//:${TEXINPUTS}
#export TEXINPUTS:=/usr/share/texmf-dist//:${TEXINPUTS}
export BSTINPUTS:=../texmf//:${BSTINPUTS}
all:
make pelicun html 2>&1 | grep 'build succ'
make qfem html 2>&1 | grep 'build succ'
make r2d html 2>&1 | grep 'build succ'
make we html 2>&1 | grep 'build succ'
make ee html 2>&1 | grep 'build succ'
make pbe html 2>&1 | grep 'build succ'
hydro pelicun rtm:
$(eval SIMDOC_APP=$(SIMDOC_APP))
pbe:
rm -f build/$(SIMDOC_APP)_Examples.json
make build/$(SIMDOC_APP)_Examples.json
$(eval SIMDOC_APP=$(SIMDOC_APP))
db:
@echo Generating temporary files for Damage and Loss Database docs...
cd ./docs/common/dldb && python3 generate_dldb_doc.py
r2d qfem we ee:
rm -f build/$(SIMDOC_APP)_Examples.json
make build/$(SIMDOC_APP)_Examples.json
$(eval SIMDOC_APP=$(SIMDOC_APP))
web:
find . -type f -name "*.rst" -exec touch {} +
@echo cleaning directories: $(addprefix $(PUBLDIR),$(CLEANDIR))
rm -fr $(addprefix $(PUBLDIR),$(CLEANDIR))
$(SPHINXBUILD) -b html "$(SOURCEDIR)" "$(PUBLDIR)" $(O)
@$(SPHINXBUILD) -b html "$(SOURCEDIR)" "$(PUBLDIR)" $(O)
@$(SPHINXBUILD) -b html "$(SOURCEDIR)" "$(PUBLDIR)" $(O)
spell:
@$(SPHINXBUILD) -b spelling "$(SOURCEDIR)" "$(call BUILDDIR,$(SIMDOC_APP))/html" $(O)
html:
for i in $(JSONDIR)/*.json; do \
json_file="$${i##*/}"; \
make $(CSVDIR)/$${json_file%.*}.csv; \
done
@$(SPHINXBUILD) -b html "$(SOURCEDIR)" "$(call BUILDDIR,$(SIMDOC_APP))/html" $(O)
latex:
@$(SPHINXBUILD) -b latex "$(SOURCEDIR)" "$(call BUILDDIR,$(SIMDOC_APP))/latex" $(O)
pdf:
mkdir -p $(call BUILDDIR,$(SIMDOC_APP))/pdf/
$(PDFLATEX) \
-output-directory="$(call BUILDDIR,$(SIMDOC_APP))/pdf/" \
$(join $(call BUILDDIR,$(SIMDOC_APP)),/latex/*.tex)
latexpdf:
make latex
make pdf
update:
pip install -U -r requirements.txt
examples:
rm -f build/$(SIMDOC_APP)_Examples.json
make build/$(SIMDOC_APP)_Examples.json
build/%.json: examples.yaml Makefile FORCE
$(PYTHON) scripts/index_examples.py $(SIMDOC_APP) \
| aurore -D- -B ../$(SIMDOC_APP)/Examples/ -C scripts/config.yml get \
> $(call BUILDDIR,$(SIMDOC_APP))_Examples.json
$(CSVDIR)/%.csv: $(JSONDIR)/%.json ./scripts/json2csv.py
python3 ./scripts/json2csv.py \
-Eqfem $(SIMCENTER_DEV)/quoFEM/Examples/qfem*/src/input.json \
-Eeeuq $(SIMCENTER_DEV)/EE-UQ/Examples/eeuq-*/src/input.json \
-Eweuq - \
-Epbdl $(SIMCENTER_DEV)/PBE/Examples/pbdl-*/src/input.json \
-Er2dt $(SIMCENTER_DEV)/R2DTool/Examples/E*/input.json \
-Ehydr - \
< '$<' > '$@'
csv-debug: FORCE
for i in $(JSONDIR)/*.json; do \
json_file="$${i##*/}"; \
echo $$json_file; \
python3 ./scripts/json2csv.py -v \
-Eqfem $(SIMCENTER_DEV)/quoFEM/Examples/qfem*/src/input.json \
-Eeeuq $(SIMCENTER_DEV)/EE-UQ/Examples/eeuq-*/src/input.json \
-Eweuq - \
-Epbdl $(SIMCENTER_DEV)/PBE/Examples/pbdl-*/src/input.json \
-Er2dt $(SIMCENTER_DEV)/R2DTool/Examples/E*/input.json \
-Ehydr - \
< "$(JSONDIR)/$$json_file"; \
done
FORCE:
.PHONY: csv-debug