forked from Unicorn-Dynamics/9nu
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
258 lines (219 loc) · 9.93 KB
/
Copy pathMakefile
File metadata and controls
258 lines (219 loc) · 9.93 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# Makefile for Cognitive Kernel
# Self-evolving scaffolding for GNU Hurd ecosystem
dir := cogkernel
makemode := misc
DISTFILES := README.md
include ../Makeconf
# C library for HurdCog microkernel bridge
BRIDGE_LIB = libhurd-atomspace-bridge.so
BRIDGE_SOURCES = hurd-atomspace-bridge.c
BRIDGE_HEADERS = hurd-atomspace-bridge.h
# Guile modules for the cognitive kernel
GUILE_MODULES = atomspace/atomspace.scm \
agents/agents.scm \
attention/ecan.scm \
tensors/tensors.scm \
cognitive-grip.scm \
machspace.scm \
microkernel-integration.scm \
core.scm \
cognitive-primitives.scm \
scheme-adapters.scm \
test-patterns.scm \
hypergraph-viz.scm \
phase1-integration.scm
# Installation directory for Guile modules
GUILE_SITE_DIR = $(datadir)/guile/site/$(GUILE_EFFECTIVE_VERSION)/cogkernel
GUILE_CCACHE_DIR = $(libdir)/guile/$(GUILE_EFFECTIVE_VERSION)/site-ccache/cogkernel
# Test files
TEST_FILES = tests/test-atomspace.scm \
tests/test-agents.scm \
tests/test-attention.scm \
tests/test-core.scm
# All targets
all: compile-modules
# Check if Guile is available
check-guile:
@which guile > /dev/null || (echo "Error: Guile not found. Please install Guile 3.0+" && exit 1)
@echo "Guile found: $$(guile --version | head -1)"
# Compile Guile modules
compile-modules: check-guile $(GUILE_MODULES)
@echo "Compiling Cognitive Kernel modules..."
@echo "Adding current directory to Guile load path..."
@export GUILE_LOAD_PATH=".:$$GUILE_LOAD_PATH"; \
guile -c "(compile-file \"atomspace/atomspace.scm\" #:output-file \"atomspace/atomspace.go\")"
@export GUILE_LOAD_PATH=".:$$GUILE_LOAD_PATH"; \
guile -c "(compile-file \"agents/agents.scm\" #:output-file \"agents/agents.go\")"
@export GUILE_LOAD_PATH=".:$$GUILE_LOAD_PATH"; \
guile -c "(compile-file \"attention/ecan.scm\" #:output-file \"attention/ecan.go\")"
@export GUILE_LOAD_PATH=".:$$GUILE_LOAD_PATH"; \
guile -c "(compile-file \"tensors/tensors.scm\" #:output-file \"tensors/tensors.go\")"
@export GUILE_LOAD_PATH=".:$$GUILE_LOAD_PATH"; \
guile -c "(compile-file \"cognitive-grip.scm\" #:output-file \"cognitive-grip.go\")"
@export GUILE_LOAD_PATH=".:$$GUILE_LOAD_PATH"; \
guile -c "(compile-file \"machspace.scm\" #:output-file \"machspace.go\")"
@export GUILE_LOAD_PATH=".:$$GUILE_LOAD_PATH"; \
guile -c "(compile-file \"core.scm\" #:output-file \"core.go\")"
@echo "Cognitive Kernel modules compiled successfully"
# Test the cognitive kernel
test: compile-modules
@echo "Testing Cognitive Kernel..."
@guile -c "(add-to-load-path \".\") \
(use-modules (cogkernel core)) \
(cognitive-demo!)"
# Install Guile modules
install: compile-modules
@echo "Installing Cognitive Kernel modules..."
@mkdir -p $(DESTDIR)$(GUILE_SITE_DIR)/atomspace
@mkdir -p $(DESTDIR)$(GUILE_SITE_DIR)/agents
@mkdir -p $(DESTDIR)$(GUILE_SITE_DIR)/attention
@mkdir -p $(DESTDIR)$(GUILE_SITE_DIR)/tensors
@mkdir -p $(DESTDIR)$(GUILE_CCACHE_DIR)/atomspace
@mkdir -p $(DESTDIR)$(GUILE_CCACHE_DIR)/agents
@mkdir -p $(DESTDIR)$(GUILE_CCACHE_DIR)/attention
@mkdir -p $(DESTDIR)$(GUILE_CCACHE_DIR)/tensors
@install -m 644 atomspace/atomspace.scm $(DESTDIR)$(GUILE_SITE_DIR)/atomspace/
@install -m 644 agents/agents.scm $(DESTDIR)$(GUILE_SITE_DIR)/agents/
@install -m 644 attention/ecan.scm $(DESTDIR)$(GUILE_SITE_DIR)/attention/
@install -m 644 tensors/tensors.scm $(DESTDIR)$(GUILE_SITE_DIR)/tensors/
@install -m 644 core.scm $(DESTDIR)$(GUILE_SITE_DIR)/
@if [ -f atomspace/atomspace.go ]; then \
install -m 644 atomspace/atomspace.go $(DESTDIR)$(GUILE_CCACHE_DIR)/atomspace/; \
fi
@if [ -f agents/agents.go ]; then \
install -m 644 agents/agents.go $(DESTDIR)$(GUILE_CCACHE_DIR)/agents/; \
fi
@if [ -f attention/ecan.go ]; then \
install -m 644 attention/ecan.go $(DESTDIR)$(GUILE_CCACHE_DIR)/attention/; \
fi
@if [ -f tensors/tensors.go ]; then \
install -m 644 tensors/tensors.go $(DESTDIR)$(GUILE_CCACHE_DIR)/tensors/; \
fi
@if [ -f core.go ]; then \
install -m 644 core.go $(DESTDIR)$(GUILE_CCACHE_DIR)/; \
fi
@echo "Cognitive Kernel installed successfully"
# Clean compiled files
clean:
@echo "Cleaning Cognitive Kernel..."
@rm -f *.go atomspace/*.go agents/*.go attention/*.go tensors/*.go
@echo "Cleaned"
# Demo of cognitive capabilities
demo: working-demo.scm
@echo "=== Cognitive Kernel Demo ==="
@guile -s working-demo.scm
# Meta-agentic integration demo
meta-demo: issue-implementation.scm
@echo "=== Meta-Agentic Cognitive Kernel Integration Demo ==="
@guile -s issue-implementation.scm
# Enhanced GUIX integration test
guix-test: build/guix-integration.scm
@echo "=== Enhanced GUIX Build Integration Test ==="
@guile -s build/guix-integration.scm
# Full integration test
integration-test: full-integration-test.scm
@echo "=== Full Cognitive Kernel Integration Test ==="
@guile -s full-integration-test.scm
# Interactive Guile REPL with cognitive kernel loaded
repl: compile-modules
@echo "Starting Guile REPL with Cognitive Kernel..."
@echo "(use-modules (cogkernel core)) to get started"
@guile -c "(add-to-load-path \".\")"
# HurdCog minimal bootstrap test
bootstrap-test: compile-modules
@echo "=== HurdCog Minimal Bootstrap Test ==="
@guile -s hurdcog-bootstrap.scm
# Minimal bootstrap standalone test (no compilation needed)
minimal-bootstrap: hurdcog-bootstrap.scm
@echo "=== HurdCog Minimal Bootstrap - Spin Cycle 1 ==="
@guile -s hurdcog-bootstrap.scm
# Phase 1 OpenCog-GNUHurd Integration Test
phase1-test: cognitive-primitives.scm scheme-adapters.scm test-patterns.scm hypergraph-viz.scm phase1-integration.scm
@echo "=== Phase 1 OpenCog-GNUHurd Integration Test ==="
@guile -s phase1-integration.scm
# Phase 2 Core Services Tests
phase2-test: phase2-standalone-test.scm
@echo "=== Phase 2 Core Services Integration Test ==="
@guile -s phase2-standalone-test.scm
# Individual Phase 2 component tests
test-truthkernel: truthkernel.scm
@echo "=== Testing TruthKernel ==="
@guile -c "(use-modules (cogkernel truthkernel)) (test-truth-kernel)"
test-darwincore: darwincore.scm
@echo "=== Testing DarwinCore ==="
@guile -c "(use-modules (cogkernel darwincore)) (test-darwin-core)"
test-schedspace: schedspace.scm
@echo "=== Testing SchedSpace ==="
@guile -c "(use-modules (cogkernel schedspace)) (test-sched-space)"
# Run comprehensive Phase 1 integration
phase1-integration: phase1-integration.scm
@echo "=== Complete Phase 1 Integration ==="
@guile -c "(use-modules (cogkernel phase1-integration)) (complete-phase1-integration)"
# Test cognitive primitives
test-cognitive-primitives: cognitive-primitives.scm
@echo "=== Testing Cognitive Primitives ==="
@guile -c "(use-modules (cogkernel cognitive-primitives)) \
(test-round-trip-translation 'VM_ALLOCATE '(MEMORY 2 KERNEL 8 3))"
# Test scheme adapters
test-scheme-adapters: scheme-adapters.scm
@echo "=== Testing Scheme Adapters ==="
@guile -c "(use-modules (cogkernel scheme-adapters)) (test-adapter-round-trip)"
# Run exhaustive test patterns
test-exhaustive: test-patterns.scm
@echo "=== Running Exhaustive Test Patterns ==="
@guile -c "(use-modules (cogkernel test-patterns)) (run-exhaustive-tests)"
# Phase 3 Full Integration Tests
phase3-test: phase3-standalone-test.scm
@echo "=== Phase 3 Full Integration Test ==="
@guile -s phase3-standalone-test.scm
# Individual Phase 3 component tests
test-9p-hypergraph: 9p-hypergraph.scm
@echo "=== Testing 9P Hypergraph Integration ==="
@guile -c "(use-modules (cogkernel 9p-hypergraph)) (demo-9p-hypergraph!)"
test-limbo-grammar: limbo-grammar.scm
@echo "=== Testing Limbo Cognitive Grammar ==="
@guile -c "(use-modules (cogkernel limbo-grammar)) (demo-limbo-grammar!)"
test-distributed-scheduling: schedspace.scm
@echo "=== Testing Enhanced Distributed Scheduling ==="
@guile -c "(use-modules (cogkernel schedspace)) \
(bootstrap-sched-space!) \
(sched-space-schedule-distributed-operation! *global-sched-space* \
'TEST-DISTRIBUTED-OP '(node1 node2 node3) #:priority 200)"
# Build C bridge library for microkernel integration
$(BRIDGE_LIB): $(BRIDGE_SOURCES) $(BRIDGE_HEADERS)
@echo "=== Building HurdCog Microkernel Bridge Library ==="
@if [ -f /usr/include/mach/mach.h ]; then \
echo "Building with real Hurd headers"; \
gcc -shared -fPIC -o $(BRIDGE_LIB) $(BRIDGE_SOURCES) \
-I../include -I../hurd \
-lmach -lhurd -lpthread; \
else \
echo "Building stub version for non-Hurd systems"; \
gcc -shared -fPIC -o $(BRIDGE_LIB) hurd-atomspace-bridge-stub.c \
-I. -lpthread; \
fi
@echo "✅ Bridge library built successfully"
# Test microkernel integration
test-microkernel-integration: $(BRIDGE_LIB) microkernel-integration.scm
@echo "=== Testing Microkernel Integration - Phase 2 ==="
@export LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH && \
guile -c "(add-to-load-path \".\") \
(use-modules (cogkernel microkernel-integration)) \
(bootstrap-microkernel-integration) \
(microkernel-health-check) \
(monitor-microkernel-performance)"
# Phase 2 microkernel integration demo
phase2-microkernel-demo: $(BRIDGE_LIB)
@echo "🧠 === Phase 2: Microkernel Integration Demo === 🧠"
@export LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH && \
guile -s standalone-microkernel-test.scm
# Build all targets including C library
all: check-guile $(BRIDGE_LIB) compile-modules
# Clean including C library
clean:
@echo "Cleaning cognitive kernel..."
@rm -rf compiled
@rm -f $(BRIDGE_LIB)
@find . -name "*.go" -delete
@find . -name "*~" -delete
.PHONY: all check-guile compile-modules test install clean demo meta-demo guix-test repl bootstrap-test minimal-bootstrap phase1-test phase1-integration test-cognitive-primitives test-scheme-adapters test-exhaustive generate-diagrams phase2-test test-truthkernel test-darwincore test-schedspace phase3-test test-9p-hypergraph test-limbo-grammar test-distributed-scheduling test-microkernel-integration phase2-microkernel-demo