# MoloApp audit trail and compliance part build fragment. # Included by the root Makefile. Header-only library; this fragment builds # the standalone tests. All outputs go under build/. # # Expected root variables (defaults work standalone): # CXX, CXXFLAGS, AUDIT_SRC (default src/audit), AUDIT_TEST_SRC, BUILD_DIR. CXX ?= g++ CXXFLAGS ?= -std=c++23 -O2 -Wall -Wextra -pthread AUDIT_SRC ?= src/audit AUDIT_TEST_SRC ?= tests/src/audit BUILD_DIR ?= build AUDIT_TESTS := pii_boot redactor chain_tamper query_guard retention_hold \ export_bundle erasure_cascade mask_fixture sql_store orm_hook AUDIT_TEST_BINS := $(addprefix $(BUILD_DIR)/audit-,$(AUDIT_TESTS)) # INTEGRATION: with the base tree present the audit headers bind the real # crypto/auth TU definitions, so test links compile them in. AUDIT_LINK_SRCS := src/security/crypto/Sha256.cpp src/security/crypto/Hmac.cpp \ src/security/crypto/SecureRandom.cpp src/security/crypto/Base64.cpp \ src/security/auth/Guard.cpp .PHONY: audit audit-tests audit-clean audit: $(BUILD_DIR)/audit-umbrella.o # Umbrella compile check: the whole part must compile as one TU. $(BUILD_DIR)/audit-umbrella.o: $(AUDIT_SRC)/audit.h @mkdir -p $(BUILD_DIR) printf '#include "audit/audit.h"\nint main(){return 0;}\n' | $(CXX) $(CXXFLAGS) -I$(AUDIT_SRC)/.. -x c++ -c -o $@ - audit-tests: $(AUDIT_TEST_BINS) $(BUILD_DIR)/audit-%: $(AUDIT_TEST_SRC)/%.cpp $(AUDIT_SRC)/audit.h @mkdir -p $(BUILD_DIR) $(CXX) $(CXXFLAGS) -I$(AUDIT_SRC)/.. -o $@ $< $(AUDIT_LINK_SRCS) audit-clean: rm -f $(BUILD_DIR)/audit-*