Problem
-------
The if-tests in the makefile src/po/Make_ming.mak do not do what is
intended.  Furthermore, they do not allow for the possibility that the
value of the make variable SHELL might include a path specification.  


Issues
------
1.  The if-tests that reference the SHELL make variable do not do what is
    intended.  

    There are four if-tests in the file Make-ming.mak of the form:

        ifeq (sh.exe, $(SHELL))

    As coded, this condition will be true if and only if the value of
    SHELL is "sh.exe".  However, in all four cases, the if-else blocks are
    incorrectly ordered.  For example, in the current makefile:

        ifeq (sh.exe, $(SHELL))
        VIMRUNTIME = ..\..\runtime
        else
        VIMRUNTIME = ../../runtime
        endif

    should instead be:

        ifeq (sh.exe, $(SHELL))
        VIMRUNTIME = ../../runtime
        else
        VIMRUNTIME = ..\..\runtime
        endif

    Perhaps when these if-tests were added in commit 8889a5c305,
    "ifneq" was intended.  However, see the next point.  

2.  The if-tests do not allow for the possibility that the value of SHELL
    might include a path specification.  

    Using the version of mingw/msys I've downloaded from Source Forge, my
    version of make defines SHELL to be "C:\MinGW\msys\1.0\bin\sh.exe".
    The above if-tests will report that this value is not equal to
    "sh.exe" even though we would like it to report a unix shell is being 
    provided.  A way to address this would be to use the gnu make function
    "notdir", which leads us to rewriting the above as:

        ifeq (sh.exe, $(notdir $(SHELL)))
        VIMRUNTIME = ../../runtime
        else
        VIMRUNTIME = ..\..\runtime
        endif

    The other three if-tests should be modified in the same way.

    I'll point out that SHELL can also be specified on the make command
    line and so its value could include a path.  


Proposed patch
--------------
I've attached a patch that addresses the if-test issues I've raised.  


-mike

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
>From 1d9fbc8fd4f97489ab11903909198a53892c27f0 Mon Sep 17 00:00:00 2001
From: mssr953 <[email protected]>
Date: Sat, 4 Aug 2018 14:28:09 -0400
Subject: [PATCH] Fix if-tests against SHELL

---
 src/po/Make_ming.mak | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/src/po/Make_ming.mak b/src/po/Make_ming.mak
index aa19306c6..1d458559f 100644
--- a/src/po/Make_ming.mak
+++ b/src/po/Make_ming.mak
@@ -11,10 +11,10 @@
 #
 
 ifndef VIMRUNTIME
-ifeq (sh.exe, $(SHELL))
-VIMRUNTIME = ..\..\runtime
-else
+ifeq (sh.exe, $(notdir ($SHELL)))
 VIMRUNTIME = ../../runtime
+else
+VIMRUNTIME = ..\..\runtime
 endif
 endif
 
@@ -29,26 +29,26 @@ PACKAGE = vim
 #GETTEXT_PATH = C:/gettext-0.10.35-w32/win32/Release/
 #GETTEXT_PATH = C:/cygwin/bin/
 
-ifeq (sh.exe, $(SHELL))
-MSGFMT = set OLD_PO_FILE_INPUT=yes && $(GETTEXT_PATH)msgfmt -v
-XGETTEXT = set OLD_PO_FILE_INPUT=yes && set OLD_PO_FILE_OUTPUT=yes && $(GETTEXT_PATH)xgettext
-MSGMERGE = set OLD_PO_FILE_INPUT=yes && set OLD_PO_FILE_OUTPUT=yes && $(GETTEXT_PATH)msgmerge
-else
+ifeq (sh.exe, $(notdir ($SHELL)))
 MSGFMT = LANG=C OLD_PO_FILE_INPUT=yes $(GETTEXT_PATH)msgfmt -v
 XGETTEXT = LANG=C OLD_PO_FILE_INPUT=yes OLD_PO_FILE_OUTPUT=yes $(GETTEXT_PATH)xgettext
 MSGMERGE = LANG=C OLD_PO_FILE_INPUT=yes OLD_PO_FILE_OUTPUT=yes $(GETTEXT_PATH)msgmerge
+else
+MSGFMT = set OLD_PO_FILE_INPUT=yes && $(GETTEXT_PATH)msgfmt -v
+XGETTEXT = set OLD_PO_FILE_INPUT=yes && set OLD_PO_FILE_OUTPUT=yes && $(GETTEXT_PATH)xgettext
+MSGMERGE = set OLD_PO_FILE_INPUT=yes && set OLD_PO_FILE_OUTPUT=yes && $(GETTEXT_PATH)msgmerge
 endif
 
-ifeq (sh.exe, $(SHELL))
-MV = move
-CP = copy
-RM = del
-MKD = mkdir
-else
+ifeq (sh.exe, $(notdir ($SHELL)))
 MV = mv -f
 CP = cp -f
 RM = rm -f
 MKD = mkdir -p
+else
+MV = move
+CP = copy
+RM = del
+MKD = mkdir
 endif
 
 .SUFFIXES:
@@ -78,17 +78,17 @@ install:
 	$(MKD) $(VIMRUNTIME)\lang\$(LANGUAGE)\LC_MESSAGES
 	$(CP) $(LANGUAGE).mo $(VIMRUNTIME)\lang\$(LANGUAGE)\LC_MESSAGES\$(PACKAGE).mo
 
-ifeq (sh.exe, $(SHELL))
-install-all: all
-	FOR %%l IN ($(LANGUAGES)) DO @IF NOT EXIST $(VIMRUNTIME)\lang\%%l $(MKD) $(VIMRUNTIME)\lang\%%l
-	FOR %%l IN ($(LANGUAGES)) DO @IF NOT EXIST $(VIMRUNTIME)\lang\%%l\LC_MESSAGES $(MKD) $(VIMRUNTIME)\lang\%%l\LC_MESSAGES
-	FOR %%l IN ($(LANGUAGES)) DO @$(CP) %%l.mo $(VIMRUNTIME)\lang\%%l\LC_MESSAGES\$(PACKAGE).mo
-else
+ifeq (sh.exe, $(notdir ($SHELL)))
 install-all: all
 	for TARGET in $(LANGUAGES); do \
 		$(MKD) $(VIMRUNTIME)/lang/$$TARGET/LC_MESSAGES ; \
 		$(CP) $$TARGET.mo $(VIMRUNTIME)/lang/$$TARGET/LC_MESSAGES/$(PACKAGE).mo ; \
 	done
+else
+install-all: all
+	FOR %%l IN ($(LANGUAGES)) DO @IF NOT EXIST $(VIMRUNTIME)\lang\%%l $(MKD) $(VIMRUNTIME)\lang\%%l
+	FOR %%l IN ($(LANGUAGES)) DO @IF NOT EXIST $(VIMRUNTIME)\lang\%%l\LC_MESSAGES $(MKD) $(VIMRUNTIME)\lang\%%l\LC_MESSAGES
+	FOR %%l IN ($(LANGUAGES)) DO @$(CP) %%l.mo $(VIMRUNTIME)\lang\%%l\LC_MESSAGES\$(PACKAGE).mo
 endif
 
 clean:
-- 
2.16.1.windows.4

Raspunde prin e-mail lui