Makefile 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. SHELL := /bin/sh
  2. CARGO ?= cargo
  3. PREFIX ?= /usr/local
  4. BINDIR ?= $(PREFIX)/bin
  5. DATADIR ?= $(PREFIX)/share
  6. WAYLAND_SESSIONS_DIR ?= /usr/share/wayland-sessions
  7. BIN := target/release/compositron
  8. DESKTOP_FILE := data/compositron.desktop
  9. .PHONY: all build run test fmt clippy install uninstall clean
  10. all: build
  11. build:
  12. $(CARGO) build --release
  13. # Run nested inside the current GNOME/Wayland session. This does not take
  14. # over the seat or the display; it opens Compositron in a normal window.
  15. run: build
  16. @test -n "$$WAYLAND_DISPLAY" || { \
  17. echo "No Wayland session detected. Run this from a GNOME Wayland session." >&2; \
  18. exit 1; \
  19. }
  20. @echo "Starting Compositron nested via WAYLAND_DISPLAY=$$WAYLAND_DISPLAY"
  21. @echo "The overview opens automatically. In GNOME use Ctrl+Alt+Space to reopen it."
  22. exec $(BIN) --winit
  23. test:
  24. $(CARGO) test
  25. fmt:
  26. $(CARGO) fmt
  27. clippy:
  28. $(CARGO) clippy --all-targets -- -D warnings
  29. # Build first, then run "sudo make install".
  30. install:
  31. @test -x $(BIN) || { \
  32. echo "$(BIN) is missing; run 'make build' first." >&2; \
  33. exit 1; \
  34. }
  35. install -Dm755 $(BIN) $(DESTDIR)$(BINDIR)/compositron
  36. install -Dm644 $(DESKTOP_FILE) $(DESTDIR)$(WAYLAND_SESSIONS_DIR)/compositron.desktop
  37. @echo "Installed compositron and its session file."
  38. uninstall:
  39. rm -f $(DESTDIR)$(BINDIR)/compositron
  40. rm -f $(DESTDIR)$(WAYLAND_SESSIONS_DIR)/compositron.desktop
  41. @echo "Removed compositron."
  42. clean:
  43. $(CARGO) clean