global cell shops
This commit is contained in:
52
Makefile
52
Makefile
@@ -3,54 +3,72 @@
|
||||
#
|
||||
# If cell doesn't exist yet, use 'make bootstrap' first (requires meson)
|
||||
# or manually build with meson once.
|
||||
#
|
||||
# The cell shop is at ~/.cell and core scripts are installed to ~/.cell/core
|
||||
|
||||
cell: libcell_runtime.dylib cell_main core.qop
|
||||
cat cell_main > cell
|
||||
cat core.qop >> cell
|
||||
CELL_SHOP = $(HOME)/.cell
|
||||
CELL_CORE = $(CELL_SHOP)/core
|
||||
|
||||
cell: libcell_runtime.dylib cell_main
|
||||
cp cell_main 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
|
||||
libcell_runtime.dylib: $(CELL_SHOP)/build/dynamic
|
||||
cell build -d
|
||||
cp .cell/build/dynamic/libcell_runtime.dylib .
|
||||
cp $(CELL_SHOP)/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
|
||||
# Install core: symlink this directory to ~/.cell/core
|
||||
install: $(CELL_SHOP)
|
||||
@echo "Linking cell core to $(CELL_CORE)"
|
||||
rm -rf $(CELL_CORE)
|
||||
ln -s $(PWD) $(CELL_CORE)
|
||||
@echo "Core installed."
|
||||
|
||||
# Create the cell shop directories
|
||||
$(CELL_SHOP):
|
||||
mkdir -p $(CELL_SHOP)
|
||||
mkdir -p $(CELL_SHOP)/packages
|
||||
mkdir -p $(CELL_SHOP)/cache
|
||||
mkdir -p $(CELL_SHOP)/build
|
||||
|
||||
$(CELL_CORE):
|
||||
ln -s $(PWD) $(CELL_CORE)
|
||||
|
||||
# Static build: creates a fully static cell binary (for distribution)
|
||||
static:
|
||||
cell build
|
||||
cp .cell/build/static/cell .
|
||||
cat core.qop >> cell
|
||||
cp $(CELL_SHOP)/build/static/cell .
|
||||
|
||||
# Bootstrap: build cell from scratch using meson (only needed once)
|
||||
bootstrap:
|
||||
# Also installs core scripts to ~/.cell/core
|
||||
bootstrap: install
|
||||
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."
|
||||
@echo "Bootstrap complete. Cell shop initialized at $(CELL_SHOP)"
|
||||
@echo "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
|
||||
rm -rf $(CELL_SHOP)/build build_bootstrap
|
||||
rm -f cell cell_main libcell_runtime.dylib
|
||||
|
||||
# Ensure dynamic build directory exists
|
||||
.cell/build/dynamic:
|
||||
mkdir -p .cell/build/dynamic
|
||||
$(CELL_SHOP)/build/dynamic: $(CELL_SHOP)
|
||||
mkdir -p $(CELL_SHOP)/build/dynamic
|
||||
|
||||
# Legacy meson target
|
||||
meson:
|
||||
meson setup build_dbg -Dbuildtype=debugoptimized
|
||||
meson install -C build_dbg
|
||||
|
||||
.PHONY: cell static bootstrap clean meson
|
||||
.PHONY: cell static bootstrap clean meson install
|
||||
|
||||
Reference in New Issue
Block a user