aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorPeter Geissler <peter@haxx.in>2026-08-26 23:29:41 +0200
committerPeter Geissler <peter@haxx.in>2026-08-26 23:30:58 +0200
commit93ef54703fd30a70faf804e857b2dce272681ee0 (patch)
tree7673b23d080ec1f75c0db215f962011967d04dca /Makefile
parentinstall.sh: `make` prints the help text, it does not build (diff)
downloadslosh-93ef54703fd30a70faf804e857b2dce272681ee0.tar.gz
slosh-93ef54703fd30a70faf804e857b2dce272681ee0.tar.xz
slosh-93ef54703fd30a70faf804e857b2dce272681ee0.zip
make install: put the binary and the examples where they belong
There was no way to install slosh short of copying build/slosh by hand, which packagers cannot do and users should not have to. PREFIX and DESTDIR are honoured because that is the contract every package manager already expects; the Homebrew formula calls exactly this. Only the binary is needed at runtime. The config, layout, themes, chrome and shaders are examples you copy into ~/.config/slosh, so they go to share/slosh and nothing reads them from there.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile31
1 files changed, 30 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 2595414..31350cf 100644
--- a/Makefile
+++ b/Makefile
@@ -53,7 +53,7 @@ else
endif
.PHONY: all clean vendor run test retest test-live test-all smoke help coverage \
- docs www fmt fmt-check hooks tools
+ docs www fmt fmt-check hooks tools install uninstall
.DEFAULT_GOAL := help
help: ## show this
@@ -319,6 +319,35 @@ hooks: ## install the pre-commit hook (formats staged C)
$(Q)git config core.hooksPath .githooks
@echo "core.hooksPath -> .githooks (git commit --no-verify to skip)"
+# ── installation ────────────────────────────────────────────────────────────
+# For packagers (Homebrew's formula calls exactly this) and for anyone doing
+# `sudo make install`. DESTDIR is the staging root a package manager wants;
+# PREFIX is where the files will finally live. The binary is the only thing
+# slosh needs to run -- the rest is example configuration you may copy into
+# ~/.config/slosh, so it goes to share/ and nothing reads it from there.
+PREFIX ?= /usr/local
+DESTDIR ?=
+BINDIR := $(DESTDIR)$(PREFIX)/bin
+SHAREDIR := $(DESTDIR)$(PREFIX)/share/slosh
+DOCDIR := $(DESTDIR)$(PREFIX)/share/doc/slosh
+
+install: $(BIN) ## install to $PREFIX (default /usr/local, honours DESTDIR)
+ $(Q)install -d $(BINDIR) $(SHAREDIR) $(DOCDIR)
+ $(Q)install -m 755 $(BIN) $(BINDIR)/slosh
+ $(Q)install -m 644 config/config.kdl config/example.layout $(SHAREDIR)/
+ $(Q)for d in themes chrome shaders; do \
+ install -d $(SHAREDIR)/$$d; \
+ install -m 644 contrib/$$d/*.kdl $(SHAREDIR)/$$d/ 2>/dev/null || true; \
+ done
+ $(Q)install -m 644 README.md $(DOCDIR)/
+ $(Q)install -d $(DOCDIR)/docs && install -m 644 docs/*.md $(DOCDIR)/docs/
+ $(call say,[INST],$(BINDIR)/slosh)
+
+uninstall: ## remove what install put there
+ $(Q)rm -f $(BINDIR)/slosh
+ $(Q)rm -rf $(SHAREDIR) $(DOCDIR)
+ $(call say,[RM],$(BINDIR)/slosh)
+
clean: ## remove our build output (not the vendor lib)
rm -rf build