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 / omega-emit.mk

55 lines · 3104 bytes Raw Blame History
1# tools/omega_emit (aien-spark/omega#445, one-layer stage 2): constrained structured emission of OSC
2# binary IR, and tools/exp445 (the representation experiment driver helper).
3# Picked up by `-include mk/*.mk`; not part of `all` or `test`.
4#
5# omega-emit build/omega_emit/{omega_emit,x445,fake445,typediff}
6# test-omega-emit omega_emit: every op of the schema, step refusals with reasons, negative controls,
7# lift -> emit byte-identical over the compiler corpus; x445 helper checks
8# test-exp445 driver dry run against a fake local endpoint (no model, no network beyond loopback);
9# the r3 worked examples in both forms through the sealed harness; G0; held-out name check
10#
11# NOTE (bb7f2dd68): legacy C compiler src/compiler/ (osc_ir.h, oscc) was removed during the OM-2 cutover.
12# Pure-OM helpers fake445.om and examples_expected.om remain buildable; the C tools omega_emit.c, x445.c,
13# and typediff.c have no pure-OM replacement yet and fail closed with MISSING_IMPLEMENTATION when
14# src/compiler/osc_ir.h is absent.
15ifndef OMEGA_EMIT_MK
16OMEGA_EMIT_MK := 1
17.PHONY: omega-emit test-omega-emit test-exp445
18OME_DIR = $(OUT_DIR)/omega_emit
19OME_CFLAGS = -std=gnu11 -Wall -Wextra -Werror -D_GNU_SOURCE -O2 -Isrc -Isrc/compiler
20OME_OSC_LIB = $(filter-out src/compiler/oscc_main.c,$(wildcard src/compiler/*.c)) src/omega_om_units.c
21
22$(OME_DIR)/fake445: tools/exp445/fake445.om seed/out/omc
23 @mkdir -p $(OME_DIR)
24 seed/out/omc < tools/exp445/fake445.om > $@.tmp.$$$$ && chmod +x $@.tmp.$$$$ && mv -f $@.tmp.$$$$ $@
25
26$(OME_DIR)/examples_expected: tools/exp445/examples_expected.om seed/out/omc
27 @mkdir -p $(OME_DIR)
28 seed/out/omc < tools/exp445/examples_expected.om > $@.tmp.$$$$ && chmod +x $@.tmp.$$$$ && mv -f $@.tmp.$$$$ $@
29
30ifneq ($(wildcard src/compiler/osc_ir.h),)
31$(OME_DIR)/omega_emit: tools/omega_emit/omega_emit.c $(OME_OSC_LIB) $(wildcard src/compiler/*.h)
32 @mkdir -p $(OME_DIR)
33 $(CC) $(OME_CFLAGS) -o $@ tools/omega_emit/omega_emit.c $(OME_OSC_LIB)
34
35$(OME_DIR)/x445: tools/exp445/x445.c $(OME_OSC_LIB) $(wildcard src/compiler/*.h)
36 @mkdir -p $(OME_DIR)
37 $(CC) $(OME_CFLAGS) -o $@ tools/exp445/x445.c $(OME_OSC_LIB) -lm
38
39$(OME_DIR)/typediff: tools/omega_emit/typediff.c $(OME_OSC_LIB) $(wildcard src/compiler/*.h)
40 @mkdir -p $(OME_DIR)
41 $(CC) $(OME_CFLAGS) -o $@ tools/omega_emit/typediff.c $(OME_OSC_LIB)
42
43omega-emit: $(OME_DIR)/omega_emit $(OME_DIR)/x445 $(OME_DIR)/fake445 $(OME_DIR)/typediff
44
45test-omega-emit: omega-emit $(OUT_DIR)/compiler/oscc
46 bash tools/omega_emit/test_omega_emit.sh $(abspath $(OME_DIR)) $(abspath $(OUT_DIR)/compiler/oscc)
47
48test-exp445: omega-emit omegese $(OME_DIR)/examples_expected one-layer-acceptance-tools $(OUT_DIR)/compiler/oscc
49 bash tools/exp445/test_exp445.sh $(abspath $(OME_DIR)) $(abspath $(OUT_DIR)/compiler/oscc) $(abspath $(OUT_DIR)/omegese/omegese)
50else
51omega-emit test-omega-emit test-exp445:
52 @echo "MISSING_IMPLEMENTATION: $@ requires removed legacy src/compiler/ (osc_ir.h / oscc, removed in bb7f2dd68); no pure-OM replacement for omega_emit/x445/typediff yet" >&2
53 @exit 3
54endif
55endif