Files
cell/Makefile
2025-12-07 13:50:57 -06:00

57 lines
1.7 KiB
Makefile
Executable File

# Development build: creates libcell_runtime.dylib + thin main wrapper
# This is the default target for working on cell itself
#
# If cell doesn't exist yet, use 'make bootstrap' first (requires meson)
# or manually build with meson once.
cell: libcell_runtime.dylib cell_main core.qop
cat cell_main > cell
cat core.qop >> cell
chmod +x cell
cp cell /opt/homebrew/bin/cell
cp libcell_runtime.dylib /opt/homebrew/lib/
# Build the shared runtime library (everything except main.c)
# Uses existing cell to run build -d
libcell_runtime.dylib: .cell/build/dynamic
cell build -d
cp .cell/build/dynamic/libcell_runtime.dylib .
# Build the thin main wrapper that links to libcell_runtime
cell_main: source/main.c libcell_runtime.dylib
cc -o cell_main source/main.c -L. -lcell_runtime -Wl,-rpath,@loader_path -Wl,-rpath,/opt/homebrew/lib
# Create core.qop from scripts folder
core.qop: scripts/*.cm scripts/*.c
cell qopconv -d scripts . core.qop
# Static build: creates a fully static cell binary (for distribution)
static:
cell build
cp .cell/build/static/cell .
cat core.qop >> cell
# Bootstrap: build cell from scratch using meson (only needed once)
bootstrap:
meson setup build_bootstrap -Dbuildtype=release
meson compile -C build_bootstrap
cp build_bootstrap/cell .
cp build_bootstrap/libcell_runtime.dylib .
@echo "Bootstrap complete. Now run 'make' to rebuild with cell itself."
# Clean build artifacts
clean:
rm -rf .cell/build build_bootstrap
rm -f cell cell_main libcell_runtime.dylib core.qop
# Ensure dynamic build directory exists
.cell/build/dynamic:
mkdir -p .cell/build/dynamic
# Legacy meson target
meson:
meson setup build_dbg -Dbuildtype=debugoptimized
meson install -C build_dbg
.PHONY: cell static bootstrap clean meson