diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-01-23 07:47:33 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-01-23 07:47:33 +0900 |
| commit | dc59b155d8ebe9d63994cffae824a2f57cb6516f (patch) | |
| tree | e95570f07c1709e739f37bb6fd27f901778936ac /Makefile | |
| parent | 5d38cd02507f1d2b94b25940e2fbf1c47f7683ce (diff) | |
modified Makefile
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 35 |
1 files changed, 33 insertions, 2 deletions
@@ -2,8 +2,39 @@ PREFIX = /usr/local MANPREFIX = $(PREFIX)/share/man +DEPENDENCIES = neomutt curl isync msmtp pass ca-certificates gettext -install: +check-dependencies: + @for dep in $(DEPENDENCIES); do \ + if ! command -v $$dep >/dev/null 2>&1; then \ + echo "Error: $$dep is not installed."; \ + exit 1; \ + fi; \ + done + +install-dependencies: + @if command -v apt-get >/dev/null 2>&1; then \ + echo "Using apt-get to install dependencies..."; \ + sudo apt-get update; \ + sudo apt-get install -y $(DEPENDENCIES); \ + elif command -v yum >/dev/null 2>&1; then \ + echo "Using yum to install dependencies..."; \ + sudo yum install -y $(DEPENDENCIES); \ + elif command -v dnf >/dev/null 2>&1; then \ + echo "Using dnf to install dependencies..."; \ + sudo dnf install -y $(DEPENDENCIES); \ + elif command -v pacman >/dev/null 2>&1; then \ + echo "Using pacman to install dependencies..."; \ + sudo pacman -S --needed $(DEPENDENCIES); \ + elif command -v zypper >/dev/null 2>&1; then \ + echo "Using zypper to install dependencies..."; \ + sudo zypper install -y $(DEPENDENCIES); \ + else \ + echo "Error: No supported package manager found. Please install dependencies manually."; \ + exit 1; \ + fi + +install: install-dependencies check-dependencies mkdir -p $(DESTDIR)$(PREFIX)/bin mkdir -p $(DESTDIR)$(PREFIX)/lib/mutt-wizard mkdir -p $(DESTDIR)$(PREFIX)/share/mutt-wizard @@ -33,4 +64,4 @@ uninstall: rm -f $(DESTDIR)$(MANPREFIX)/man1/mw.1 $(DESTDIR)$(MANPREFIX)/man1/mailsync.1 rm -f $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_mutt-wizard.zsh -.PHONY: install uninstall +.PHONY: install uninstall check-dependencies install-dependencies |
