.PHONY: all build build-edge build-node build-node-target pack-node-target tidy test test-e2e test-openai-ollama proto proto-dart portal-test portal-build-web clean GOFLAGS ?= -trimpath BUILD_DIR ?= bin NODE_TARGET ?= $(shell go env GOOS)-$(shell go env GOARCH) NODE_TARGET_PARTS = $(subst -, ,$(NODE_TARGET)) NODE_GOOS = $(word 1,$(NODE_TARGET_PARTS)) NODE_GOARCH = $(word 2,$(NODE_TARGET_PARTS)) all: build build: go build $(GOFLAGS) -o $(BUILD_DIR)/iop-edge ./apps/edge/cmd/edge go build $(GOFLAGS) -o $(BUILD_DIR)/iop-node ./apps/node/cmd/node build-edge: go build $(GOFLAGS) -o $(BUILD_DIR)/iop-edge ./apps/edge/cmd/edge build-node: go build $(GOFLAGS) -o $(BUILD_DIR)/iop-node ./apps/node/cmd/node build-node-target: @test -n "$(NODE_GOOS)" && test -n "$(NODE_GOARCH)" || (echo "NODE_TARGET must be -" >&2; exit 2) GOOS=$(NODE_GOOS) GOARCH=$(NODE_GOARCH) go build $(GOFLAGS) -o $(BUILD_DIR)/iop-node-$(NODE_TARGET) ./apps/node/cmd/node pack-node-target: build-edge build-node-target cd $(BUILD_DIR) && ./iop-edge bootstrap pack --target $(NODE_TARGET) --node-binary ./iop-node-$(NODE_TARGET) tidy: go mod tidy test: go test ./... test-e2e: @echo "NOTE: test-e2e runs auxiliary smoke plus fake Ollama OpenAI serving; completion still requires user-flow verification when changing runtime paths." ./scripts/e2e-smoke.sh ./scripts/e2e-openai-ollama.sh test-openai-ollama: ./scripts/e2e-openai-ollama.sh # Requires: protoc + protoc-gen-go (go install google.golang.org/protobuf/cmd/protoc-gen-go@latest) proto: protoc \ --go_out=. \ --go_opt=module=iop \ --proto_path=. \ proto/iop/runtime.proto \ proto/iop/node.proto \ proto/iop/control.proto \ proto/iop/job.proto # Try finding protoc-gen-dart in PATH or common fallback locations PROTOC_GEN_DART := $(shell which protoc-gen-dart 2>/dev/null) ifeq ($(PROTOC_GEN_DART),) PROTOC_GEN_DART := $(wildcard $(HOME)/.pub-cache/bin/protoc-gen-dart) endif ifeq ($(PROTOC_GEN_DART),) PROTOC_GEN_DART := $(wildcard /config/.pub-cache/bin/protoc-gen-dart) endif proto-dart: ifeq ($(PROTOC_GEN_DART),) @echo "Error: protoc-gen-dart not found." @echo "Please install it by running: flutter pub global activate protoc_plugin" @exit 1 endif mkdir -p apps/portal/lib/gen protoc \ --plugin=protoc-gen-dart=$(PROTOC_GEN_DART) \ --dart_out=apps/portal/lib/gen \ --proto_path=. \ --proto_path=/config/.local/include \ /config/.local/include/google/protobuf/struct.proto \ proto/iop/runtime.proto \ proto/iop/node.proto \ proto/iop/control.proto \ proto/iop/job.proto portal-test: cd apps/portal && flutter test portal-build-web: cd apps/portal && flutter build web \ --dart-define=IOP_CONTROL_PLANE_HTTP_URL=http://localhost:9080 \ --dart-define=IOP_CONTROL_PLANE_WIRE_URL=ws://localhost:19080/portal clean: rm -f bin/iop-edge bin/iop-node bin/iop-control-plane bin/iop-worker rm -f bin/iop-node-* rm -f bin/node bin/edge bin/control-plane bin/worker rm -rf bin/artifacts rm -rf dist rm -f iop.db