forked from EKGF/ekg-maturity
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
184 lines (149 loc) · 6.34 KB
/
Makefile
File metadata and controls
184 lines (149 loc) · 6.34 KB
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
ifeq ($(OS),Windows_NT)
YOUR_OS := Windows
INSTALL_TARGET := install-windows
OPEN_EDITORS_VERSION_TARGET := open-editors-version-windows
OPEN_RELEASE_VERSION_TARGET := open-release-version-windows
else
YOUR_OS := $(shell sh -c 'uname 2>/dev/null || echo Unknown')
ifeq ($(YOUR_OS), Linux)
INSTALL_TARGET := install-linux
OPEN_EDITORS_VERSION_TARGET := open-editors-version-linux
OPEN_RELEASE_VERSION_TARGET := open-release-version-linux
endif
ifeq ($(YOUR_OS), Darwin)
INSTALL_TARGET := install-macos
OPEN_EDITORS_VERSION_TARGET := open-editors-version-macos
OPEN_RELEASE_VERSION_TARGET := open-release-version-macos
endif
endif
DOC_ORG_NAME := ekgf
DOC_ROOT_NAME := ekg-mm
CURRENT_BRANCH := $(shell git branch --show-current)
DOC_VERSION := $(shell cat $(DOC_ROOT_NAME)/VERSION)
PDF_FILE_NAME_SUFFIX := $(subst -main,,$(DOC_VERSION)-$(USER)-$(CURRENT_BRANCH))
PDF_EDITORS_VERSION := $(subst .,-,$(subst _,-,$(DOC_ROOT_NAME)/$(DOC_ORG_NAME)-$(DOC_ROOT_NAME)-editors-version-$(PDF_FILE_NAME_SUFFIX))).pdf
PDF_RELEASE_VERSION := $(subst .,-,$(subst _,-,$(DOC_ROOT_NAME)/$(DOC_ORG_NAME)-$(DOC_ROOT_NAME)-$(PDF_FILE_NAME_SUFFIX))).pdf
PDF_ASSET_EDITORS_VERSION := docs/assets/$(DOC_ORG_NAME)-$(DOC_ROOT_NAME)-editors-version.pdf
PDF_ASSET_RELEASE_VERSION := docs/assets/$(DOC_ORG_NAME)-$(DOC_ROOT_NAME).pdf
MKDOCS = $(shell asdf where python)/bin/mkdocs
.PHONY: all
all: $(PDF_EDITORS_VERSION) $(PDF_RELEASE_VERSION)
.PHONY: info
info:
@echo "MkDocs: ${MKDOCS}"
@echo "Document Version: ${DOC_VERSION}"
@echo "Git Branch: ${CURRENT_BRANCH}"
@echo "PDF Suffix: ${PDF_FILE_NAME_SUFFIX}"
@echo "Release Version: ${PDF_RELEASE_VERSION}"
@echo "Editor's Version: ${PDF_EDITORS_VERSION}"
@echo "Release Version in assets directory: ${PDF_ASSET_RELEASE_VERSION}"
@echo "Editor's Version in assets directory: ${PDF_ASSET_EDITORS_VERSION}"
.PHONY: open-editors-version-windows
open-editors-version-windows:
@echo "We did not implement this yet for Windows"
.PHONY: open-editors-version-linux
open-editors-version-linux:
@echo "We did not implement this yet for Linux"
.PHONY: open-editors-version-macos
open-editors-version-macos: $(PDF_EDITORS_VERSION)
skim $(PDF_EDITORS_VERSION)
.PHONY: open-release-version-windows
open-release-version-windows:
@echo "We did not implement this yet for Windows"
.PHONY: open-release-version-linux
open-release-version-linux:
@echo "We did not implement this yet for Linux"
.PHONY: open-release-version-macos
open-release-version-macos: $(PDF_RELEASE_VERSION)
skim $(PDF_RELEASE_VERSION)
.PHONY: open-editors-version
open-editors-version: $(OPEN_EDITORS_VERSION_TARGET)
.PHONY: open-release-version
open-release-version: $(OPEN_RELEASE_VERSION_TARGET)
.PHONY: install-macos
install-macos:
brew list --cask -1 | grep -q mactex || brew install --cask mactex-no-gui # see https://formulae.brew.sh/cask/mactex-no-gui
sudo tlmgr update --self
sudo tlmgr update --all
sudo tlmgr install texdoc # used by IntelliJ editor and other editors for documentation of packages
brew list --cask -1 | grep -q skim || brew install --cask skim
./latex-lib/install-as-subtree.sh
cp -R etc/fonts/*.ttf ~/Library/Fonts/
@echo "Exit this terminal and open a new one because your PATH has changed"
.PHONY: install-linux
install-linux:
./latex-lib/install-as-subtree.sh
cp -R etc/fonts/*.ttf /usr/local/share/fonts
.PHONY: install
install: $(INSTALL_TARGET)
.PHONY: release-version
release-version: $(PDF_RELEASE_VERSION)
$(PDF_RELEASE_VERSION): $(wildcard $(DOC_ROOT_NAME)/**/*.tex)
latex_document_mode=release-version latex_document_main=$(DOC_ROOT_NAME) latex_customer_code=$(DOC_ORG_NAME) latexmk -gg
.PHONY: editors-version
editors-version: $(PDF_EDITORS_VERSION)
$(PDF_EDITORS_VERSION): $(wildcard $(DOC_ROOT_NAME)/**/*.tex)
latex_document_mode=editors-version latex_document_main=$(DOC_ROOT_NAME) latex_customer_code=$(DOC_ORG_NAME) latexmk -gg
.PHONY: clean
clean:
@echo "Removing all generated files"
@cd $(DOC_ROOT_NAME) && rm -f *.acn *.acr *.alg *.aux *.bbl *.bcf *.blg *.fdb* *.fls *.gl? *.idx *.ilg *.ind *.ist *.log *.odn *.ol? *.pdf *.run.xml *.sync* *.tdn *.tl? *.toc
.PHONY: docs-install
docs-install:
brew upgrade asdf || brew install asdf
asdf plugin add python || true
asdf plugin add nodejs || true
asdf local python latest
asdf local nodejs 12.17.0
asdf exec python -m pip install --upgrade pip
pip install --upgrade mkdocs
pip install --upgrade mkdocs-material
pip install --upgrade mkdocs-localsearch
pip install --upgrade mdx-spanner
pip install --upgrade mkdocs-awesome-pages-plugin
pip install --upgrade mkdocs-macros-plugin
brew upgrade cairo || brew install cairo
brew upgrade freetype || brew install freetype
brew upgrade libffi || brew install libffi
brew upgrade libjpeg || brew install libjpeg
brew upgrade libpng || brew install libpng
brew upgrade zlib || brew install zlib
.PHONY: docs-build
docs-build:
$(MKDOCS) build
.PHONY: docs-serve
docs-serve: docs-assets
$(MKDOCS) serve --livereload --strict --watch-theme
.PHONY: docs-serve-debug
docs-serve-debug:
$(MKDOCS) serve --livereload --strict --watch-theme --verbose
.PHONY: docs-deploy
docs-deploy:
$(MKDOCS) gh-deploy --verbose
docs/index.html: $(wildcard docs/*.md) mkdocs.yml
$(MKDOCS) build
open site/index.html
.PHONY: docs-assets
docs-assets: $(PDF_ASSET_EDITORS_VERSION) $(PDF_ASSET_RELEASE_VERSION)
.PHONY: docs-sync-from
docs-sync-from: docs-sync-from-ekg-mm docs-sync-from-ekg-manifesto
.PHONY: docs-sync-to
docs-sync-to: docs-sync-to-ekg-mm docs-sync-to-ekg-manifesto
.PHONY: docs-sync
docs-sync: docs-sync-from docs-sync-to
.PHONY: docs-sync-from-ekg-mm
docs-sync-from-ekg-mm: $(wildcard ../ekg-mm/docs-overrides/*)
rsync --checksum --recursive --update --itemize-changes --verbose ../ekg-mm/docs-overrides/ docs-overrides/
.PHONY: docs-sync-to-ekg-mm
docs-sync-to-ekg-mm: $(wildcard ../ekg-mm/Makefile)
cd ../ekg-mm && make docs-sync-from
.PHONY: docs-sync-from-ekg-manifesto
docs-sync-from-ekg-manifesto: $(wildcard ../ekg-manifesto/docs-overrides/*)
rsync --checksum --recursive --update --itemize-changes --verbose ../ekg-manifesto/docs-overrides/ docs-overrides/
.PHONY: docs-sync-to-ekg-manifesto
docs-sync-to-ekg-manifesto: $(wildcard ../ekg-manifesto/Makefile)
cd ../ekg-manifesto && make docs-sync-from
$(PDF_ASSET_EDITORS_VERSION): $(PDF_EDITORS_VERSION)
cp -v $< $@
$(PDF_ASSET_RELEASE_VERSION): $(PDF_RELEASE_VERSION)
cp -v $< $@