Merge pull request #2 from fromelicks/win

feat!: allow for script to be run of windows

Author Mitja Felicijan <mitja.felicijan@gmail.com> 2024-05-15 20:07:40 +0200
Committer GitHub <noreply@github.com> 2024-05-15 20:07:40 +0200
Commit d8e012878b2685e8047f402247ca8a6002cf6526 (patch)
-rw-r--r-- README.md 28
-rw-r--r-- makext.mk 5
2 files changed, 23 insertions, 10 deletions
diff --git a/README.md b/README.md
...
14
use it.
14
use it.
15
  
15
  
16
> [!NOTE]
16
> [!NOTE]
17
> This extensions are abusing GNU Make in some sense since it was not 
17
> These extensions are abusing GNU Make in some sense since it was not
18
> meant to really be a task runner. Keep that in mind. However, despite
18
> meant to really be a task runner. Keep that in mind. However, despite
19
> that, I constantly find myself using it as such.
19
> that, I constantly find myself using it as such.
20
  
20
  
21
### Extensions
21
## Extensions
22
  
22
  
23
| Extension   | Description                                         |
23
| Extension   | Description                                         |
24
|-------------|-----------------------------------------------------|
24
|-------------|-----------------------------------------------------|
25
| help        | Displays all targets with a comment in help format. |
25
| **help**        | Displays all targets with a comment in help format. |
26
| assure      | Check for the existence of programs on a machine.   |
26
| **assure**      | Check for the existence of programs on a machine.   |
27
| environment | Loads environmental variables from other files.     |
27
| **environment** | Loads environmental variables from other files.     |
28
  
28
  
29
Additional features:
29
Additional features:
30
  
30
  
...
35
  
35
  
36
- GNU Linux Debian 12 with GNU Make 4.3
36
- GNU Linux Debian 12 with GNU Make 4.3
37
- macOS Sonoma 14.4.1 with GNU Make 3.81
37
- macOS Sonoma 14.4.1 with GNU Make 3.81
  
38
- Windows 10/11 with GNU Make 4.4.1 for Windows32
38
  
39
  
39
If you have an idea for a new feature [open a new
40
If you have an idea for a new feature [open a new
40
issue](https://github.com/mitjafelicijan/makext/issues/new).
41
issue](https://github.com/mitjafelicijan/makext/issues/new).
41
  
42
  
42
## How to use
43
## How to use
43
  
44
  
  
45
> [!IMPORTANT]
  
46
> If you intend to use this script on Windows machine
  
47
> make sure you have all the [prerequisites](#windows-specific-instructions) installed.
  
48
  
44
First you will need to download `makext.mk` file from the repository to
49
First you will need to download `makext.mk` file from the repository to
45
the same directory where you have `Makefile`.
50
the same directory where you have `Makefile`.
46
  
51
  
...
60
> Make sure you create first target `help: .help` before any other
65
> Make sure you create first target `help: .help` before any other
61
> targets in your `Makefile`. GNU Make will execute first target if
66
> targets in your `Makefile`. GNU Make will execute first target if
62
> no target provided as an argument when calling `make`.
67
> no target provided as an argument when calling `make`.
  
68
  
  
69
### Windows specific instructions
  
70
  
  
71
On Windows OS'es you need the following:
  
72
  
  
73
- Git Bash for Windows
  
74
- make
  
75
  
  
76
All of the above can be conveniently installed via [Scoop](https://scoop.sh/):
  
77
  
  
78
```sh
  
79
scoop install main/git main/make
  
80
```
63
  
81
  
64
## Help extension
82
## Help extension
65
  
83
  
...
diff --git a/makext.mk b/makext.mk
...
10
# `makext` was written by Mitja Felicijan and is released under the BSD
10
# `makext` was written by Mitja Felicijan and is released under the BSD
11
# two-clause license, see the LICENSE file for more information.
11
# two-clause license, see the LICENSE file for more information.
12
  
12
  
13
# Checks if operating system is Windows and exists with error.
  
14
ifeq ($(OS),Windows_NT)
  
15
$(error makext does not support Windows operating system)
  
16
endif
  
17
  
  
18
# Load environmental files from `MEX_ENVIRONMENT`. By default GNU make
13
# Load environmental files from `MEX_ENVIRONMENT`. By default GNU make
19
# loads what is already in `env`. This extends it to other files.
14
# loads what is already in `env`. This extends it to other files.
20
ifdef MEX_ENVIRONMENT
15
ifdef MEX_ENVIRONMENT
...