--- El mié, 24/2/10, Greg Chicares <gchicares@sbcglobal.net> escribió:

De: Greg Chicares <gchicares@sbcglobal.net>
Asunto: Re: [Mingw-users] GMAKE: Unexpected 'test' at this moment
Para: "MinGW Users List" <mingw-users@lists.sourceforge.net>
Fecha: miércoles, 24 de febrero, 2010 00:09

On 2010-02-23 20:13Z, Sebastian Ledesma wrote:
> I'm updating gc.mak file for MingW for the OWLNext project.
> I want to have the same .mak  for both Linux and Windows.
> I have a section to check dirs and create them if necessary.
> It works in Linux, but fails in Windows when using GMAKE.
> The section is:
> CreateDirs:
>     if ! test -e $(TARGETDIR);then mkdir $(TARGETDIR);fi
>     if ! test -e $(OBJROOT);then mkdir $(OBJROOT);fi
>     if ! test -e $(OBJDIR);then > mkdir $(OBJDIR);fi
>     if ! test -e $(LIBDIR);then mkdir $(LIBDIR);fi
> When running gmake, I've receive:
> if ! test -e C:\OWL\\bin;then mkdir C:\OWL\\bin;fi
> No se esperaba test en este momento.
> gmake: ***
> [CreateDirs] Error 255
> "No se esperaba test en este momento" is
> spanish for "Unexpected 'test' at this moment"

The problem isn't with 'make'; it's with the shell. You're using
*nix shell syntax, but I believe you're running CMD.EXE because
this is what happens if I paste the command above into CMD.EXE:

  C:\home>if ! test -e C:\OWL\\bin;then mkdir C:\OWL\\bin;fi
  test was unexpected at this time.

If CMD.EXE is the shell you intend to use, then you'll need to
use its commands and syntax (which I've forgotten, but it's not
as powerful as a *nix shell).

However, since you say:
> I want to have the same .mak  for both Linux and Windows.
you'll need a msw port of a *nix shell...so get MSYS here:
Then you should probably write something like this:
in your makefile--see:


Thank's Greg!!
It's working now.