1
0
mirror of https://github.com/craigerl/aprsd.git synced 2024-12-20 00:26:04 -05:00

Added self creating Makefile help target

This updates the Makefile to include a default target of help
and it automatically generates the help based on the targets
and their descriptions.
This commit is contained in:
Hemna 2021-09-03 16:49:16 -04:00
parent dfaf3aa3d1
commit d643ca3892

View File

@ -1,5 +1,7 @@
REQUIREMENTS_TXT ?= requirements.txt dev-requirements.txt
.DEFAULT_GOAL := help
.PHONY: dev docs server test
include Makefile.venv
Makefile.venv:
curl \
@ -9,50 +11,45 @@ Makefile.venv:
| sha256sum --check - \
&& mv Makefile.fetched Makefile.venv
all: pip dev
help: # Help for the Makefile
@egrep -h '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
.PHONY: dev
dev: venv
$(VENV)/pre-commit install
dev: venv ## Create the virtualenv with all the requirements installed
.PHONY: docs
docs: build
cp README.rst docs/readme.rst
cp Changelog docs/changelog.rst
tox -edocs
.PHONY: server
server: venv
$(VENV)/aprsd server --loglevel DEBUG
clean: clean-venv
clean: clean-venv ## Clean out any build artifacts to start over
rm -rf dist/*
.PHONY: test
test: dev
test: dev ## Run all the tox tests
tox -p all
build: test
build: test ## Make the build artifact prior to doing an upload
$(VENV)/python3 setup.py sdist bdist_wheel
$(VENV)/twine check dist/*
upload: build
upload: build ## Upload a new version of the plugin
$(VENV)/twine upload dist/*
docker: test
docker build -t hemna6969/aprsd:latest -f docker/Dockerfile docker
docker-dev: test
docker build -t hemna6969/aprsd:master -f docker/Dockerfile-dev docker
update-requirements: dev
$(VENV)/pip-compile requirements.in
$(VENV)/pip-compile dev-requirements.in
check: dev # Code format check with isort and black
check: dev ## Code format check with tox and pep8
tox -efmt-check
tox -epep8
fix: dev # fixes code formatting with isort and black
fix: dev ## fixes code formatting with gray
tox -efmt
server: venv ## Create the virtual environment and run aprsd server --loglevel DEBUG
$(VENV)/aprsd server --loglevel DEBUG
docker: test ## Make a docker container tagged with hemna6969/aprsd:latest
docker build -t hemna6969/aprsd:latest -f docker/Dockerfile docker
docker-dev: test ## Make a development docker container tagged with hemna6969/aprsd:master
docker build -t hemna6969/aprsd:master -f docker/Dockerfile-dev docker
update-requirements: dev ## Update the requirements.txt and dev-requirements.txt files
$(VENV)/pip-compile requirements.in
$(VENV)/pip-compile dev-requirements.in