# 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. # # The cell shop is at ~/.cell and core scripts are installed to ~/.cell/core CELL_SHOP = $(HOME)/.cell CELL_CORE_PACKAGE = $(CELL_SHOP)/packages/core makecell: cell pack core -o cell cp cell /opt/homebrew/bin/ # Install core: symlink this directory to ~/.cell/core install: bootstrap $(CELL_SHOP) @echo "Linking cell core to $(CELL_CORE_PACKAGE)" rm -rf $(CELL_CORE_PACKAGE) ln -s $(PWD) $(CELL_CORE_PACKAGE) cp cell /opt/homebrew/bin/ cp libcell_runtime.dylib /opt/homebrew/lib/ @echo "Core installed." 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_SHOP)/build/dynamic cell build -d 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 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_SHOP)/build/static/cell . # Bootstrap: build cell from scratch using meson (only needed once) # Also installs core scripts to ~/.cell/core 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. Cell shop initialized at $(CELL_SHOP)" @echo "Now run 'make' to rebuild with cell itself." # Clean build artifacts clean: rm -rf $(CELL_SHOP)/build build_bootstrap rm -f cell cell_main libcell_runtime.dylib # Ensure dynamic build directory exists $(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 install