Foundry/tt/tests/Makefile.queue

77 lines
2.4 KiB
Makefile

# SPDX-License-Identifier: AGPL-3.0-or-later
# Copyright (C) 2026 David (Corey) Herrera
# Foundry Blackhole backend — Phase 5's off-device suite.
#
# make -f Makefile.queue check # build and run; no card, no fence needed
# make -f Makefile.queue red # rebuild from scratch first
#
# Separate from the other four Makefiles for the same reason they are separate from each
# other: this file can be edited without touching a build that is already green.
#
# NO DEVICE. test_queue.c runs against simulated cores behind the ft_tt_noc_access vtable
# and a software MODEL of the resident kernel, so it runs on the Mac. What it cannot cover
# is whether kernels/resident_queue.c compiles to that model — that is
# Makefile.phase5's test_phase5_resident on silicon, and nothing here substitutes for it.
#
# `red` rebuilds from scratch every time: Apple ships GNU make 3.81, whose one-second
# mtime granularity silently skips a rebuild of a source edited in the same second as its
# object, so a mutation loop that relies on incremental make can be testing the PREVIOUS
# binary (coding-best-practices.md §9).
CC ?= cc
SRC_DIR := ..
BUILD := build-queue
CFLAGS := -std=c99 -O1 -g \
-Wall -Wextra -Werror -pedantic \
-Wshadow -Wconversion -Wstrict-prototypes -Wformat=2 \
-fstack-protector-strong \
-I$(SRC_DIR)
DEPFLAGS := -MMD -MP
SOURCES := $(SRC_DIR)/ft_tt_kmd.c \
$(SRC_DIR)/ft_tt_arch.c \
$(SRC_DIR)/ft_tt_arch_blackhole.c \
$(SRC_DIR)/ft_tt_device.c \
$(SRC_DIR)/ft_tt_tlb.c \
$(SRC_DIR)/ft_tt_coord.c \
$(SRC_DIR)/ft_tt_noc.c \
$(SRC_DIR)/ft_tt_buffer.c \
$(SRC_DIR)/ft_tt_elf.c \
$(SRC_DIR)/ft_tt_kernel_blob.c \
$(SRC_DIR)/ft_tt_launch.c \
$(SRC_DIR)/ft_tt_queue.c \
$(SRC_DIR)/ft_tt_group.c \
$(SRC_DIR)/ft_tt_watchdog.c \
test_queue.c
OBJECTS := $(addprefix $(BUILD)/,$(notdir $(SOURCES:.c=.o)))
TARGET := $(BUILD)/test_queue
.PHONY: all check red clean
all: $(TARGET)
$(BUILD):
mkdir -p $(BUILD)
$(BUILD)/%.o: $(SRC_DIR)/%.c | $(BUILD)
$(CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
$(BUILD)/%.o: %.c | $(BUILD)
$(CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
$(TARGET): $(OBJECTS)
$(CC) $(CFLAGS) $(OBJECTS) -o $@
check: $(TARGET)
./$(TARGET)
red: clean check
clean:
rm -rf $(BUILD)
-include $(wildcard $(BUILD)/*.d)