Skip to content

Commit 9f70ad3

Browse files
author
Claude Dev
committed
fix: update Makefile targets for merged binary, remove launcher/local build targets
1 parent 263e6d4 commit 9f70ad3

1 file changed

Lines changed: 23 additions & 142 deletions

File tree

Makefile

Lines changed: 23 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -68,45 +68,14 @@ setup:
6868
test-section-check: build install-daemon
6969
@./scripts/test-section-check.sh
7070

71-
# Install the locally-built daemon over the downloaded release binary.
72-
# Ensures mxcli uses the current dev-branch code during local development.
73-
install: install-daemon
74-
75-
# Windows: stop running daemon first (taskkill may fail if already stopped).
76-
install-daemon: build
77-
@DAEMON_DIR="$$HOME/.mxcli/daemon"; \
78-
DAEMON_BIN="$$DAEMON_DIR/mxcli-daemon$(if $(findstring windows,$(shell go env GOOS)),.exe,)"; \
79-
if [ -f "$$DAEMON_BIN" ]; then \
80-
echo "Stopping running daemon..."; \
81-
pkill -f mxcli-daemon 2>/dev/null || powershell.exe -Command "Stop-Process -Name mxcli-daemon -Force -ErrorAction SilentlyContinue" 2>/dev/null || true; \
82-
sleep 1; \
83-
fi; \
84-
cp "$(BUILD_DIR)/$(DAEMON_NAME)$(if $(findstring windows,$(shell go env GOOS)),.exe,)" "$$DAEMON_BIN"; \
85-
DAEMON_VER=$$("$$DAEMON_BIN" --version 2>&1 | head -1); \
86-
echo "$$DAEMON_VER" > "$$DAEMON_DIR/version"; \
87-
echo "Installed: $$DAEMON_BIN ($$DAEMON_VER)"; \
88-
LAUNCHER_DIR=$$(dirname "$$(command -v mxcli 2>/dev/null || true)"); \
89-
LAUNCHER_BIN="$(BUILD_DIR)/$(BINARY_NAME)$(if $(findstring windows,$(shell go env GOOS)),.exe,)"; \
90-
if [ -n "$$LAUNCHER_DIR" ] && [ -d "$$LAUNCHER_DIR" ]; then \
91-
LAUNCHER_DEST="$$LAUNCHER_DIR/mxcli$(if $(findstring windows,$(shell go env GOOS)),.exe,)"; \
92-
if [ -f "$$LAUNCHER_DEST" ]; then \
93-
echo "Stopping running launcher..."; \
94-
pkill -x mxcli 2>/dev/null || powershell.exe -Command "Stop-Process -Name mxcli -Force -ErrorAction SilentlyContinue" 2>/dev/null || true; \
95-
sleep 1; \
96-
fi; \
97-
cp "$$LAUNCHER_BIN" "$$LAUNCHER_DEST"; \
98-
echo "Installed launcher: $$LAUNCHER_DEST"; \
99-
else \
100-
echo "Launcher not in PATH — copy manually: cp $$LAUNCHER_BIN <your-bin-dir>/mxcli$(if $(findstring windows,$(shell go env GOOS)),.exe,)"; \
101-
fi
71+
# Install the locally-built binary to PATH.
72+
install: install-global
10273

