diff options
| author | Filip Wandzio <contact@philw.dev> | 2026-03-01 01:03:39 +0100 |
|---|---|---|
| committer | Filip Wandzio <contact@philw.dev> | 2026-03-01 01:03:39 +0100 |
| commit | bf0d77d7d448e964e9716d5af67c48f3d014f090 (patch) | |
| tree | e55f1e91a8c20cd737dfb01dc12a954c25711e01 /Makefile | |
| download | embedded_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-- | Makefile | 48 |
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 ================= | ||
| 2 | CC ?= gcc | ||
| 3 | CFLAGS ?= -Wall -Wextra -Werror -std=c18 -Iinclude -Ibenchmark | ||
| 4 | LDFLAGS ?= | ||
| 5 | |||
| 6 | SRC_DIR := src | ||
| 7 | TEST_DIR := tests | ||
| 8 | BENCH_DIR := benchmark | ||
| 9 | BUILD_DIR := build | ||
| 10 | |||
| 11 | SRC := $(SRC_DIR)/syntax_essentials.c benchmark/benchmark.c benchmark/resource_usage.c | ||
| 12 | TESTS := $(wildcard $(TEST_DIR)/*.c) | ||
| 13 | |||
| 14 | OUT_HOST := $(BUILD_DIR)/syntax_essentials_tests_host | ||
| 15 | |||
| 16 | # ================= TARGETS ================= | ||
| 17 | all: host | ||
| 18 | |||
| 19 | $(BUILD_DIR): | ||
| 20 | mkdir -p $(BUILD_DIR) | ||
| 21 | |||
| 22 | # ---------------- HOST BUILD (static) ---------------- | ||
| 23 | host: $(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 ---------------- | ||
| 28 | esp32_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 ---------------- | ||
| 34 | clean: | ||
| 35 | rm -rf $(BUILD_DIR) | ||
| 36 | |||
| 37 | # ---------------- INFO ---------------- | ||
| 38 | info: | ||
| 39 | @echo "Host compiler: $(CC)" | ||
| 40 | @echo "Binary: $(OUT_HOST)" | ||
| 41 | |||
| 42 | # ---------------- HELP ---------------- | ||
| 43 | help: | ||
| 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" | ||
