Fix some 'test' failures when running 'make install'.

When shell variables are unexpectedly empty, 'test' gets the wrong
number of arguments and becomes unhappy.  Logical AND should not be
done with 'test EXPR1 -a EXPR2' in such cases, because 'test' logic
does not short-circuit.  Replace with 'test EXPR1 && test EXPR2'.
Shell logic does short-circuit, and if the first test invocation
fails, the second will never occur, and will never encounter missing
arguments.
This commit is contained in:
John "Elwin" Edwards 2013-08-27 22:54:28 -07:00
parent 1f1ae55a26
commit 9506edfdc4
2 changed files with 6 additions and 6 deletions

View file

@ -117,9 +117,9 @@ install: $(PROGRAM)
-$(TOUCH) test
-if test ! -f $(DESTDIR)$(SCOREFILE) ; \
then $(INSTALL) -m 0664 test $(DESTDIR)$(SCOREFILE) ; fi
-if test "x$(LOGFILE)" != "x" -a ! -f $(DESTDIR)$(LOGFILE) ; then \
-if test "x$(LOGFILE)" != "x" && test ! -f $(DESTDIR)$(LOGFILE) ; then \
$(INSTALL) -m 0664 test $(DESTDIR)$(LOGFILE) ; fi
-if test "x$(SAVEDIR)" != "x" -a ! -d $(DESTDIR)$(SAVEDIR) ; then \
-if test "x$(SAVEDIR)" != "x" && test ! -d $(DESTDIR)$(SAVEDIR) ; then \
$(MKDIR) -p $(DESTDIR)$(SAVEDIR) ; fi
-$(INSTALL) -m 0755 $(PROGRAM) $(DESTDIR)$(bindir)/$(PROGRAM)
-if test "x$(GROUPOWNER)" != "x" ; then \
@ -140,7 +140,7 @@ install: $(PROGRAM)
then $(MKDIR) -p $(DESTDIR)$(docdir) ; fi
-$(INSTALL) -m 0644 LICENSE.TXT $(DESTDIR)$(docdir)/LICENSE.TXT
-$(INSTALL) -m 0644 rogue.me $(DESTDIR)$(docdir)/$(PROGRAM).me
-if test "x$(LOCKFILE)" != "x" -a ! -f $(DESTDIR)$(LOCKFILE) ; then \
-if test "x$(LOCKFILE)" != "x" && test ! -f $(DESTDIR)$(LOCKFILE) ; then \
$(INSTALL) -m 0666 test $(DESTDIR)$(LOCKFILE) ; \
$(RM) $(DESTDIR)$(LOCKFILE) ; \
fi

View file

@ -199,9 +199,9 @@ dist: clean $(PROGRAM)
install: $(PROGRAM)
-$(TOUCH) test
-if test ! -f $(DESTDIR)$(SCOREFILE) ; then $(INSTALL) -m 0664 test $(DESTDIR)$(SCOREFILE) ; fi
-if test "x$(LOGFILE)" != "x" -a ! -f $(DESTDIR)$(LOGFILE) ; then \
-if test "x$(LOGFILE)" != "x" && test ! -f $(DESTDIR)$(LOGFILE) ; then \
$(INSTALL) -m 0664 test $(DESTDIR)$(LOGFILE) ; fi
-if test "x$(SAVEDIR)" != "x" -a ! -d $(DESTDIR)$(SAVEDIR) ; then \
-if test "x$(SAVEDIR)" != "x" && test ! -d $(DESTDIR)$(SAVEDIR) ; then \
$(MKDIR) -p $(DESTDIR)$(SAVEDIR) ; fi
-$(INSTALL) -m 0755 $(PROGRAM) $(DESTDIR)$(bindir)/$(PROGRAM)
-if test "x$(GROUPOWNER)" != "x" ; then \
@ -221,7 +221,7 @@ install: $(PROGRAM)
-$(INSTALL) -m 0644 rogue.cat $(DESTDIR)$(docdir)/$(PROGRAM).cat
-$(INSTALL) -m 0644 LICENSE.TXT $(DESTDIR)$(docdir)/LICENSE.TXT
-$(INSTALL) -m 0644 rogue.me $(DESTDIR)$(docdir)/$(PROGRAM).me
-if test "x$(LOCKFILE)" != "x" -a ! -f $(DESTDIR)$(LOCKFILE) ; then \
-if test "x$(LOCKFILE)" != "x" && test ! -f $(DESTDIR)$(LOCKFILE) ; then \
$(INSTALL) -m 0666 test $(DESTDIR)$(LOCKFILE) ; \
$(RM) $(DESTDIR)$(LOCKFILE) ; \
fi