aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 41ca9dc9dc5133915fba4c076dea587b6739f9af (plain)
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
# runfile (`rfile`)

a **suckless** and **minimal**, **POSIX C99** alternative to `Makefile`/`justfile`!

---

## install `rf`

you can either install the AUR package `rf` with your favourite AUR helper

or build rfile manually with `gcc` or any other POSIX C99 compiler

---

## extra compile options

you can enable the following flags to enable extra feautures for `rf`:

> using `gcc` you can do `gcc -D FLAG_NAME ...`

- `RF_EXTRAS`: enables all `EXTRA_*` features
- `RF_EXTRA_MORE_COMMENTS`: enables `//` and `--` comments for `rfile`s
- `RF_HIDDEN_CMD`: hides the `$ cmd` for commands

---

## `rfile` syntax & features

- `#` -> ignore line (comment)


### variables

the variable system in `rfile`s is very minimal:

- every variable is a _string_
- when accessed, `rf` text-substitutes the variable with its content

example:
```
@cc=gcc
@inp=rf.c
@out=rf
@opts=-Wall -Wextra -pedantic -std=c99

@cc @inp -o @out @opts
# becomes 'gcc rf.c -o rf -Wall -Wextra -pedantic -std=c99'
```


### rfile command prefix (`@`) 

- `@:! [msg]` -> print/log with box/banner
- `@: [msg]` -> print/log
- `@var=cmd` -> create variable `var`
- `@var` -> access variable `var`


### command sections

example syntax:

```
section {
    @: hello!
}
```

every other line is treated as a command and will run normally.

> if no section is specified when calling `rf`, only commands in global scope will run.

---

## usage

1. create an `rfile`.
2. run `rf [section name]` :)