Files
c2/v0/include.mk
T
seeseemelk c90f3afd95 Implement all @copilot Makefile and buffer test annotations
- Defined V0_SRC_DEPS and V0_TEST_DEPS in v0/include.mk
- Updated clean rule to remove dependency files
- Referenced dependency variables for .d includes
- Added and deduplicated file-read test in v0/test_buffer.c

All tests pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-24 09:25:04 +02:00

36 lines
1010 B
Makefile
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
V0_SRC := v0/buffer.c v0/main.c
# V0_TEST must only include `v0/test.c` itself, as all other test Csource files are
# included directly into `v0/test.c` using `#include "test_xyz.c"`.
V0_TEST := v0/test.c
V0_SRC_OBJ := $(patsubst v0/%.c,v0/bin/%.o,$(V0_SRC))
V0_TEST_OBJ := $(patsubst v0/%.c,v0/bin/%.o,$(V0_TEST))
# Define dependency file lists for sources and tests
V0_SRC_DEPS := $(V0_SRC_OBJ:.o=.d)
V0_TEST_DEPS := $(V0_TEST_OBJ:.o=.d)
v0/bin/c2: $(V0_SRC_OBJ)
$(CC) $(CFLAGS) -o $@ $^
V0_SRC_OBJ_NO_MAIN := $(filter-out v0/bin/main.o,$(V0_SRC_OBJ))
v0/bin/test: $(V0_SRC_OBJ_NO_MAIN) $(V0_TEST_OBJ)
$(CC) $(CFLAGS) -o $@ $^
test:: v0/bin/test
v0/bin/test
clean::
rm -f v0/bin/test v0/bin/c2 $(V0_SRC_OBJ) $(V0_TEST_OBJ) $(V0_SRC_DEPS) $(V0_TEST_DEPS)
# Build each .c file into a .o file, tracking header dependencies.
v0/bin/%.o: v0/%.c v0/include.mk
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) -MMD -MP -c $< -o $@
# Reference dependency files
-include $(V0_SRC_DEPS)
-include $(V0_TEST_DEPS)