103-
# Install mxcli-daemon as `mxcli` to ~/.local/bin (no sudo needed).
104-
# Also installs shell completions for the current user.
10574
install-global: build
10675
@INSTALL_DIR="$${HOME}/.local/bin"; \
10776
mkdir -p "$$INSTALL_DIR"; \
108-
echo "Installing $(DAEMON_NAME) to $$INSTALL_DIR/mxcli..."; \
109-
cp "$(BUILD_DIR)/$(DAEMON_NAME)" "$$INSTALL_DIR/mxcli"; \
77+
echo "Installing mxcli to $$INSTALL_DIR/mxcli..."; \
78+
cp "$(BUILD_DIR)/$(BINARY_NAME)" "$$INSTALL_DIR/mxcli"; \
11079
chmod 755 "$$INSTALL_DIR/mxcli"; \
11180
echo "✅ Installed $$INSTALL_DIR/mxcli"; \
11281
echo ""; \
@@ -182,26 +151,8 @@ sync-all: sync-skills sync-commands sync-lint-rules sync-changelog sync-examples
182151
# On Windows, also creates .exe-suffixed copies so PowerShell can execute them.
183152
build: sync-all
184153
@mkdir -p $(BUILD_DIR)
185-
CGO_ENABLED=0 go build $(LDFLAGS) -o $(BUILD_DIR)/$(DAEMON_NAME) $(CMD_PATH)
186-
CGO_ENABLED=0 go build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME) ./cmd/mxcli-launcher
187-
@if [ "$(OS)" = "Windows_NT" ] || echo "$$OSTYPE" | grep -qi msys; then \
188-
cp $(BUILD_DIR)/$(DAEMON_NAME) $(BUILD_DIR)/$(DAEMON_NAME).exe 2>/dev/null || true; \
189-
cp $(BUILD_DIR)/$(BINARY_NAME) $(BUILD_DIR)/$(BINARY_NAME).exe 2>/dev/null || true; \
190-
echo "Built $(BUILD_DIR)/$(BINARY_NAME)[.exe] $(BUILD_DIR)/$(DAEMON_NAME)[.exe] (go build auto-adds .exe; cp is a MSYS2/Cygwin safety net)"; \
191-
else \
192-
echo "Built $(BUILD_DIR)/$(BINARY_NAME) $(BUILD_DIR)/$(DAEMON_NAME)"; \
193-
fi
194-
195-
build-local:
196-
@mkdir -p $(BUILD_DIR)
197-
CGO_ENABLED=0 go build $(LOCAL_LDFLAGS) -o $(BUILD_DIR)/$(LOCAL_NAME) $(LOCAL_PATH)
198-
@echo "Built $(BUILD_DIR)/$(LOCAL_NAME)"
199-
200-
install-local: build-local
201-
@LOCAL_DIR="$$HOME/.mxcli/local"; \
202-
mkdir -p "$$LOCAL_DIR"; \
203-
cp "$(BUILD_DIR)/$(LOCAL_NAME)" "$$LOCAL_DIR/$(LOCAL_NAME)"; \
204-
echo "Installed: $$LOCAL_DIR/$(LOCAL_NAME)"
154+
CGO_ENABLED=0 go build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME) $(CMD_PATH)
155+
@echo "Built $(BUILD_DIR)/$(BINARY_NAME)"
205156

206157
# Compress a single daemon binary: make compress-daemon BIN=bin/mxcli-daemon-linux-amd64
207158
compress-daemon:
@@ -222,98 +173,28 @@ release: clean sync-all
222173
@mkdir -p $(BUILD_DIR)
223174
@echo "Building release binaries..."
224175

