Debian Codegraph @

doc/pasdoc/Makefile

raw symbols SCIP
1 # Main targets to gen final docs ----------------------------------------
2
3 # Avoid using WSL bash on GH-hosted runner windows-latest,
4 # by explicitly using GIT (MSys) bash.
5 # Note: Setting SHELL doesn't help.
6 #
7 # This is a hack, after a long fight with it -- no idea why this specific
8 # Makefile (but not others) seems to try to execute WSL bash in this sitiuation.
9 # Various tests on GH hosted runner with this script and mingw32-make,
10 # /c/mingw64/bin/make resulted in various weird errors
11 # (like make segfaulting, or "cp" not finding a dir that "ls" shows exists...).
12 # This seems like the most local workaround that reliably avoids the problem.
13 ifdef WINDOWS_FORCE_GIT_BASH
14 $(info Detected OS: Windows, using Git bash as SHELL)
15 #BASH:=gitbash # not found
16 BASH:="C:/Program Files/Git/bin/bash.exe"
17 else
18 BASH:=bash
19 endif
20
21 .PHONY: default html pdf latex php
22
23 # html is shown on https://castle-engine.io/apidoc/html/
24 default: html
25
26 # Run "make" in logo/ first,
27 # if you have inkscape installed,
28 # and you want to regenerate logo from png.
29 #
30 # Run "make" in html-parts/ first,
31 # if you have cge-www repository (https://github.com/castle-engine/cge-www)
32 # cloned and placed as a sibling to castle-engine, in ../../../cge-www/
33
34 html:
35 $(BASH) ./mk_docs.sh html
36 # For quick testing of docs look (CSS etc.), you can run this instead
37 # ./mk_docs.sh html base/castleutils.pas
38 rm -Rf ../reference/
39 mv html ../reference/
40 cp -R logo/castle_game_engine_icon.png \
41 html-parts/images/ \
42 html-parts/castle-engine-website-base/ \
43 html-parts/cge-pasdoc.js \
44 ../reference/
45
46 # Just some shortcuts to "Helpful targets" below
47 latex: latex/docs.tex
48 pdf: latex/docs.pdf
49
50 # Helpful targets to gen docs ----------------------------------------
51
52 latex/docs.tex:
53 $(BASH) ./mk_docs.sh latex
54
55 TEX_BATCH_OPTS := --file-line-error-style -interaction=nonstopmode
56
57 # At the end of pdf generating, we clean useless junk
58 # (because it's quite large, and I may want to upload latex/
59 # dir to WWW page of my units)
60 latex/docs.pdf: latex/docs.tex
61 -cd latex; pdflatex $(TEX_BATCH_OPTS) docs.tex
62 -cd latex; pdflatex $(TEX_BATCH_OPTS) docs.tex
63 rm -f latex/docs.aux \
64 latex/docs.log \
65 latex/docs.out \
66 latex/docs.toc
67
68 # PHP update -----------------------------------------------------------------
69
70 # Generate PHP map, copy it to cge-www repo (you should commit it there).
71 .PHONY: php
72 php:
73 $(BASH) ./mk_docs.sh php
74 cp -f php/docs.php ../../../cge-www/htdocs/apidoc_map_latest.php
75
76 # Cleaning ------------------------------------------------------------
77
78 .PHONY: clean-cache clean
79
80 clean-cache:
81 rm -fR cache/
82
83 clean: clean-cache
84 rm -Rf html/ latex/ php/ ../reference/
85
86 # upload ---------------------------------------------------------------------
87 #
88 # This "upload" command is not used by anything (like GitHub Actions) now.
89 # It is only useful for manual upload of the docs to the server by michalis,
90 # in case of emergency (e.g. when the automatic upload fails).
91
92 SSH_USERNAME=michalis
93 SSH_HOST=ssh.castle-engine.io
94 SSH_PATH=/home/michalis/cge-html/apidoc/
95
96 # Prepare and upload all the stuff referenced under
97 # https://castle-engine.io/apidoc/html/ .
98 # Uploads as tar.gz and unpacks on server, this is *much* faster than
99 # uploading separate HTML files.
100 .PHONY: upload
101 upload: clean html
102 rm -Rf ../reference/html
103 mv ../reference/ html
104 tar czf html.tar.gz html
105 scp -r html.tar.gz $(SSH_USERNAME)@$(SSH_HOST):$(SSH_PATH)
106 rm -f html.tar.gz
107 ./ssh_upload_finalize.sh $(SSH_USERNAME) $(SSH_HOST) $(SSH_PATH)