summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Roztocil <jakub@roztocil.co>2022-06-07 14:29:19 +0200
committerJakub Roztocil <jakub@roztocil.co>2022-06-07 14:29:19 +0200
commitecff53f2d5dd3a032b9b0d17f53482190005f4fd (patch)
treea4db0e3318ac793643dc385b3285f516e02e0fef
parent41da87f7c877aa819b2a70b876332f094d351893 (diff)
Have naked `$ make` list all tasks
-rw-r--r--CONTRIBUTING.md8
-rw-r--r--Makefile20
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.
+# <https://stackoverflow.com/questions/4219255>
+###############################################################################
+
+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