Skip to content

Commit

Permalink
README: added notdir section.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuno-Jesus committed Jul 31, 2023
1 parent a789ce4 commit ae28af0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
30 changes: 28 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,7 @@ VAR has 6 words

The following functions were designed to handle file names or paths to files. The transformations take place in the same way for every file name and concatenated with a single space in the final result.

<details open>
<details>
<summary><h4>dir</h4> - extracts the directory part of a file</summary>

```
Expand All @@ -1253,10 +1253,36 @@ Output:
These are the directories: source/ source/ ./
```
</details>
<details>
<summary><h4>notdir</h4> - extracts the non-directory part of a file</summary>
```
$(notdir names…)
```
Extracts the non-directory part of every file contained in `names`. The non-directory part is considered to be all the characters from the last `\` is found (not including it).
Here's an example ([code/21-dir-example](code/21-dir-example)):
```Makefile
FILES = source/foo.c source/bar.c baz.c
all:
echo These are the files: $(notdir $(FILES))
.SILENT:
```

Output:

```
These are the directories: foo.c bar.c baz.c
```

</details>
<!--
Functions for file names
$(dir names…)
$(notdir names…)
$(addsuffix suffix,names…)
$(addprefix prefix,names…)
Expand Down
5 changes: 5 additions & 0 deletions code/21-notdir-example/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FILES = source/foo.c source/bar.c baz.c

all:
echo These are the files: $(notdir $(FILES))
.SILENT:

0 comments on commit ae28af0

Please sign in to comment.