Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
175 lines (152 loc) · 5.5 KB
/
Copy pathMakefile
File metadata and controls
175 lines (152 loc) · 5.5 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
164
165
166
167
168
169
170
171
172
173
174
175
# Agentware Agent Makefile
# Professional AI Agent with Command Execution
.PHONY: all build clean test test-e2e test-e2e-docker package install docker-build preflight preflight-quick preflight-full preflight-ci full-check setup install-deps-mac install-deps-ubuntu lint-yaml lint-all help
# Default target
all: build
# Build the project
build:
@echo "Building Agentware Agent..."
@mkdir -p build
@cd build && cmake .. && make
# Clean build artifacts
clean:
@echo "Cleaning build artifacts..."
@rm -rf build
@rm -rf dist
@echo "Clean complete."
# Run basic tests
test: build
@echo "Running basic tests..."
@printf "2\\nexit\\n" | ./build/bin/agentware-agent
# Run E2E tests locally
test-e2e: build
@echo "Running E2E tests locally..."
@BINARY_PATH="$(CURDIR)/build/bin/agentware-agent" ./src/tests/run_e2e_tests.sh
# Run E2E tests in Docker
test-e2e-docker:
@echo "Running E2E tests in Docker..."
@docker-compose -f docker-compose.e2e.yml up --build --abort-on-container-exit
# Create distribution package
package: build
@echo "Creating distribution package..."
@mkdir -p dist
@cp build/bin/agentware-agent dist/
@cp README.md dist/
@cp LICENSE dist/
@cp .env.example dist/
@echo "Package created in dist/"
# Install locally
install: build
@echo "Installing Agentware Agent locally..."
@sudo cp build/bin/agentware-agent /usr/local/bin/
@echo "Installation complete. Run 'agentware-agent' to start."
# Build Docker image
docker-build:
@echo "Building Docker image..."
@docker build -t agentware/agent -f Dockerfile .
# Run the local preflight check (incremental build).
preflight:
@echo "Running preflight checks..."
@./src/scripts/preflight.sh
# Run the preflight check without building (fast: uses the existing binary).
preflight-quick:
@echo "Running preflight checks (no build)..."
@NO_BUILD=1 ./src/scripts/preflight.sh
# Run the preflight check the slow way: clean build plus clang-tidy.
preflight-full:
@echo "Running preflight checks (clean build, clang-tidy)..."
@PREFLIGHT_CLEAN=1 PREFLIGHT_CLANG_TIDY=1 ./src/scripts/preflight.sh
# Kept for existing callers. There is no separate CI flavour any more:
# the check is the same everywhere.
preflight-ci:
@echo "Running preflight checks..."
@./src/scripts/preflight.sh
# Run full check (clean, build, test, preflight-quick, preflight)
full-check:
@echo "Running full check..."
@./src/scripts/full-check.sh
# Run CI locally (simulate GitHub Actions)
ci:
@echo "Running local CI simulation..."
@make clean && make build && make test && make preflight-ci
# Setup development environment
setup:
@echo "Setting up development environment..."
@./src/scripts/setup-git-hooks.sh
# Install dependencies on macOS
install-deps-mac:
@echo "Installing dependencies on macOS..."
@brew install cpr nlohmann-json cmake
# Install dependencies on Ubuntu
install-deps-ubuntu:
@echo "Installing dependencies on Ubuntu..."
@sudo apt update
@sudo apt install -y nlohmann-json3-dev cmake build-essential git libcurl4-openssl-dev
@rm -rf /tmp/cpr
@git clone --depth=1 https://github.com/libcpr/cpr.git /tmp/cpr
@cmake -S /tmp/cpr -B /tmp/cpr/build -DBUILD_CPR_TESTS=OFF -DCPR_USE_SYSTEM_CURL=ON -DCMAKE_BUILD_TYPE=Release
@sudo cmake --build /tmp/cpr/build --target install
@sudo ldconfig
@rm -rf /tmp/cpr
# Lint YAML files
lint-yaml:
@echo "Running yamllint on YAML files..."
@yamllint -c .yamllint.yml .
# Run pre-commit on all files
lint-all:
@echo "Running pre-commit on all files..."
@pre-commit run --all-files
# Run clang-tidy on source files
clang-tidy: build
@echo "Running clang-tidy on source files..."
@if ! command -v clang-tidy >/dev/null 2>&1; then \
echo "Error: clang-tidy not found. Install clang-tidy to run this target."; \
exit 1; \
fi
@if [ ! -f "build/compile_commands.json" ]; then \
echo "Error: build/compile_commands.json not found."; \
exit 1; \
fi
@find src -name "*.cpp" -print0 | xargs -0 clang-tidy -p build
# Show help
help:
@echo "Agentware Agent - Available Make Targets:"
@echo ""
@echo "Build Commands:"
@echo " build Build the project"
@echo " clean Clean build artifacts"
@echo " test Run basic tests"
@echo " test-e2e Run E2E tests locally"
@echo " test-e2e-docker Run E2E tests in Docker"
@echo " package Create distribution package"
@echo ""
@echo "Code Quality:"
@echo " lint-yaml Run yamllint on YAML files"
@echo " lint-all Run all pre-commit hooks"
@echo " clang-tidy Run clang-tidy static analysis"
@echo ""
@echo "Installation:"
@echo " install Install locally to /usr/local/bin"
@echo " install-deps-mac Install dependencies on macOS"
@echo " install-deps-ubuntu Install dependencies on Ubuntu"
@echo ""
@echo "Development:"
@echo " setup Setup development environment"
@echo " preflight Run preflight checks (smart)"
@echo " preflight-quick Run quick preflight checks"
@echo " preflight-full Run full preflight checks"
@echo " preflight-ci Run CI-style preflight checks"
@echo " full-check Run full check (clean, build, test, preflights)"
@echo ""
@echo "Docker:"
@echo " docker-build Build Docker image"
@echo ""
@echo "Other:"
@echo " help Show this help message"
@echo ""
@echo "Examples:"
@echo " make build # Build the project"
@echo " make test-e2e # Run E2E tests"
@echo " make preflight # Run preflight checks"
@echo " make package # Create distribution"
@echo " make install # Install locally"