forked from minio/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
142 lines (115 loc) · 4.64 KB
/
Makefile
File metadata and controls
142 lines (115 loc) · 4.64 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
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?= -n -j auto -w "build.log"
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build
GITDIR = $(shell git rev-parse --abbrev-ref HEAD)
STAGINGURL = http://192.241.195.202:9000/staging
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# dry-run build command to double check output build dirs
dryrun:
@echo "$(SPHINXBUILD) -M $@ '$(SOURCEDIR)' '$(BUILDDIR)/$(GITDIR)' $(SPHINXOPTS) $(O)"
clean:
@echo "Cleaning $(BUILDDIR)/$(GITDIR)"
@rm -rf $(BUILDDIR)/$(GITDIR)
clean-%:
@echo "Cleaning $(BUILDDIR)/$(GITDIR)/$*"
@rm -rf $(BUILDDIR)/$(GITDIR)/$*
stage-%:
@if [ ! -d "$(BUILDDIR)/$(GITDIR)/$*" ]; then \
echo "$* build not found in $(BUILDDIR)/$(GITDIR)"; \
exit 1; \
fi
@(./stage.sh)
# Commenting out the older method
# python -m http.server --directory $(BUILDDIR)/$(GITDIR)/$*/html/
# @echo "Visit http://localhost:8000 to view the staged output"
# Platform build commands
# All platforms follow the same general pattern:
# - Rebuild source/conf.py
# - Synchronize relevant versions
# - If built with make SYNC_SDK=TRUE <platform>, synchronize SDK content from github
# - Compile SCSS
# - Build docs via Sphinx
mindocs:
@echo "--------------------------------------"
@echo " Building for MinIO "
@echo "--------------------------------------"
@cp source/default-conf.py source/conf.py
@make sync-deps
@make sync-operator-version
@make sync-deps
ifeq ($(SYNC_SDK),TRUE)
@make sync-sdks
else
@echo "Not synchronizing SDKs, pass SYNC_SDK=TRUE to synchronize SDK content"
endif
@npm run build
@$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)/$(GITDIR)/$@" $(SPHINXOPTS) $(O) -t $@
@echo -e "Building $@ Complete\n--------------------------------------\n"
# Synchronization targets
# Note that the @case statements are required to account for differences between Linux and MacOS binaries
# Specifically, MacOS does not use GNU utils, so syntax is slightly different for things like sed
# Annoying but necessary
sync-operator-version:
@echo "Retrieving latest Operator version"
@$(eval OPERATOR = $(shell curl --retry 10 -Ls -o /dev/null -w "%{url_effective}" https://github.com/minio/operator/releases/latest | sed "s/https:\/\/github.com\/minio\/operator\/releases\/tag\///" | sed "s/v//"))
@$(eval kname = $(shell uname -s))
@$(eval K8SFLOOR = $(shell curl -sL https://raw.githubusercontent.com/minio/operator/master/testing/kind-config-floor.yaml | grep -F -m 1 'node:v' | awk 'BEGIN { FS = ":" } ; {print $$3}'))
@echo "Updating Operator to ${OPERATOR}"
@$(eval kname = $(shell uname -s))
@case "${kname}" in \
"Darwin") \
sed -i "" "s|OPERATOR|${OPERATOR}|g" source/conf.py;\
sed -i "" "s|K8SFLOOR|${K8SFLOOR}|g" source/conf.py; \
;; \
*) \
sed -i "s|OPERATOR|${OPERATOR}|g" source/conf.py; \
sed -i "s|K8SFLOOR|${K8SFLOOR}|g" source/conf.py; \
;; \
esac
@echo "Updating Helm Charts"
# @$(shell curl --retry 10 -Ls -o source/includes/k8s/operator-values.yaml https://raw.githubusercontent.com/minio/operator/v${OPERATOR}/helm/operator/values.yaml)
sync-kes-version:
@echo "Retrieving latest stable KES version"
@$(eval KES = $(shell curl --retry 10 -Ls -o /dev/null -w "%{url_effective}" https://github.com/minio/kes/releases/latest | sed "s/https:\/\/github.com\/minio\/kes\/releases\/tag\///"))
@$(eval kname = $(shell uname -s))
@case "${kname}" in \
"Darwin") \
sed -i "" "s|KESLATEST|${KES}|g" source/conf.py;\
;; \
*) \
sed -i "s|KESLATEST|${KES}|g" source/conf.py; \
;; \
esac
sync-minio-server-docs:
@echo "Retrieving select docs from github.com/minio/minio/docs"
@(./sync-minio-server-docs.sh)
sync-minio-version:
@echo "Retrieving MinIO latest version and download URLs"
@(./sync-minio-version.sh)
sync-sdks:
@(./sync-docs.sh)
sync-operator-crd:
@(./sync-minio-operator-crd.sh)
# Can probably safely remove this at some point
sync-deps:
# C++ and Rust repos do not have any releases yet.
@echo "Synchronizing all external dependencies"
# @make sync-minio-version
@make sync-kes-version
@make sync-minio-server-docs
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@echo -e "----------------------------------------"
@echo -e "make mindocs"
@echo -e "Clean targets with 'make clean-<target>'"
@echo -e "Clean all targets with 'make clean'"
@echo -e "----------------------------------------"