From dc59b155d8ebe9d63994cffae824a2f57cb6516f Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Thu, 23 Jan 2025 07:47:33 +0900 Subject: modified Makefile --- Makefile | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 623aaf7..27620f9 100644 --- a/Makefile +++ b/Makefile @@ -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 -- cgit v1.2.3