Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
BIN := lofty
CARGO := cargo

.PHONY: all build release test lint fmt fmt-check clean install deps smoke verify
.PHONY: all build release test lint fmt fmt-check clean install deps smoke verify dev

all: verify

Expand All @@ -30,8 +30,15 @@ fmt-check:
clean:
$(CARGO) clean

# `cargo install` ad-hoc signs, which gives the binary a *new* code identity
# every time. macOS scopes keychain "Always Allow" grants to that identity, so
# an unsigned reinstall silently revokes them and the next run prompts again.
# Re-signing with the stable shared identity keeps one grant valid across every
# future install.
install: SIGN_TARGET = $${CARGO_INSTALL_ROOT:-$$HOME/.cargo}/bin/$(BIN)
install:
$(CARGO) install --path . --force
@$(SIGN)

deps:
$(CARGO) fetch
Expand All @@ -43,3 +50,18 @@ smoke: release
./target/release/$(BIN) info > /dev/null

verify: fmt-check lint test smoke

# Debug build re-signed with the same stable pk-cli-codesign identity, so the
# dev loop doesn't re-prompt either (see cli-common/scripts).
dev: SIGN_TARGET = target/debug/$(BIN)
dev:
cargo build

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new dev target calls cargo build directly instead of $(CARGO) build, unlike every other target in this file (build, release, test, lint, fmt, install, etc.), which all go through the $(CARGO) variable. If CARGO is ever overridden (e.g. a wrapped/pinned toolchain invocation), dev would silently use the wrong cargo binary while the rest of the file honors the override. Fix: use $(CARGO) build for consistency.

Reply inline to this comment.

@$(SIGN)

# Shared re-signing step. No-ops with a note when the helper or identity is
# absent (CI, Linux, a fresh machine that hasn't run setup-dev-signing.sh).
define SIGN
if [ -x "$$HOME/Dev/cli-common/scripts/dev-sign.sh" ]; then \
"$$HOME/Dev/cli-common/scripts/dev-sign.sh" "$(SIGN_TARGET)"; \
else echo "cli-common/scripts/dev-sign.sh not found — $(SIGN_TARGET) left ad-hoc signed"; fi
endef
Loading