summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorFilip Wandzio <contact@philw.dev>2026-03-01 01:03:39 +0100
committerFilip Wandzio <contact@philw.dev>2026-03-01 01:03:39 +0100
commitbf0d77d7d448e964e9716d5af67c48f3d014f090 (patch)
treee55f1e91a8c20cd737dfb01dc12a954c25711e01 /Makefile
downloadembedded_guardian-bf0d77d7d448e964e9716d5af67c48f3d014f090.tar.gz
embedded_guardian-bf0d77d7d448e964e9716d5af67c48f3d014f090.zip
Scaffold basic project tree, implement benchmarking logic
Implement unit testing guardian
Diffstat (limited to '')
-rw-r--r--Makefile48
1 files changed, 48 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..4d0bb31
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,48 @@
1# ================= COMPILER SETTINGS =================
2CC ?= gcc
3CFLAGS ?= -Wall -Wextra -Werror -std=c18 -Iinclude -Ibenchmark
4LDFLAGS ?=
5
6SRC_DIR := src
7TEST_DIR := tests
8BENCH_DIR := benchmark
9BUILD_DIR := build
10
11SRC := $(SRC_DIR)/syntax_essentials.c benchmark/benchmark.c benchmark/resource_usage.c
12TESTS := $(wildcard $(TEST_DIR)/*.c)
13
14OUT_HOST := $(BUILD_DIR)/syntax_essentials_tests_host
15
16# ================= TARGETS =================
17all: host
18
19$(BUILD_DIR):
20 mkdir -p $(BUILD_DIR)
21
22# ---------------- HOST BUILD (static) ----------------
23host: $(BUILD_DIR) $(SRC) $(TESTS)
24 $(CC) $(CFLAGS) -static $(SRC) $(TESTS) -o $(OUT_HOST) $(LDFLAGS)
25 @echo "[INFO] Host binary built: $(OUT_HOST)"
26
27# ---------------- ESP32 SIM ----------------
28esp32_sim: host
29 @echo "[INFO] Running ESP32-S3 simulation in minimal Docker..."
30 docker build -t esp32-s3-sim .
31 docker run --rm --memory=6m --cpus=0.2 esp32-s3-sim
32
33# ---------------- CLEAN ----------------
34clean:
35 rm -rf $(BUILD_DIR)
36
37# ---------------- INFO ----------------
38info:
39 @echo "Host compiler: $(CC)"
40 @echo "Binary: $(OUT_HOST)"
41
42# ---------------- HELP ----------------
43help:
44 @echo "Available targets:"
45 @echo " all / host - Build host binary (statically linked)"
46 @echo " esp32_sim - Build host binary + run ESP32-S3 Docker simulation"
47 @echo " clean - Remove build artifacts"
48 @echo " info - Show compiler and binary info"