commit 08951b102ee218c381a2b1fc69cb955808ce8c23
parent 3f5436216eb8b140100c44135c7ae268dd04781e
Author: Ryan Sepassi <rsepassi@gmail.com>
Date: Thu, 21 May 2026 12:06:38 -0700
Makefile: objs depend on Makefile
Diffstat:
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,12 +1,13 @@
CC = clang
SYSROOT = $(shell xcrun --show-sdk-path)
+HOST_OPTFLAGS ?= -O2
# -isysroot lives in its own var so stage/bootstrap recipes can override
# host SDK handling when cfree is used as the compiler.
HOST_SYSROOT_CFLAGS = -isysroot $(SYSROOT)
HOST_SYSROOT_LDFLAGS = -isysroot $(SYSROOT)
-CFLAGS_COMMON = -std=c11 -Wpedantic -Wall -Wextra -Werror $(HOST_SYSROOT_CFLAGS)
+CFLAGS_COMMON = $(HOST_OPTFLAGS) -std=c11 -Wpedantic -Wall -Wextra -Werror $(HOST_SYSROOT_CFLAGS)
DEPFLAGS = -MMD -MP
@@ -64,27 +65,27 @@ $(LANG_TOY_AR): $(LANG_TOY_OBJS)
$(BIN): $(DRIVER_OBJS) $(LIB_AR) $(LANG_TOY_AR)
$(CC) $(HOST_SYSROOT_LDFLAGS) -o $@ $(DRIVER_OBJS) $(LIB_AR) $(LANG_TOY_AR)
-build/lib/%.o: src/%.c
+build/lib/%.o: src/%.c Makefile
@mkdir -p $(dir $@)
$(CC) $(LIB_CFLAGS) $(DEPFLAGS) -c $< -o $@
-build/lang/c/%.o: lang/c/%.c
+build/lang/c/%.o: lang/c/%.c Makefile
@mkdir -p $(dir $@)
$(CC) $(CFLAGS_COMMON) -ffreestanding -Iinclude -Ilang/c $(DEPFLAGS) -c $< -o $@
-build/lang/wasm/%.o: lang/wasm/%.c
+build/lang/wasm/%.o: lang/wasm/%.c Makefile
@mkdir -p $(dir $@)
$(CC) $(CFLAGS_COMMON) -ffreestanding -Iinclude -Ilang/wasm $(DEPFLAGS) -c $< -o $@
-build/lib/%.o: src/%.S
+build/lib/%.o: src/%.S Makefile
@mkdir -p $(dir $@)
$(CC) $(LIB_CFLAGS) $(DEPFLAGS) -c $< -o $@
-build/driver/%.o: driver/%.c
+build/driver/%.o: driver/%.c Makefile
@mkdir -p $(dir $@)
$(CC) $(DRIVER_CFLAGS) $(DEPFLAGS) -c $< -o $@
-build/lang/toy/%.o: lang/toy/%.c
+build/lang/toy/%.o: lang/toy/%.c Makefile
@mkdir -p $(dir $@)
$(CC) $(LANG_CFLAGS) $(DEPFLAGS) -c $< -o $@