225-
@echo " -> Launchers (all platforms)"
226-
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(LAUNCHER_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(BINARY_NAME)-linux-amd64 ./cmd/mxcli-launcher
227-
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build $(LAUNCHER_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(BINARY_NAME)-linux-arm64 ./cmd/mxcli-launcher
228-
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build $(LAUNCHER_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-amd64 ./cmd/mxcli-launcher
229-
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build $(LAUNCHER_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-arm64 ./cmd/mxcli-launcher
230-
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build $(LAUNCHER_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(BINARY_NAME)-windows-amd64.exe ./cmd/mxcli-launcher
231-
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build $(LAUNCHER_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(BINARY_NAME)-windows-arm64.exe ./cmd/mxcli-launcher
232-
233-
@echo " -> Daemons (all platforms)"
234-
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(RELEASE_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(DAEMON_NAME)-linux-amd64 $(CMD_PATH)
235-
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build $(RELEASE_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(DAEMON_NAME)-linux-arm64 $(CMD_PATH)
236-
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build $(RELEASE_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(DAEMON_NAME)-darwin-amd64 $(CMD_PATH)
237-
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build $(RELEASE_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(DAEMON_NAME)-darwin-arm64 $(CMD_PATH)
238-
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build $(RELEASE_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(DAEMON_NAME)-windows-amd64.exe $(CMD_PATH)
239-
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build $(RELEASE_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(DAEMON_NAME)-windows-arm64.exe $(CMD_PATH)
240-
241-
@echo " -> Compressing daemon binaries (requires zstd)"
242-
@for f in $(BUILD_DIR)/$(DAEMON_NAME)-linux-* $(BUILD_DIR)/$(DAEMON_NAME)-darwin-*; do \
243-
echo " $$f -> $$f.tar.zst"; \
244-
cp "$$f" "$(BUILD_DIR)/$(DAEMON_NAME)"; \
245-
tar -cf - -C $(BUILD_DIR) $(DAEMON_NAME) | zstd -19 -f -o $$f.tar.zst; \
246-
rm -f "$(BUILD_DIR)/$(DAEMON_NAME)"; \
247-
done
248-
@for f in $(BUILD_DIR)/$(DAEMON_NAME)-windows-*.exe; do \
249-
echo " $$f -> $$f.zip"; \
250-
cp "$$f" "$(BUILD_DIR)/$(DAEMON_NAME).exe"; \
251-
zip -j $$f.zip "$(BUILD_DIR)/$(DAEMON_NAME).exe"; \
252-
rm -f "$(BUILD_DIR)/$(DAEMON_NAME).exe"; \
253-
done
176+
@echo " -> mxcli (all platforms)"
177+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(RELEASE_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(BINARY_NAME)-linux-amd64 $(CMD_PATH)
178+
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build $(RELEASE_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(BINARY_NAME)-linux-arm64 $(CMD_PATH)
179+
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build $(RELEASE_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-amd64 $(CMD_PATH)
180+
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build $(RELEASE_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-arm64 $(CMD_PATH)
181+
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build $(RELEASE_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(BINARY_NAME)-windows-amd64.exe $(CMD_PATH)
182+
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build $(RELEASE_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(BINARY_NAME)-windows-arm64.exe $(CMD_PATH)
254183

255184
@echo ""
256185
@echo "Release binaries built in $(BUILD_DIR)/."
257-
@echo " Launchers: mxcli-{os}-{arch}"
258-
@echo " Daemons: mxcli-daemon-{os}-{arch}.tar.zst (or .zip)"
259186

260-
# Build launcher binaries for all platforms (v* release pipeline).
261-
release-launcher: sync-all
187+
# Build mxcli binaries for all platforms (v* release pipeline).
188+
release-mxcli: sync-all
262189
@mkdir -p $(BUILD_DIR)
263-
@echo " -> Launcher (all platforms)"
264-
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(LAUNCHER_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(BINARY_NAME)-linux-amd64 ./cmd/mxcli-launcher
265-
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build $(LAUNCHER_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(BINARY_NAME)-linux-arm64 ./cmd/mxcli-launcher
266-
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build $(LAUNCHER_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-amd64 ./cmd/mxcli-launcher
267-
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build $(LAUNCHER_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-arm64 ./cmd/mxcli-launcher
268-
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build $(LAUNCHER_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(BINARY_NAME)-windows-amd64.exe ./cmd/mxcli-launcher
269-
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build $(LAUNCHER_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(BINARY_NAME)-windows-arm64.exe ./cmd/mxcli-launcher
270-
@echo "Launcher binaries built in $(BUILD_DIR)/."
271-
272-
# Build daemon binaries for all platforms (daemon-v* release pipeline).
273-
release-daemon: sync-all
274-
@mkdir -p $(BUILD_DIR)
275-
@echo " -> Daemon (all platforms)"
276-
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(RELEASE_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(DAEMON_NAME)-linux-amd64 $(CMD_PATH)
277-
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build $(RELEASE_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(DAEMON_NAME)-linux-arm64 $(CMD_PATH)
278-
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build $(RELEASE_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(DAEMON_NAME)-darwin-amd64 $(CMD_PATH)
279-
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build $(RELEASE_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(DAEMON_NAME)-darwin-arm64 $(CMD_PATH)
280-
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build $(RELEASE_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(DAEMON_NAME)-windows-amd64.exe $(CMD_PATH)
281-
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build $(RELEASE_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(DAEMON_NAME)-windows-arm64.exe $(CMD_PATH)
282-
@echo " -> Compressing daemon binaries"
283-
@for f in $(BUILD_DIR)/$(DAEMON_NAME)-linux-* $(BUILD_DIR)/$(DAEMON_NAME)-darwin-*; do \
284-
cp "$$f" "$(BUILD_DIR)/$(DAEMON_NAME)"; \
285-
tar -cf - -C $(BUILD_DIR) $(DAEMON_NAME) | zstd -19 -f -o $$f.tar.zst; \
286-
rm -f "$(BUILD_DIR)/$(DAEMON_NAME)"; \
287-
done
288-
@for f in $(BUILD_DIR)/$(DAEMON_NAME)-windows-*.exe; do \
289-
cp "$$f" "$(BUILD_DIR)/$(DAEMON_NAME).exe"; \
290-
zip -j $$f.zip "$(BUILD_DIR)/$(DAEMON_NAME).exe"; \
291-
rm -f "$(BUILD_DIR)/$(DAEMON_NAME).exe"; \
292-
done
293-
@echo "Daemon binaries built in $(BUILD_DIR)/."
294-
295-
# Build mxcli-local binaries for all platforms (local-v* release pipeline).
296-
release-local-bins: sync-all
297-
@mkdir -p $(BUILD_DIR)
298-
@echo " -> mxcli-local (all platforms)"
299-
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(LOCAL_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(LOCAL_NAME)-linux-amd64 $(LOCAL_PATH)
300-
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build $(LOCAL_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(LOCAL_NAME)-linux-arm64 $(LOCAL_PATH)
301-
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build $(LOCAL_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(LOCAL_NAME)-darwin-amd64 $(LOCAL_PATH)
302-
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build $(LOCAL_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(LOCAL_NAME)-darwin-arm64 $(LOCAL_PATH)
303-
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build $(LOCAL_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(LOCAL_NAME)-windows-amd64.exe $(LOCAL_PATH)
304-
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build $(LOCAL_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(LOCAL_NAME)-windows-arm64.exe $(LOCAL_PATH)
305-
@echo " -> Compressing mxcli-local binaries"
306-
@for f in $(BUILD_DIR)/$(LOCAL_NAME)-linux-* $(BUILD_DIR)/$(LOCAL_NAME)-darwin-*; do \
307-
cp "$$f" "$(BUILD_DIR)/$(LOCAL_NAME)"; \
308-
tar -cf - -C $(BUILD_DIR) $(LOCAL_NAME) | zstd -19 -f -o $$f.tar.zst; \
309-
rm -f "$(BUILD_DIR)/$(LOCAL_NAME)"; \
310-
done
311-
@for f in $(BUILD_DIR)/$(LOCAL_NAME)-windows-*.exe; do \
312-
cp "$$f" "$(BUILD_DIR)/$(LOCAL_NAME).exe"; \
313-
zip -j $$f.zip "$(BUILD_DIR)/$(LOCAL_NAME).exe"; \
314-
rm -f "$(BUILD_DIR)/$(LOCAL_NAME).exe"; \
315-
done
316-
@echo "mxcli-local binaries built in $(BUILD_DIR)/."
190+
@echo " -> mxcli (all platforms)"
191+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(RELEASE_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(BINARY_NAME)-linux-amd64 $(CMD_PATH)
192+
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build $(RELEASE_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(BINARY_NAME)-linux-arm64 $(CMD_PATH)
193+
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build $(RELEASE_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-amd64 $(CMD_PATH)
194+
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build $(RELEASE_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-arm64 $(CMD_PATH)
195+
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build $(RELEASE_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(BINARY_NAME)-windows-amd64.exe $(CMD_PATH)
196+
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build $(RELEASE_LDFLAGS) -trimpath -o $(BUILD_DIR)/$(BINARY_NAME)-windows-arm64.exe $(CMD_PATH)
197+
@echo "mxcli binaries built in $(BUILD_DIR)/."
317198

318199
# Run tests. CPU is capped at 85% via _CPU_RUNNER (cpulimit or nice -n 15)
319200
# so the machine stays responsive. TEST_P/TEST_PARALLEL default to 85% nproc.

0 commit comments

Comments
 (0)