-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME.md.template
executable file
·94 lines (57 loc) · 2.77 KB
/
README.md.template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/usr/bin/env bash
phpMakefile=$(cat php/Makefile) sqliteMakefile=$(cat sqlite/Makefile) nodejsMakefile=$(cat nodejs/Makefile) pythonMakefile=$(cat python/Makefile) RecipeprefixSection=$(cat recipeprefix.md) envsubst <<'EOL'
# Makefile recipes in various languages
Using make does not mean that you have to learn shell scripting
(although it's always a good idea to have at least basic knowledge about it).
__The important point is : You can use almost any scripting language for make recipes, not just shell scripts !__
- Thats how a Makefile looks using NodeJS as make `SHELL` :
```make
$nodejsMakefile
```
- Do you prefer Python ? Yes, it's possible !
```make
$pythonMakefile
```
- What about PHP ? Yes, you can :
```make
$phpMakefile
```
- How about something special ... let's say we want use SQL (SQLite in this case) as make SHELL:
```make
$sqliteMakefile
```
---
Make is a tool following the classic Unix philosophy :
> Make each program do one thing well.
Make does
- resolve tasks (aka targets) and their dependencies
- execute target recipe if a target is not build/out-of-date
The recipe target can be written in whatever scripting language you want.
It is configurable using make variables `SHELL` and `.SHELLFLAGS`
## configuration
- make takes the `SHELL` defined in your makefile for executing target recipes.
make will replace all [make variables](https://ftp.gnu.org/old-gnu/Manuals/make-3.79.1/html_chapter/make_6.html) used in a target recipe before delegating them to the declared `SHELL`
- the `.SHELLFLAGS` directive can be used to customize the commandline parameters used for SHELL execution.
## Examples
This repo provides some examples using make with pure
- NodeJS
- Python
- SQLite3
- PHP
- and even make in make 🤯
__If you have some more ideas to showcase - create a pull request !__
### Usage
The execute an example
- `cd` into the desired example directory
- execute `make`
# Some more helpful `make` settings
- `.ONESHELL` tells make to execute target recipe lines in a single SHELL invocation.
That is what most people want !
_By default, every recipe line would be executed in a separate SHELL call._
- `MAKEFLAGS` can be used to customize make behaviour.
I personally prefer to set `MAKEFLAGS+=--no-builtin-rules --no-builtin-variables` disable stone age old buil-tin rules/variables of make dedicated to c/c++ development of the eighties.
- `--no-builtin-variables` tells make to not create out of the box variables like $(CC), $(YACC) and stuff
- `--no-builtin-rules` tells make to not create c/c++ standard rules for targeting yacc/c/cc++ files
- `.SECONDEXPANSION` is pure magic. It makes make target dependencies dynamic. Read more here : https://www.cmcrossroads.com/article/making-directories-gnu-make
$RecipeprefixSection
EOL