title: custom makefile works in cmd with Cygwin make, but not in Eclipse CDT
body: <p>I have a simple makefile works OK under CMD prompt using Cygwin make. But have problem by invoking through Make Target in Eclipse CDT.</p>
  
  <p>The content of my makefile is as below:</p>
  
  <pre><code>all: aaa
  
  aaa: bbb.o
      cc -o aaa.exe bbb.o
  
  bbb.o: bbb.c
      cc -c bbb.c
  
  clean:
      rm -f *.exe *.o
  </code></pre>
  
  <p>When in CMD, <code>make all</code> will build and generate aaa.exe, while <code>make clean</code> will clean the EXE file generated.</p>
  
  <p>The make command used is from <code>{myCygwinFolder}\bin\make.exe</code>. This can be checked by <code>which make</code> in CMD, which gives <code>/usr/bin/make</code>. Also, the Cygwin path is added in my system PATH.</p>
  
  <p>But when I try to set up a Standard Make C Project, the <code>make clean</code> just doesn't work. Actually, I have setup 2 Make Targets for my project, <code>make all</code> and <code>make clean</code>. The things happened was, no matter which one I ran, I always got the following error:</p>
  
  <pre><code>Error launching builder (make all )
  (Exec error:The system cannot find the file specified.
  )
  </code></pre>
  
  <p>or</p>
  
  <pre><code>Error launching builder (make clean)
  (Exec error:The system cannot find the file specified.
  )
  </code></pre>
  
  <p>After searching online and some tries, I found it seems Eclipse couldn't find the builder/make properly.</p>
  
  <p>So, I went to the project properties, Builders tab and created a new builder that point to my <code>{myCygwinFolder}\bin\make.exe</code>.</p>
  
  <p>With this fix, I would be able to compile with Make Target <code>make all</code>. But when I compile with Make Target <code>make clean</code>, Eclipse still tries to run Make Target <code>make all</code>.</p>
  
  <p>If I move clean section to the beginning of the makefile. Both Make Target will all run <code>make clean</code>. It seems the all/clean tags are not passed into Cygwin make correctly, and Eclipse just make the first task in makefile.</p>
  
  <p>The project structure setup in Eclipse is:</p>
  
  <pre><code>ProjectRoot
    |__folderA
         |__makefile
         |__bbb.c
         |__*.*
    |__folderB
  </code></pre>
  
  <p>Could anyone can help in setting up correct Make Target in Eclipse? Any comments are welcomed.</p>