Skip to content
This repository was archived by the owner on Feb 18, 2026. It is now read-only.

Commit 5fc9679

Browse files
committed
feat(makefile): add check for instrumented test binaries and release build target
1 parent 6f6d6fc commit 5fc9679

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

Makefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,29 @@ endif
4949
# Default target
5050
all: $(BUILD_DIR)/$(EXTENSION)
5151

52+
# Check if test binary is instrumented (ASan/UBSan)
53+
# Returns 0 if instrumented, 1 if clean
54+
.PHONY: check-instrumented
55+
check-instrumented:
56+
@if [ -f "$(BUILD_DIR)/$(TEST_BIN)" ]; then \
57+
if nm "$(BUILD_DIR)/$(TEST_BIN)" 2>/dev/null | grep -q '__asan\|__ubsan\|__tsan'; then \
58+
exit 0; \
59+
else \
60+
exit 1; \
61+
fi; \
62+
else \
63+
exit 1; \
64+
fi
65+
66+
# Release build (ensures clean, non-instrumented build)
67+
# Only cleans if instrumented build detected - preserves incremental builds
68+
release:
69+
@if $(MAKE) -s check-instrumented 2>/dev/null; then \
70+
echo "Instrumented build detected - cleaning..."; \
71+
$(MAKE) clean; \
72+
fi
73+
@$(MAKE) EXTRA_CFLAGS="" all
74+
5275
# Build extension (without sqlite3.o - symbols resolved from host at runtime)
5376
$(BUILD_DIR)/$(EXTENSION): $(SOURCES) | $(BUILD_DIR)
5477
$(CC) $(CFLAGS) -DDISKANN_EXTENSION $(LDFLAGS) -o $@ $^ $(LIBS)
@@ -139,6 +162,7 @@ valgrind: $(BUILD_DIR)/$(TEST_BIN)
139162
help:
140163
@echo "sqlite-diskann build targets:"
141164
@echo " all Build extension (default)"
165+
@echo " release Ensure clean build (auto-detects and cleans ASan/UBSan builds)"
142166
@echo " test Build and run native C tests (alias for test-native)"
143167
@echo " test-native Build and run native C tests only"
144168
@echo " test-all Build and run both native C and TypeScript tests"

0 commit comments

Comments
 (0)