-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
137 lines (111 loc) · 4.36 KB
/
Makefile
File metadata and controls
137 lines (111 loc) · 4.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# Makefile for Unified Moop
# Minimal, elegant build system for evolutionary tape-loop Turing machine
CC ?= gcc
CFLAGS = -Wall -Wextra -Werror -std=c11 -O2 -g
LIBS = -lm
# Optional: LLM integration (requires libcurl)
# Uncomment to enable LLM proto
# CFLAGS += -DENABLE_LLM
# LIBS += -lcurl
# Optional: Quantum simulator backend
# Uncomment to enable quantum statevector simulation
# CFLAGS += -DENABLE_QUANTUM_SIMULATOR
SRCDIR = src
TESTDIR = tests
BUILDDIR = build
# Core sources (enhanced implementation with quantum-ready abstraction)
CORE_SRCS = $(SRCDIR)/moop_enhanced.c \
$(SRCDIR)/classical_backend.c \
$(SRCDIR)/quantum_backend_registry.c
CORE_OBJS = $(BUILDDIR)/moop_enhanced.o \
$(BUILDDIR)/classical_backend.o \
$(BUILDDIR)/quantum_backend_registry.o
# Optional quantum simulator backend
ifeq ($(findstring -DENABLE_QUANTUM_SIMULATOR,$(CFLAGS)),-DENABLE_QUANTUM_SIMULATOR)
CORE_SRCS += $(SRCDIR)/quantum_simulator_backend.c
CORE_OBJS += $(BUILDDIR)/quantum_simulator_backend.o
endif
# Test sources
TEST_SRCS = $(TESTDIR)/test_enhanced.c
TEST_TARGET = $(BUILDDIR)/test_enhanced
TEST_QUANTUM_SRCS = $(TESTDIR)/test_quantum_backends.c
TEST_QUANTUM_TARGET = $(BUILDDIR)/test_quantum_backends
# Example programs
EXAMPLES_DIR = examples
EXAMPLE_EVOLUTIONARY = $(BUILDDIR)/evolutionary_optimization
EXAMPLE_LIVING_CODE = $(BUILDDIR)/living_code_demo
.PHONY: all clean test test-quantum test-all examples help
all: $(BUILDDIR) $(TEST_TARGET) $(TEST_QUANTUM_TARGET)
$(BUILDDIR):
mkdir -p $(BUILDDIR)
$(BUILDDIR)/moop_enhanced.o: $(SRCDIR)/moop_enhanced.c $(SRCDIR)/moop_enhanced.h $(SRCDIR)/moop_quantum_ready.h | $(BUILDDIR)
$(CC) $(CFLAGS) -c $< -o $@
$(BUILDDIR)/classical_backend.o: $(SRCDIR)/classical_backend.c $(SRCDIR)/moop_quantum_ready.h | $(BUILDDIR)
$(CC) $(CFLAGS) -c $< -o $@
$(BUILDDIR)/quantum_backend_registry.o: $(SRCDIR)/quantum_backend_registry.c $(SRCDIR)/moop_quantum_ready.h | $(BUILDDIR)
$(CC) $(CFLAGS) -c $< -o $@
$(BUILDDIR)/quantum_simulator_backend.o: $(SRCDIR)/quantum_simulator_backend.c $(SRCDIR)/moop_quantum_ready.h | $(BUILDDIR)
$(CC) $(CFLAGS) -c $< -o $@
$(TEST_TARGET): $(TEST_SRCS) $(CORE_OBJS) | $(BUILDDIR)
$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
$(TEST_QUANTUM_TARGET): $(TEST_QUANTUM_SRCS) $(CORE_OBJS) | $(BUILDDIR)
$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
$(EXAMPLE_EVOLUTIONARY): $(EXAMPLES_DIR)/evolutionary_optimization.c $(CORE_OBJS) | $(BUILDDIR)
$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
$(EXAMPLE_LIVING_CODE): $(EXAMPLES_DIR)/living_code_demo.c $(CORE_OBJS) | $(BUILDDIR)
$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
examples: $(EXAMPLE_EVOLUTIONARY) $(EXAMPLE_LIVING_CODE)
@echo "Examples built successfully"
test: $(TEST_TARGET)
@echo "=== Running Enhanced Moop Test Suite ==="
./$(TEST_TARGET)
test-quantum: $(TEST_QUANTUM_TARGET)
@echo "=== Running Quantum-Ready Backend Test Suite ==="
./$(TEST_QUANTUM_TARGET)
test-all: $(TEST_TARGET) $(TEST_QUANTUM_TARGET)
@echo "=== Running All Test Suites ==="
./$(TEST_TARGET)
./$(TEST_QUANTUM_TARGET)
clean:
rm -rf $(BUILDDIR)
@echo "Build artifacts cleaned"
help:
@echo "Unified Moop Build System"
@echo ""
@echo "Targets:"
@echo " all - Build all test suites (default)"
@echo " test - Run enhanced features test suite"
@echo " test-quantum - Run quantum backend test suite"
@echo " test-all - Run all test suites"
@echo " examples - Build example programs"
@echo " clean - Remove build artifacts"
@echo " help - Show this message"
@echo ""
@echo "Features:"
@echo " - Quantum-ready abstraction (classical default)"
@echo " - Tape-loop Turing machine (1024 cells)"
@echo " - Evolutionary pruning with fitness"
@echo " - Trinary MAYBE with LLM confidence"
@echo " - Self-modification API (homoiconicity)"
@echo " - Meta-evolution (adaptive fitness tuning)"
@echo ""
@echo "Build Options:"
@echo " Classical only (default):"
@echo " make"
@echo ""
@echo " Enable quantum simulator:"
@echo " make clean"
@echo " make CFLAGS=\"-DENABLE_QUANTUM_SIMULATOR -std=c11 -O2 -g\""
@echo ""
@echo " Run quantum tests:"
@echo " make test-all"
@echo ""
@echo "Examples:"
@echo " Build examples:"
@echo " make examples"
@echo ""
@echo " Run living code demo (recommended first):"
@echo " ./build/living_code_demo"
@echo ""
@echo " Run evolutionary optimization:"
@echo " ./build/evolutionary_optimization"