summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTommaso Negri <me@tommasongr.com>2026-10-15 11:04:07 +0200
committerTommaso Negri <me@tommasongr.com>2026-10-15 11:04:07 +0200
commitb1d16ce115571840bf69a5483f86d407623ec358 (patch)
tree37f93fb337f37195423f8d2d52063cc2c12e7241
parent758f757cb9b60dddf10efd5d37becfec9f4b5196 (diff)
downloadbar-b1d16ce115571840bf69a5483f86d407623ec358.tar.gz
bar-b1d16ce115571840bf69a5483f86d407623ec358.zip
improve makefile
-rw-r--r--Makefile8
-rw-r--r--Sources/bar/bar.docc/installation.md3
-rw-r--r--tasks/20261014-192147/TASK.md13
3 files changed, 18 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index af81feb..c6d3542 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@ build:
.PHONY: run
run:
- swift run bar -c debug
+ swift run -c debug bar
.PHONY: clean
clean:
@@ -14,12 +14,12 @@ clean:
.PHONY: install
install: build
- @install -d $(PREFIX)/bin/
- @install -Dm755 .build/release/bar $(PREFIX)/bin/
+ @install -d "$(PREFIX)/bin/"
+ @install -m 755 ".build/release/bar" "$(PREFIX)/bin/"
.PHONY: uninstall
uninstall:
- @rm -f $(PREFIX)/bin/bar
+ @rm -f "$(PREFIX)/bin/bar"
.PHONY: docs
docs: .build/release/bar
diff --git a/Sources/bar/bar.docc/installation.md b/Sources/bar/bar.docc/installation.md
index bee3dfd..83e610f 100644
--- a/Sources/bar/bar.docc/installation.md
+++ b/Sources/bar/bar.docc/installation.md
@@ -30,7 +30,7 @@ make install
> You can override the install location by setting `PREFIX`:
>
> ```shell
-> make install PREFIX=/usr/local/bin
+> make install PREFIX=/usr/local
> ```
> Tip: While iterating on the configuration, use `make run` instead.
@@ -42,5 +42,6 @@ If you don't have `make`, build directly with the Swift Package Manager:
```shell
swift build -c release
+mkdir -p ~/.local/bin
cp .build/release/bar ~/.local/bin/
```
diff --git a/tasks/20261014-192147/TASK.md b/tasks/20261014-192147/TASK.md
index 6961419..e10f869 100644
--- a/tasks/20261014-192147/TASK.md
+++ b/tasks/20261014-192147/TASK.md
@@ -1,6 +1,6 @@
# Correct macOS build and installation commands
-- STATUS: OPEN
+- STATUS: CLOSED
- PRIORITY: 150
- TAGS: review,bug,build,docs
@@ -13,3 +13,14 @@ Approach: Use swift run -c debug bar. Keep install -d, followed by macOS-compati
Completion checks: Run make build and inspect/run make run on macOS. Install into a temporary writable prefix, including one with spaces; confirm executable location and permissions and exercise uninstall only in that temporary prefix. Check docs match the exact resulting paths. Do not overwrite the user's installed bar during verification.
Design constraint: Follow README.md: keep source-based configuration, no dependencies or plugin framework, and use the smallest readable change that makes the existing behavior reliable. This is a suggestion for individual review, not a deadline. Findings were recorded on 2026-10-14; re-check the current code before implementing.
+
+Completed 2026-10-15: corrected Swift run option order, replaced GNU install
+flags with macOS-compatible install commands, quoted installation/uninstallation
+paths, and corrected the documented prefix and manual directory creation.
+
+Validation: `make build` passed on macOS. `make -n run` prints
+`swift run -c debug bar`. Installation into two temporary writable prefixes,
+including one containing spaces, produced an identical binary at `<prefix>/bin/bar`
+with mode 755; uninstall removed each binary. Installation checks used
+`make install -o build` to reuse the verified release build. No existing user
+installation was changed. `git diff --check` passed.