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
omega-mv / mk / rx_compose_lib.mk
| 1 | # --------------------------------------------------------------------------- |
| 2 | # NEXT-PHASE-1 cut 1a: build/librx_compose.a, the COMPOSITION-2 runtime as a |
| 3 | # static library for a host program (sovereign-core crates/aien-omega-compose), |
| 4 | # plus its C ABI facade src/runtime/rxc_host_abi.{h,c}. |
| 5 | # |
| 6 | # make build/librx_compose.a the library (PRODUCTION flags only) |
| 7 | # make test-rxc-host-abi open, run, close, reopen + recall, torn tail |
| 8 | # |
| 9 | # Sources: the production living set RX_R13_SRCS (top-level Makefile) minus |
| 10 | # everything under tests/, plus rxc_host_abi.c. The variable is reused, not |
| 11 | # copied, so the library follows the living build. The Aienux capability |
| 12 | # library pinned by aienos.lock ($(AIENOS_CAP_LIB)) is merged into the same |
| 13 | # archive, so a host links one file (plus -lpthread -lm). |
| 14 | # |
| 15 | # Production hygiene: the objects are compiled with $(CFLAGS) $(RXC_LIB_EXTRA) |
| 16 | # and the recipe refuses AIEN_TEST_BUILD / RXC_TEST_HOOKS in CFLAGS |
| 17 | # ($(RX_PROD_REFUSE_TEST), the same check as the production program). |
| 18 | # -fPIC so the archive can also go into a shared object. |
| 19 | # |
| 20 | # This file is read BEFORE the top-level Makefile defines RX_R13_SRCS, |
| 21 | # CFLAGS and AIENOS_CAP_LIB (mk/*.mk is included at its top), so every |
| 22 | # prerequisite naming them is written $$(...) and expanded in the second |
| 23 | # phase (.SECONDEXPANSION, as mk/polyglot.mk and mk/allen.mk do). |
| 24 | # --------------------------------------------------------------------------- |
| 25 | ifndef RX_COMPOSE_LIB_MK_LOADED |
| 26 | RX_COMPOSE_LIB_MK_LOADED := 1 |
| 27 | |
| 28 | .PHONY: rx-compose-lib test-rxc-host-abi |
| 29 | .SECONDEXPANSION: |
| 30 | |
| 31 | RXC_LIB = $(OUT_DIR)/librx_compose.a |
| 32 | RXC_LIB_DIR = $(OUT_DIR)/rxc_lib |
| 33 | RXC_LIB_EXTRA = -fPIC |
| 34 | RXC_LIB_SRCS = $(filter-out tests/%,$(RX_R13_SRCS)) src/runtime/rxc_host_abi.c |
| 35 | RXC_LIB_OBJS = $(patsubst %.c,$(RXC_LIB_DIR)/%.o,$(RXC_LIB_SRCS)) |
| 36 | RXC_HOST_ABI_TEST = $(OUT_DIR)/rxc_host_abi_test |
| 37 | |
| 38 | rx-compose-lib: $(RXC_LIB) |
| 39 | |
| 40 | $(RXC_LIB_DIR)/%.o: %.c src/runtime/rxc_host_abi.h |
| 41 | $(RX_PROD_REFUSE_TEST) |
| 42 | @mkdir -p $(dir $@) |
| 43 | $(CC) $(CFLAGS) $(RXC_LIB_EXTRA) -c $< -o $@ |
| 44 | |
| 45 | # One archive: the runtime objects plus the pinned Aienux capability library |
| 46 | # (GNU ar MRI script; built into a temp name, then moved, so a failed build |
| 47 | # never leaves a half archive). |
| 48 | $(RXC_LIB): $$(RXC_LIB_OBJS) $$(AIENOS_CAP_LIB) |
| 49 | $(RX_PROD_REFUSE_TEST) |
| 50 | @mkdir -p $(dir $@) |
| 51 | @rm -f $@.tmp |
| 52 | @{ echo "create $@.tmp"; echo "addlib $(AIENOS_CAP_LIB)"; \ |
| 53 | for o in $(RXC_LIB_OBJS); do echo "addmod $$o"; done; echo "save"; echo "end"; } | ar -M |
| 54 | @ranlib $@.tmp && mv -f $@.tmp $@ |
| 55 | @echo "librx_compose: $@ ($(words $(RXC_LIB_OBJS)) objects + $(notdir $(AIENOS_CAP_LIB)))" |
| 56 | |
| 57 | $(RXC_HOST_ABI_TEST): tests/runtime/rxc_host_abi_test.c src/runtime/rxc_host_abi.h $(RXC_LIB) |
| 58 | $(CC) $(CFLAGS) -o $@ tests/runtime/rxc_host_abi_test.c $(RXC_LIB) -pthread -lm |
| 59 | |
| 60 | test-rxc-host-abi: $(RXC_HOST_ABI_TEST) |
| 61 | ./$(RXC_HOST_ABI_TEST) |
| 62 | |
| 63 | endif |