interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / mk / estimation.mk

67 lines · 3416 bytes Raw Blame History
1# Belief / estimation layer, EST-0 and EST-1 (ARCH-0020). Standalone: new
2# files only under src/estimation/ and tests/estimation/. Picked up by
3# `-include mk/*.mk`; not part of `all` or `test`. Nothing in src/runtime/
4# includes or links it.
5#
6# test-est-types EST-0 contract: validation, digests, encoding, property tests
7# test-est-kf EST-1 filter: analytic cases and invariants
8# test-est-ref EST-1 independent reference (information form, written
9# without reading est_kf.c) cross-checked against est_kf
10# test-estimation all three, plain + ASan/UBSan, plus the purity check
11ifndef ESTIMATION_MK
12ESTIMATION_MK := 1
13.PHONY: test-est-types test-est-kf test-est-ref test-estimation est-purity
14# -Wno-pedantic: the generated binding src/omega_om_units.c carries the runtime entry table as
15# GNU range designators, which ISO C forbids (-Werror=pedantic), and every test binary here links
16# that file. The generator fix is omega-bridge #17 (ABI-v2 line); until it lands this silences only
17# that one diagnostic and keeps the strict flags for the handwritten sources in the same commands.
18EST_CFLAGS = -std=c11 -Wall -Wextra -Werror -pedantic -O2 -D_POSIX_C_SOURCE=200809L -Isrc -Isrc/estimation -Itests/estimation -ffp-contract=off -fno-fast-math -Wno-pedantic
19EST_ASAN = -O1 -g -fsanitize=address,undefined -fno-sanitize-recover=all
20EST_TYPES_SRCS = src/estimation/est_types.c src/omega_om_units.c
21EST_KF_SRCS = src/estimation/est_kf.c $(EST_TYPES_SRCS)
22EST_HDRS = src/estimation/est_types.h src/estimation/est_kf.h src/estimation/est_mix.h
23EST_DIR = $(OUT_DIR)/tests-estimation
24# An estimator is a calculator: it must not reference authority, World,
25# generation, capability, memory-mapping or process operations.
26EST_FORBIDDEN = 'rx_|aienos_|argus_|forge_|aegis|mmap|mprotect|fork|exec|dlopen|system|socket|fopen|open$$'
27
28$(EST_DIR)/%.o: src/estimation/%.c $(EST_HDRS)
29 @mkdir -p $(EST_DIR)
30 $(CC) $(EST_CFLAGS) -c -o $@ $<
31
32est-purity: $(EST_DIR)/est_types.o $(EST_DIR)/est_kf.o $(EST_DIR)/est_mix.o
33 @if nm -u $^ | grep -E $(EST_FORBIDDEN) ; then \
34 echo "estimation object references an operation an estimator must not have"; exit 1; fi
35 @echo "est-purity: est_types.o, est_kf.o and est_mix.o reference no forbidden symbol"
36
37EST_OMC ?= seed/out/omc
38EST_OM_TYPES = src/estimation/est_defs.om src/estimation/est_math.om src/estimation/est_types.om
39EST_OM_KF = $(EST_OM_TYPES) src/estimation/est_kf.om
40
41$(EST_DIR)/test_est_types: $(EST_OM_TYPES) tests/estimation/test_est_types.om
42 @mkdir -p $(EST_DIR)
43 cat $^ | $(EST_OMC) > $@ && chmod +x $@
44
45$(EST_DIR)/test_est_kf: $(EST_OM_KF) tests/estimation/test_est_kf.om
46 @mkdir -p $(EST_DIR)
47 cat $^ | $(EST_OMC) > $@ && chmod +x $@
48
49$(EST_DIR)/test_est_ref: $(EST_OM_KF) tests/estimation/est_ref_info.om tests/estimation/test_est_ref.om
50 @mkdir -p $(EST_DIR)
51 cat $^ | $(EST_OMC) > $@ && chmod +x $@
52
53test-est-types: $(EST_DIR)/test_est_types
54 ./$(EST_DIR)/test_est_types
55 @echo "test-est-types: EST-0 contract checks pass (pure OM-2)"
56
57test-est-kf: $(EST_DIR)/test_est_kf
58 ./$(EST_DIR)/test_est_kf
59 @echo "test-est-kf: EST-1 filter checks pass (pure OM-2)"
60
61test-est-ref: $(EST_DIR)/test_est_ref
62 ./$(EST_DIR)/test_est_ref
63 @echo "test-est-ref: est_kf agrees with the independent information-form reference (pure OM-2)"
64
65test-estimation: est-purity test-est-types test-est-kf test-est-ref
66 @echo "test-estimation: EST-0 and EST-1 pass"
67endif