|
diff --git a/README.md b/README.md
|
| ... |
| 17 |
- Automatic description inclusion in help message. |
17 |
- Automatic description inclusion in help message. |
| 18 |
- Automatic license inclusion in help message. |
18 |
- Automatic license inclusion in help message. |
| 19 |
|
19 |
|
|
|
20 |
## How to use |
|
|
21 |
|
|
|
22 |
First you will need to download `makext.mk` file from the repository to |
|
|
23 |
the same directory where you have `Makefile`. |
|
|
24 |
|
|
|
25 |
```sh |
|
|
26 |
wget -O makext.mk https://github.com/mitjafelicijan/makext/raw/master/makext.mk |
|
|
27 |
``` |
|
|
28 |
|
|
|
29 |
Now you can include it in your `Makefile`. |
|
|
30 |
|
|
|
31 |
```make |
|
|
32 |
include makext.mk |
|
|
33 |
|
|
|
34 |
help: .help |
|
|
35 |
``` |
|
|
36 |
|
|
|
37 |
> [!IMPORTANT] |
|
|
38 |
> Make sure you create first target `help: .help` before any other |
|
|
39 |
> targets in your `Makefile`. GNU Make will execute first target if |
|
|
40 |
> no target provided as an argument when calling `make`. |
|
|
41 |
|
|
|
42 |
### Help extension |
|
|
43 |
|
|
|
44 |
This is all that is needed to start using `makext`. One of the extensions |
|
|
45 |
is `.help` which displays all the targets in the `Makefile` and their |
|
|
46 |
descriptions which are provided as comments next to the target definition. |
|
|
47 |
|
|
|
48 |
Lets check how and example `Makefile` would look. |
|
|
49 |
|
|
|
50 |
```make |
|
|
51 |
include makext.mk |
|
|
52 |
|
|
|
53 |
help: .help |
|
|
54 |
|
|
|
55 |
build-app: clean-cache # Build the application |
|
|
56 |
@echo "Building the application..." |
|
|
57 |
|
|
|
58 |
clean-cache: # Clean the cache |
|
|
59 |
@echo "Cleaning the cache..." |
|
|
60 |
|
|
|
61 |
deploy-prod: # Deploy to production |
|
|
62 |
@echo "Deploying to production..." |
|
|
63 |
|
|
|
64 |
run-tests: |
|
|
65 |
@echo "Running tests..." |
|
|
66 |
``` |
|
|
67 |
|
|
|
68 |
This will give us under we execute command `make` the following result. |
|
|
69 |
|
|
|
70 |
``` |
|
|
71 |
Targets: |
|
|
72 |
build-app Build the application |
|
|
73 |
clean-cache Clean the cache |
|
|
74 |
deploy-prod Deploy to production |
|
|
75 |
run-tests Run tests |
|
|
76 |
``` |
|
|
77 |
|
|
|
78 |
- Targets without defined comments next to the target will be ignored |
|
|
79 |
from help list. |
|
|
80 |
- Targets that start with `.` will also be ignored. |
|
|
81 |
|
| 20 |
## Acknowledgement |
82 |
## Acknowledgement |
| 21 |
|
83 |
|
| 22 |
- https://stackoverflow.com/a/59087509 |
84 |
- https://stackoverflow.com/a/59087509 |
| ... |