summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-13 00:37:32 +0000
committerZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-13 00:37:32 +0000
commitee53575f836f97ffc007241dff0ea6a64c6c2aeb (patch)
tree4e3a5210d564d5cdf17f5839a00a0a0368de3ce5 /README.md
parent7d67cf922c506ad1ba443e96ffcc46810f90478c (diff)
Added new section: 14. Build Directives.
Diffstat (limited to 'README.md')
-rw-r--r--README.md30
1 files changed, 30 insertions, 0 deletions
diff --git a/README.md b/README.md
index 2a54c26..2827662 100644
--- a/README.md
+++ b/README.md
@@ -435,6 +435,36 @@ fn add(a: int, b: int) -> int {
> **Note:** When using Intel syntax (via `-masm=intel`), you must ensure your build is configured correctly (for example, `//> cflags: -masm=intel`). TCC does not support Intel syntax assembly.
+### 14. Build Directives
+
+Zen C supports special comments at the top of your source file to configure the build process without needing a complex build system or Makefile.
+
+| Directive | Arguments | Description |
+|:---|:---|:---|
+| `//> link:` | `-lfoo` or `path/to/lib.a` | Link against a library or object file. |
+| `//> lib:` | `path/to/libs` | Add a library search path (`-L`). |
+| `//> include:` | `path/to/headers` | Add an include search path (`-I`). |
+| `//> cflags:` | `-Wall -O3` | Pass arbitrary flags to the C compiler. |
+| `//> define:` | `MACRO` or `KEY=VAL` | Define a preprocessor macro (`-D`). |
+| `//> pkg-config:` | `gtk+-3.0` | Run `pkg-config` and append `--cflags` and `--libs`. |
+| `//> shell:` | `command` | Execute a shell command during the build. |
+| `//> get:` | `http://url/file` | Download a file if specific file does not exist. |
+| `//> immutable-by-default` | None | Make variables immutable unless declared `mut`. |
+
+#### Examples
+
+```zc
+//> include: ./include
+//> lib: ./libs
+//> link: -lraylib -lm
+//> cflags: -Ofast
+//> pkg-config: gtk+-3.0
+
+import "raylib.h"
+
+fn main() { ... }
+```
+
---
## Compiler Support & Compatibility