|
2 | 2 |
|
3 | 3 | [](https://github.com/drdv/makefile-doc/actions/workflows/main.yml) |
4 | 4 |
|
5 | | -The `makefile-doc.awk` script is a POSIX-compliant extension of a simple `awk` one-liner |
6 | | -I have been using for years (it was based on [this |
7 | | -gist](https://gist.github.com/prwhite/8168133)). I simply needed a bit more |
8 | | -functionality and this turned out to be a nice small project with Awk. |
9 | | -[This](https://drdv.github.io/blog/202511-makefile-doc) blog post shows an example of |
10 | | -the documentation. |
| 5 | +The `makefile-doc.awk` script can be used to extract documentation from a Makefile. It |
| 6 | +is simply a more elaborate, POSIX-compliant, version of [this |
| 7 | +gist](https://gist.github.com/prwhite/8168133) one-liner. An example of the generated |
| 8 | +documentation can be seen [here](https://drdv.github.io/blog/202511-makefile-doc). |
11 | 9 |
|
12 | 10 | ## How to use |
13 | 11 |
|
@@ -43,9 +41,6 @@ help: ## show help |
43 | 41 |
|
44 | 42 | Manually download and place the `makefile-doc.awk` script on your `AWKPATH`. |
45 | 43 |
|
46 | | -It is assumed that `.RECIPEPREFIX` is a TAB, if this is not the case you should pass `-v |
47 | | -RECIPEPREFIX=$(.RECIPEPREFIX)` to `awk`. |
48 | | -
|
49 | 44 | ## Docs syntax |
50 | 45 |
|
51 | 46 | ```Makefile |
@@ -86,9 +81,6 @@ We refer to targets / variables as anchors (for docs/sections). |
86 | 81 | targets are displayed with a `&` at the end, e.g., `t1 t2 t3&`. Double-colon grouped |
87 | 82 | targets are handled as well. |
88 | 83 |
|
89 | | -+ Variable assignments can be prefixed with any or all of the special keywords `export`, |
90 | | - `unexport`, `override`, or `private` (in the documentation they are stripped). |
91 | | - |
92 | 84 | + See `test/Makefile*` for examples. |
93 | 85 |
|
94 | 86 | **Note**: in general, using inline comments with variables is not a good idea because |
@@ -208,14 +200,13 @@ without `#`). Foreground/background can be set using the tokens `FG/BG`. Unspeci |
208 | 200 |
|
209 | 201 | ## Running the tests |
210 | 202 |
|
211 | | -Execute `make test` (this uses the system's default `awk`). To test with a custom |
212 | | -`awk`, use (you need a standard build environment): |
| 203 | +Execute `make test utest` (this uses the system's default `awk`). To test with a custom |
| 204 | +`awk`, use: |
213 | 205 |
|
214 | | -+ `make test AWK=mawk` |
215 | | -+ `make test AWK=nawk` |
216 | | -+ `make test AWK=bawk` (binaries are not available for macos) |
217 | | -+ `make test AWK=wak` |
218 | | -+ `make test AWK=goawk` |
| 206 | ++ `make test utest AWK=mawk` |
| 207 | ++ `make test utest AWK=nawk` |
| 208 | ++ `make test utest AWK=bawk` (binaries are not available for macos) |
| 209 | ++ `make test utest AWK=wak` |
| 210 | ++ `make test utest AWK=goawk` |
219 | 211 |
|
220 | | -Note that the makefiles in `./test` are not meant to be used manually, they are part of |
221 | | -the tests. |
| 212 | +You need a standard build environment. |
0 commit comments