-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathMakefile
More file actions
163 lines (135 loc) · 5.98 KB
/
Copy pathMakefile
File metadata and controls
163 lines (135 loc) · 5.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
.DEFAULT_GOAL := standard
GO ?= go
BASH ?= $(dir $(shell command -v sh))bash
PROJECT_ROOT := $(shell pwd -W 2>/dev/null || pwd)
WEB_DIR ?= web/frontend
WEB_ADDR ?= 127.0.0.1:8080
WEB_TOKEN ?=
BIN_DIR ?= bin
ifeq ($(OS),Windows_NT)
EXE := .exe
NPM ?= npm.cmd
else
EXE :=
NPM ?= npm
endif
STANDARD_BIN ?= $(BIN_DIR)/aiscan$(EXE)
FULL_BIN ?= $(BIN_DIR)/aiscan-full$(EXE)
RECORD_BIN ?= $(BIN_DIR)/aiscan-record$(EXE)
RUNNER_BIN ?= $(BIN_DIR)/runner$(EXE)
# Standard/full match release artifacts.
STANDARD_TAGS := forceposix emptytemplates noembed osusergo netgo
FULL_TAGS := forceposix emptytemplates noembed osusergo netgo full sqlite cstx re2_cgo re2_static
RECORD_TAGS := $(FULL_TAGS) record_ffmpeg
BUILD_FLAGS := -trimpath -buildvcs=false
GO_LDFLAGS ?= -s -w
UNAME_S := $(shell uname -s 2>/dev/null)
ifeq ($(OS),Windows_NT)
RECORD_PLATFORM := windows
else ifneq ($(filter MINGW% MSYS% CYGWIN%,$(UNAME_S)),)
RECORD_PLATFORM := windows
else ifeq ($(UNAME_S),Linux)
RECORD_PLATFORM := linux
else
RECORD_PLATFORM := unsupported
endif
RECORD_ARCH ?= $(shell $(GO) env GOARCH)
RECORD_NATIVE_OUTPUT ?= dist/native
RECORD_PREFIX := $(if $(AISCAN_RECORD_PREFIX),$(AISCAN_RECORD_PREFIX),$(PROJECT_ROOT)/.cache/record-native/$(RECORD_PLATFORM)-$(RECORD_ARCH))
ifeq ($(RECORD_PLATFORM),windows)
RECORD_PKG_CONFIG := $(PROJECT_ROOT)/.github/native/pkg-config-static.cmd
RECORD_EXTRA_LDFLAGS := -static -static-libgcc
else
RECORD_PKG_CONFIG := $(CURDIR)/.github/native/pkg-config-static.sh
RECORD_EXTRA_LDFLAGS :=
endif
RECORD_BUILD_ENV := PKG_CONFIG="$(RECORD_PKG_CONFIG)" PKG_CONFIG_PATH="$(RECORD_PREFIX)/lib/pkgconfig" CGO_CFLAGS="-I$(RECORD_PREFIX)/include" CGO_LDFLAGS="-L$(RECORD_PREFIX)/lib $(RECORD_EXTRA_LDFLAGS)"
.PHONY: help prepare frontend proto-gen standard runner full record record-native record-native-source record-native-package web-build web-run web all clean harness harness-llm check-architecture
help:
@echo "AIScan build targets:"
@echo " make / make standard Build the standard AIScan edition"
@echo " make runner Build the tag-free runner binary"
@echo " make full Build frontend, then build the full edition"
@echo " make record Build the record-enabled edition (supported platforms only)"
@echo " make web Build the full edition and start the Web UI"
@echo " make frontend Build only web/frontend into web/static"
@echo " make record-native Download the prebuilt FFmpeg/x264 recorder SDK"
@echo " make record-native-source Build the recorder SDK from pinned sources"
@echo " make record-native-package Package a source-built recorder SDK"
@echo " make proto-gen Regenerate all AOP and AIScan protobuf bindings"
@echo " make harness Run user scenarios against the real product process"
@echo " make harness-llm Run real LLM scenarios (requires explicit credentials)"
@echo " make check-architecture Run static repository and dependency guards"
@echo " make all Build the standard and full editions"
@echo ""
@echo "Variables:"
@echo " BIN_DIR=path Binary output directory (default: $(BIN_DIR))"
@echo " WEB_ADDR=host:port Web listen address (default: $(WEB_ADDR))"
@echo " WEB_TOKEN=token Optional fixed Web access token"
harness:
$(GO) test -count=1 -v -timeout 5m ./cmd/harness/...
harness-llm:
$(GO) test -tags live_llm -run '^TestLiveLLM' -count=1 -v -timeout 8m ./cmd/harness/...
.PHONY: harness-llm-ioa
harness-llm-ioa:
$(GO) test -tags live_llm -run '^TestLiveLLMMultiAgentIOAThreadAndIsolation$$' -count=1 -v -timeout 5m ./cmd/harness/...
.PHONY: harness-llm-subagent
harness-llm-subagent:
$(GO) test -tags live_llm -run '^TestLiveLLMParentDelegatesIOASiblings$$' -count=1 -v -timeout 5m ./cmd/harness/...
check-architecture:
$(GO) test -count=1 ./core/extension ./core/registry
prepare:
mkdir -p "$(BIN_DIR)"
proto-gen:
$(GO) run ./cmd/gen
frontend:
$(NPM) --prefix "$(WEB_DIR)" run build
standard: prepare
CGO_ENABLED=0 $(GO) build $(BUILD_FLAGS) -ldflags "$(GO_LDFLAGS)" -tags "$(STANDARD_TAGS)" -o "$(STANDARD_BIN)" ./cmd/aiscan
@echo "Built standard edition: $(STANDARD_BIN)"
runner: prepare
CGO_ENABLED=0 $(GO) build $(BUILD_FLAGS) -ldflags "$(GO_LDFLAGS)" -o "$(RUNNER_BIN)" ./cmd/runner
@echo "Built runner: $(RUNNER_BIN)"
# Full and record-enabled binaries embed web/static, so frontend must finish first.
record-native:
ifeq ($(RECORD_PLATFORM),unsupported)
@echo "record native backend is not supported on this platform"
else
@if [ "$(AISCAN_RECORD_BUILD_FROM_SOURCE)" = "1" ]; then \
"$(BASH)" ".github/native/sdk.sh" build "$(RECORD_PLATFORM)" "$(RECORD_ARCH)"; \
else \
"$(BASH)" ".github/native/sdk.sh" fetch "$(RECORD_PLATFORM)" "$(RECORD_ARCH)"; \
fi
endif
record-native-source:
ifeq ($(RECORD_PLATFORM),unsupported)
@echo "record native backend is not supported on this platform"
else
"$(BASH)" ".github/native/sdk.sh" build "$(RECORD_PLATFORM)" "$(RECORD_ARCH)"
endif
record-native-package:
ifeq ($(RECORD_PLATFORM),unsupported)
@echo "record native backend is not supported on this platform"
else
"$(BASH)" ".github/native/sdk.sh" package "$(RECORD_PLATFORM)" "$(RECORD_ARCH)" "$(RECORD_NATIVE_OUTPUT)"
endif
full: frontend prepare
CGO_ENABLED=1 $(GO) build $(BUILD_FLAGS) -ldflags "$(GO_LDFLAGS)" -tags "$(FULL_TAGS)" -o "$(FULL_BIN)" ./cmd/aiscan
@echo "Built full edition: $(FULL_BIN)"
ifeq ($(RECORD_PLATFORM),unsupported)
record:
@echo "record native backend is not supported on this platform" >&2
@exit 1
else
record: frontend record-native prepare
$(RECORD_BUILD_ENV) CGO_ENABLED=1 $(GO) build $(BUILD_FLAGS) -ldflags "$(GO_LDFLAGS)" -tags "$(RECORD_TAGS)" -o "$(RECORD_BIN)" ./cmd/aiscan
@echo "Built record-enabled edition: $(RECORD_BIN)"
endif
web-build: full
web-run:
"$(FULL_BIN)" web --addr "$(WEB_ADDR)" $(if $(strip $(WEB_TOKEN)),--token "$(WEB_TOKEN)",)
web: full
"$(FULL_BIN)" web --addr "$(WEB_ADDR)" $(if $(strip $(WEB_TOKEN)),--token "$(WEB_TOKEN)",)
all: standard runner full
clean:
rm -f "$(STANDARD_BIN)" "$(FULL_BIN)" "$(RECORD_BIN)" "$(RUNNER_BIN)"