From c1f2cd3ab28a5511c7e0f1c0386362bc59854cbc Mon Sep 17 00:00:00 2001 From: andy5995 Date: Wed, 14 Oct 2020 02:02:08 -0500 Subject: [PATCH 1/3] fix install target, add uninstall target --- Makefile | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 11b1426..c150302 100644 --- a/Makefile +++ b/Makefile @@ -15,10 +15,12 @@ else POST = strip mm$(E) endif -# PREFIX is the base directory under which to install the binary and man +# INSTALL_PREFIX is the base directory under which to install the binary and man # page; generally either /usr/local or /usr (or perhaps /opt...). +# It can be changed when make is run (e.g. 'make INSTALL_PREFIX=/tmp/pkg install' +# (or when using 'uninstall', respectively)) -PREFIX = /usr/local +INSTALL_PREFIX = $PWD/pkg #-------------------------------------------------------------- # Defaults are for the standard curses setup: @@ -74,7 +76,7 @@ ifeq ($(SYS),DOS) c:\djgpp\bin\cwsdstub.exe+mm mm.exe; del mm endif -HELPDIR = $(PREFIX)/man/man1 +HELPDIR = $(INSTALL_PREFIX)/man/man1 O = o .SUFFIXES: .cc @@ -107,10 +109,23 @@ clean: $(RM) *.o $(RM) mm$(E) -install:: - install -c -s mm $(PREFIX)/bin - install -c -m 644 mm.1 $(HELPDIR) - $(RM) $(HELPDIR)/mmail.1 +install: + install -D -s mm -t $(INSTALL_PREFIX)/bin + install -D -m 644 mm.1 -t $(HELPDIR) + if test -f $(HELPDIR)/mmail.1; then \ + $(RM) $(HELPDIR)/mmail.1; \ + fi ln $(HELPDIR)/mm.1 $(HELPDIR)/mmail.1 +uninstall: + if test -f mm; then \ + $(RM) $(INSTALL_PREFIX)/mm; \ + fi + if test -f mm.1; then \ + $(RM) $(HELPDIR)/mm.1; \ + fi + if test -f $(HELPDIR)/mmail.1; then \ + $(RM) $(HELPDIR)/mmail.1; \ + fi + include depend From f4da7e6ff5ba06bd62f0dc0f0b8a0e155a14e08c Mon Sep 17 00:00:00 2001 From: andy5995 Date: Wed, 14 Oct 2020 02:33:18 -0500 Subject: [PATCH 2/3] revert code used for testing --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c150302..38a130e 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ endif # It can be changed when make is run (e.g. 'make INSTALL_PREFIX=/tmp/pkg install' # (or when using 'uninstall', respectively)) -INSTALL_PREFIX = $PWD/pkg +INSTALL_PREFIX = /usr/local #-------------------------------------------------------------- # Defaults are for the standard curses setup: From 8a438596bd1f910a040086febbc1bafc6c7590a0 Mon Sep 17 00:00:00 2001 From: andy5995 Date: Thu, 15 Oct 2020 04:07:08 -0500 Subject: [PATCH 3/3] fix uninstall and use loop with list of files --- Makefile | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 38a130e..327a190 100644 --- a/Makefile +++ b/Makefile @@ -118,14 +118,10 @@ install: ln $(HELPDIR)/mm.1 $(HELPDIR)/mmail.1 uninstall: - if test -f mm; then \ - $(RM) $(INSTALL_PREFIX)/mm; \ - fi - if test -f mm.1; then \ - $(RM) $(HELPDIR)/mm.1; \ - fi - if test -f $(HELPDIR)/mmail.1; then \ - $(RM) $(HELPDIR)/mmail.1; \ - fi + for file in $(INSTALL_PREFIX)/bin/mm $(HELPDIR)/mm.1 $(HELPDIR)/mmail.1; do \ + if test -f $$file; then \ + $(RM) $$file; \ + fi; \ + done include depend