forked from DataDog/documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
135 lines (119 loc) · 4.66 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
# make
.PHONY: clean clean-all clean-build clean-exe clean-integrations clean-auto-doc clean-node clean-virt help start stop
.DEFAULT_GOAL := help
PY3=$(shell if [ `which pyenv` ]; then \
if [ `pyenv which python3` ]; then \
printf `pyenv which python3`; \
fi \
elif command -v python3 > /dev/null 2>&1; then \
printf "python3"; \
else printf "false"; \
fi)
IMAGE_VERSION="latest"
# config
CONFIG_FILE := Makefile.config
ifeq ($(wildcard $(CONFIG_FILE)),)
$(error $(CONFIG_FILE) not found. See $(CONFIG_FILE).example.)
endif
include $(CONFIG_FILE)
help:
@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-25s\033[0m %s\n", $$1, $$2}'
clean: stop ## clean all make installs.
@echo "cleaning up..."
make clean-build
make clean-integrations
make clean-auto-doc
clean-all: stop ## clean everything.
make clean-build
make clean-exe
make clean-integrations
make clean-auto-doc
make clean-node
make clean-virt
clean-build: ## remove build artifacts.
@if [ -d public ]; then rm -r public; fi
clean-exe: ## remove execs.
@rm -rf ${EXE_LIST}
clean-integrations: ## remove built integrations files.
@rm -rf ./integrations_data/
@if [ -d data/integrations ]; then \
find ./data/integrations -type f -maxdepth 1 \
-a -not -name '*.fr.yaml' \
-exec rm -rf {} \; ;fi
@if [ -d data/service_checks ]; then \
find ./data/service_checks -type f -maxdepth 1 \
-a -not -name '*.fr.json' \
-exec rm -rf {} \; ;fi
@find ./content/en/integrations -type f -maxdepth 1 \
-a -not -name '_index.md' \
-a -not -name 'adobe_experience_manager.md' \
-a -not -name 'amazon_guardduty.md' \
-a -not -name 'amazon_vpc.md' \
-a -not -name 'amazon_cloudhsm.md' \
-a -not -name 'cloud_foundry.md' \
-a -not -name 'cloudability.md' \
-a -not -name 'cloudcheckr.md' \
-a -not -name 'fluentbit.md' \
-a -not -name 'integration_sdk.md' \
-a -not -name 'jenkins.md' \
-a -not -name 'journald.md' \
-a -not -name 'kubernetes.md' \
-a -not -name 'marklogic.md' \
-a -not -name 'nxlog.md' \
-a -not -name 'rss.md' \
-a -not -name 'rsyslog.md' \
-a -not -name 'sidekiq.md' \
-a -not -name 'sinatra.md' \
-a -not -name 'stunnel.md' \
-a -not -name 'syslog_ng.md' \
-a -not -name 'system.md' \
-a -not -name 'tcprtt.md' \
-a -not -name 'uwsgi.md' \
-a -not -name '*.fr.md' \
-exec rm -rf {} \;
clean-auto-doc: ##remove all doc automatically created
@if [ -d content/en/developers/integrations ]; then \
find ./content/en/developers/integrations -type f -maxdepth 1 -exec rm -rf {} \; ;fi
@if [ content/en/agent/basic_agent_usage/heroku.md ]; then \
rm -f content/en/agent/basic_agent_usage/heroku.md ;fi
@if [ content/en/tracing/setup/ruby.md ]; then \
rm -f content/en/tracing/setup/ruby.md ;fi
clean-node: ## remove node_modules.
@if [ -d node_modules ]; then rm -r node_modules; fi
clean-virt: ## remove python virtual env.
@if [ -d ${VIRENV} ]; then rm -rf $(VIRENV); fi
hugpython: hugpython/bin/activate ## build virtualenv used for tests.
hugpython/bin/activate: local/etc/requirements3.txt ## start python virtual environment.
@if [ ${PY3} != "false" ]; then \
test -x ${VIRENV}/bin/pip || ${PY3} -m venv --clear ${VIRENV}; \
$(VIRENV)/bin/pip install -r local/etc/requirements3.txt; \
else printf "\e[93mPython 3 is required to fetch integrations and run tests.\033[0m Try https://github.com/pyenv/pyenv.\n"; fi
source-helpers: hugpython ## source the helper functions used in build, test, deploy.
@mkdir -p ${EXEDIR}
@find ${LOCALBIN}/* -type f -exec cp {} ${EXEDIR} \;
@cp -r local/githooks/* .git/hooks
@c++ -Wall -Werror -O2 local/etc/format-links.cpp -o local/bin/format-links
# ARGS=<file> will format that file
# ARGS=<directory> will recursively format all english markdown files inside <directory>
# empty ARGS will format all english markdown files inside content/en/
link-formatting: source-helpers
@local/bin/sh/format-links.sh $(ARGS)
start: clean source-helpers ## start the webpack/hugo server.
@echo "starting up..."
@if [ ${PY3} != "false" ]; then \
source ${VIRENV}/bin/activate; \
FETCH_INTEGRATIONS=${FETCH_INTEGRATIONS} \
GITHUB_TOKEN=${GITHUB_TOKEN} \
RUN_SERVER=${RUN_SERVER} \
CREATE_I18N_PLACEHOLDERS=${CREATE_I18N_PLACEHOLDERS} \
CONFIGURATION_FILE=${CONFIGURATION_FILE} \
run-site.sh; \
else \
FETCH_INTEGRATIONS="false" \
CREATE_I18N_PLACEHOLDERS="false" \
RUN_SERVER=${RUN_SERVER} \
run-site.sh; fi
stop: ## stop wepack watch/hugo server.
@echo "stopping previous..."
@pkill -x webpack || true
@pkill -x hugo server --renderToDisk || true