-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile
51 lines (43 loc) · 1.55 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
##########################################################
# #
# Kubernetes Adoption Journey documentation Makefile #
# #
##########################################################
PYTHON3_CMD ?= python3
PIP3_CMD ?= pip3
VIRTUALENV_CMD ?= virtualenv
MKDOCS_CMD ?= mkdocs
# if changing VENV_FOLDER, .gitignore must be changed as well
VENV_FOLDER ?= .venv
PROJ_REQUIREMENTS_FILE ?= requirements.txt
export DOCS_DIR ?= docs
export SITE_DIR ?= site
export SITE_URL ?= https://k8s-adoption-journey.github.io
.ONESHELL:
ENV_PREFIX=$(shell $(PYTHON3_CMD) -c "if __import__('pathlib').Path('$(VENV_FOLDER)/bin/$(PIP3_CMD)').exists(): print('$(VENV_FOLDER)/bin/')")
.PHONY: create-venv
create-venv:
@$(PIP3_CMD) install virtualenv
@$(VIRTUALENV_CMD) $(VENV_FOLDER)
.PHONY: install
install: create-venv
@$(ENV_PREFIX)$(PIP3_CMD) install -r $(PROJ_REQUIREMENTS_FILE)
# Pass arguments to mkdocs directly
# This way, you can run:
# - `make new` to create a new project
# - `make build` to build a project
# - `make serve` to serve a project static content locally
# etc.
# Also, everything happens in a Python virtual env
.PHONY: Makefile
%: install Makefile
@$(ENV_PREFIX)$(MKDOCS_CMD) $@
.PHONY: help
help: install
@$(ENV_PREFIX)$(MKDOCS_CMD) --help
.PHONY: clean
clean:
@echo "Cleaning up python venv ..."
@rm -rf $(VENV_FOLDER)
@echo "Cleaning up mkdocs site ..."
@rm -rf $(SITE_DIR)