iop/Makefile
toki 329576345d refactor: separate local build and field dist targets
- Separate local binary build (make build) from field bundle dist (make dist)
- make build now uses direct go build for local development only
- make dist handles cross-platform field binaries with checksums and manifests
- Remove LOCAL_BIN_DIR sync logic from field-binaries.sh
- Update edge-local-dev-guide.md to reflect new build workflow
2026-05-28 14:48:36 +09:00

92 lines
2.5 KiB
Makefile

.PHONY: all build build-edge build-node dist dist-edge dist-node tidy test test-e2e test-openai-ollama proto proto-dart portal-test portal-build-web clean
GOFLAGS ?= -trimpath
BUILD_DIR ?= bin
DIST_APPS ?= edge node
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
dist:
APPS="$(DIST_APPS)" GOFLAGS="$(GOFLAGS)" bin/build/field-binaries.sh
dist-edge:
$(MAKE) dist DIST_APPS=edge
dist-node:
$(MAKE) dist DIST_APPS=node
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/node bin/edge bin/control-plane bin/worker
rm -rf dist
rm -f iop.db