Search code examples
cmakefilemingwmsys

MSYS make.exe command won't do anything ("Nothing to be done for...")


Ok, hello everyone. I searched a lot to see if I could find an answer to my question, but I couldn't. I installed the latest versions of MinGW and MSYS on Windows 10. I created a very simple C file, based on Zed Shaw's guide (Learn C the hard way), which looks like this:

#include <stdio.h>

int main(int argc, char *argv[])
{
    int distance = 666;

    printf("You are %d miles away. \n", distance);

    return 0;

}

Now, according to Shaw's guide, I should be able to compile the file just by using the following command:

make .\es1.c

And it should automatically recognise that I'm compiling a C source file and use some default options, like "-o es1", even without a makefile. The problem is that when I try to compile it using MSYS's make, I get this:

make.exe": Nothing to be done for `.\es1.c'.

And I can't make it compile in any way. If I call directly the gcc compiler, in this way:

gcc .\es1.c -o es1

It works. What I am I doing wrong?

Thank you everybody.


Solution

  • The problem maybe is with the schizophrenic interaction of Unix build tools and Windows program execution:

    user@dogbert ~/foo
    $ echo "int main() { return 0; }" > foo.c
    
    user@dogbert ~/foo
    $ cat foo.c
    int main() { return 0; }
    

    So far so good. Now make it - no makefile needed.

    user@dogbert ~/foo
    $ make foo
    cc     foo.c   -o foo
    

    Although the target was named foo, foo.exe was made.

    user@dogbert ~/foo
    $ ls
    foo.c  foo.exe
    
    user@dogbert ~/foo
    $ ./foo
    
    user@dogbert ~/foo
    $ ./foo.exe
    

    It seems that foo and foo.exe are synonyms on cygwin.

    user@dogbert ~/foo
    $ make foo
    make: foo is up to date
    
    user@dogbert ~/foo
    $