glances/Makefile

108 lines
4.3 KiB
Makefile
Raw Normal View History

2018-12-27 09:10:26 +00:00
PORT?=8008
2021-06-12 07:42:02 +00:00
LASTTAG = $(shell git describe --tags --abbrev=0)
2018-12-27 09:10:26 +00:00
2022-07-05 21:34:58 +00:00
# if the command is only `make`, the default tasks will be the printing of the help.
.DEFAULT_GOAL := help
.PHONY: help
help: ## List all make commands available
@grep -E '^[\.a-zA-Z_%-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk -F ":" '{print $1}' | grep -v % | sed 's/\\//g' | sort | awk 'BEGIN {FS = ":[^:]*?##"}; {printf "\033[1;34mmake %-50s\033[0m %s\n", $$1, $$2}'
2022-07-09 07:03:39 +00:00
install: ## Open a Web Browser to the installation procedure
2018-12-27 09:10:26 +00:00
sensible-browser "https://github.com/nicolargo/glances#installation"
2022-07-09 07:03:39 +00:00
venv-python: ## Install Python 3 venv
2021-05-29 16:48:27 +00:00
virtualenv -p /usr/bin/python3 venv
2018-12-27 09:10:26 +00:00
2022-08-20 07:00:19 +00:00
venv-dev: venv-python ## Install Python 3 dev dependencies
2021-05-29 16:48:27 +00:00
./venv/bin/pip install -r dev-requirements.txt
./venv/bin/pip install -r doc-requirements.txt
2018-12-27 09:10:26 +00:00
2022-08-20 07:00:19 +00:00
venv-dev-upgrade: venv-dev ## Upgrade Python 3 dev dependencies
./venv/bin/pip install --upgrade pip
2021-05-29 16:48:27 +00:00
./venv/bin/pip install --upgrade -r dev-requirements.txt
./venv/bin/pip install --upgrade -r doc-requirements.txt
2021-04-11 08:39:30 +00:00
2022-08-20 07:00:19 +00:00
venv: venv-python ## Install Python 3 run-time dependencies
./venv/bin/pip install -r requirements.txt
./venv/bin/pip install -r optional-requirements.txt
2022-08-20 07:00:19 +00:00
venv-upgrade: venv ## Upgrade Python 3 run-time dependencies
2021-05-29 16:48:27 +00:00
./venv/bin/pip install --upgrade -r dev-requirements.txt
./venv/bin/pip install --upgrade -r requirements.txt
./venv/bin/pip install --upgrade -r optional-requirements.txt
2022-08-20 07:00:19 +00:00
test: venv-upgrade venv-dev-upgrade ## Run unit tests
2021-06-12 07:42:02 +00:00
./venv/bin/python ./unitest.py
./venv/bin/python ./unitest-restful.py
./venv/bin/python ./unitest-xmlrpc.py
2022-03-20 08:13:02 +00:00
./venv/bin/python -m black ./glances --check --exclude outputs/static
./venv/bin/pyright glances
2022-08-20 07:00:19 +00:00
format: venv-dev-upgrade ## Format the code
2022-03-20 08:13:02 +00:00
./venv/bin/python -m black ./glances --exclude outputs/static
2021-05-29 16:48:27 +00:00
2022-08-20 07:00:19 +00:00
docs: venv-dev-upgrade ## Create the documentation
2021-07-17 07:31:07 +00:00
./venv/bin/python -m glances -C ./conf/glances.conf --api-doc > ./docs/api.rst
cd docs && ./build.sh && cd ..
2021-05-29 16:48:27 +00:00
2022-07-09 07:03:39 +00:00
docs-server: docs ## Start a Web server to serve the documentation
2021-05-29 16:48:27 +00:00
(sleep 2 && sensible-browser "http://localhost:$(PORT)") &
cd docs/_build/html/ && ../../../venv/bin/python -m http.server $(PORT)
2021-05-29 16:48:27 +00:00
2022-08-20 07:00:19 +00:00
webui: venv-dev-upgrade ## Build the Web UI
2021-11-11 09:46:29 +00:00
cd glances/outputs/static/ && npm ci && npm run build
2021-05-29 16:48:27 +00:00
2022-08-20 07:00:19 +00:00
webui-audit: venv-dev-upgrade ## Audit the Web UI
2022-07-29 11:17:03 +00:00
cd glances/outputs/static/ && npm audit
2022-07-09 07:03:39 +00:00
run: ## Start Glances in console mode (also called standalone)
./venv/bin/python -m glances -C ./conf/glances.conf
2022-07-09 07:03:39 +00:00
run-debug: ## Start Glances in debug console mode (also called standalone)
./venv/bin/python -m glances -C ./conf/glances.conf -d
2022-07-09 07:03:39 +00:00
run-webserver: ## Start Glances in Web server mode
./venv/bin/python -m glances -C ./conf/glances.conf -w
2022-07-09 07:03:39 +00:00
run-restapiserver: ## Start Glances in REST API server mode
2021-07-16 13:39:24 +00:00
./venv/bin/python -m glances -C ./conf/glances.conf -w --disable-webui
2022-07-09 07:03:39 +00:00
run-server: ## Start Glances in server mode (RPC)
./venv/bin/python -m glances -C ./conf/glances.conf -s
2022-07-09 07:03:39 +00:00
run-client: ## Start Glances in client mode (RPC)
./venv/bin/python -m glances -C ./conf/glances.conf -c localhost
2022-07-09 07:03:39 +00:00
run-browser: ## Start Glances in browser mode (RPC)
2021-06-13 08:49:01 +00:00
./venv/bin/python -m glances -C ./conf/glances.conf --browser
2022-07-09 07:03:39 +00:00
show-version: ## Show Glances version number
2021-06-13 08:49:01 +00:00
./venv/bin/python -m glances -C ./conf/glances.conf -V
2022-07-09 07:03:39 +00:00
show-issue: ## Generate output for a new issue
2021-06-13 08:49:01 +00:00
./venv/bin/python -m glances -C ./conf/glances.conf --issue
2022-07-09 07:03:39 +00:00
profiling: ## How to start the profiling of the Glances software
2021-06-05 15:40:47 +00:00
@echo "Please complete and run: sudo ./venv/bin/py-spy record -o ./docs/_static/glances-flame.svg -d 60 -s --pid <GLANCES PID>"
2022-07-09 07:03:39 +00:00
trace-malloc: ## Trace the malloc() calls
2022-02-25 10:24:12 +00:00
@echo "Malloc test is running, please wait ~30 secondes..."
2022-02-20 08:38:53 +00:00
./venv/bin/python -m glances -C ./conf/glances.conf --trace-malloc --stop-after 15 --quiet
2022-07-09 07:03:39 +00:00
memory-leak: ## Profile memory leaks
2022-02-25 10:24:12 +00:00
./venv/bin/python -m glances -C ./conf/glances.conf --memory-leak
2022-07-09 07:03:39 +00:00
release-note: ## Generate release note
2021-06-12 17:15:31 +00:00
git --no-pager log $(LASTTAG)..HEAD --first-parent --pretty=format:"* %s"
2021-08-14 10:45:53 +00:00
@echo "\n"
2021-06-12 17:15:31 +00:00
git --no-pager shortlog -s -n $(LASTTAG)..HEAD
2021-06-12 07:42:02 +00:00
2022-08-20 07:00:19 +00:00
flatpak: venv-dev-upgrade ## Generate FlatPack JSON file
git clone https://github.com/flatpak/flatpak-builder-tools.git
./venv/bin/python ./flatpak-builder-tools/pip/flatpak-pip-generator glances
rm -rf ./flatpak-builder-tools
2022-08-20 07:00:19 +00:00
@echo "Now follow: https://github.com/flathub/flathub/wiki/App-Submission"
2022-05-03 06:22:43 +00:00
.PHONY: test docs docs-server venv