title: How to put .o and .exe files in a /build/ directory using makefile
body: <p>I'm struggling to find any information on makefiles which is truly beginner level.  Even the question <a href="https://stackoverflow.com/questions/9178285/how-can-makefile-use-separate-directories-for-source-code-and-binaries">here</a>, as asked, is presented using a load of symbols which I don't understand, like <code>$(CC) $(INC) $&lt; $(CFLAGS) -o $(BIN)$@ $(LIBS)</code>.  That throws me off.</p>
  
  <p>My makefile looks like this:</p>
  
  <pre><code>cpptest: main.o
      g++ -o cpptest main.o
  
  main.o: main.cpp
      g++ -c main.cpp
  
  clean:
      rm cpptest main.o
  </code></pre>
  
  <p>This is the full limit of what I know how to do with makefiles.  It works, but places the main.o and cpptest.exe files into the project root.</p>
  
  <p>I want to place the main.o file and the cpptest.exe file into a /build/ directory.  However if I put <code>./build/</code> before every main.o and every cpptest, the object file appears in the project root and the exe file doesn't appear at all.</p>
  
  <p>I'm building this thing using Sublime Text 3 on Windows, for what it's worth.</p>