summaryrefslogtreecommitdiff
path: root/examples/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'examples/Makefile')
-rw-r--r--examples/Makefile56
1 files changed, 56 insertions, 0 deletions
diff --git a/examples/Makefile b/examples/Makefile
new file mode 100644
index 0000000..a614627
--- /dev/null
+++ b/examples/Makefile
@@ -0,0 +1,56 @@
+# Makefile for nonstd.h examples
+
+CC = clang
+CFLAGS = -Wall -Wextra -std=c99 -fsanitize=address -g -O0
+LDFLAGS =
+
+# Example targets
+EXAMPLES = foreach stringv stringb array slice arena files
+
+# Default target
+all: $(EXAMPLES)
+
+# Build individual examples
+foreach: foreach.c
+ $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
+
+stringv: stringv.c
+ $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
+
+stringb: stringb.c
+ $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
+
+array: array.c
+ $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
+
+slice: slice.c
+ $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
+
+arena: arena.c
+ $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
+
+files: files.c
+ $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
+
+# Run all examples
+run: all
+ @echo "\n=== Running stringv ===\n"
+ @./stringv
+ @echo "\n=== Running stringb ===\n"
+ @./stringb
+ @echo "\n=== Running foreach ===\n"
+ @./foreach
+ @echo "\n=== Running array ===\n"
+ @./array
+ @echo "\n=== Running slice ===\n"
+ @./slice
+ @echo "\n=== Running arena ===\n"
+ @./arena
+ @echo "\n=== Running files ===\n"
+ @./files
+
+# Clean build artifacts
+clean:
+ rm -f $(EXAMPLES)
+
+.PHONY: all run clean