From ecff53f2d5dd3a032b9b0d17f53482190005f4fd Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Tue, 7 Jun 2022 14:29:19 +0200 Subject: [PATCH] Have naked `$ make` list all tasks --- CONTRIBUTING.md | 8 +++++--- Makefile | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 555aa913..67e07154 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -59,8 +59,10 @@ $ git checkout -b my_topical_branch #### Setup -The [Makefile](https://github.com/httpie/httpie/blob/master/Makefile) contains a bunch of tasks to get you started. Just run -the following command, which: +The [Makefile](https://github.com/httpie/httpie/blob/master/Makefile) contains a bunch of tasks to get you started. +You can run `$ make` to see all the available tasks. + +To get started, run the command below, which: - Creates an isolated Python virtual environment inside `./venv` (via the standard library [venv](https://docs.python.org/3/library/venv.html) tool); @@ -70,7 +72,7 @@ the following command, which: - and runs tests (It is the same as running `make install test`). ```bash -$ make +$ make all ``` #### Python virtual environment diff --git a/Makefile b/Makefile index 8672909b..dff8fc21 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,26 @@ VENV_PYTHON=$(VENV_BIN)/python export PATH := $(VENV_BIN):$(PATH) + +default: list-tasks + + +############################################################################### +# Default task to get a list of tasks when `make' is run without args. +# +############################################################################### + +list-tasks: + @echo Available tasks: + @echo ---------------- + @$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' + @echo + + +############################################################################### +# Installation +############################################################################### + all: uninstall-httpie install test