title: Makefile with relative paths?
body: <p>I have a problem with my Makefiles on Gentoo Linux.</p>
  
  <p>Here is my folder hierarchy:</p>
  
  <pre><code>Development
   -&gt; GLTools  
     -&gt; include    
     -&gt; src
  
  -&gt;Triangle    
    -&gt;triangle.cpp    
    -&gt;Makefile
  </code></pre>
  
  <p>and my Makefile:</p>
  
  <pre><code>MAIN = triangle
  SRCPATH = ./
  SHAREDPATH = ../GLTools/src/
  SHAREDINCPATH = ../GLTools/include/
  LIBDIRS = -L/usr/local/lib
  INCDIRS = -I/usr/include -I/usr/local/include -I/usr/include/GL \    
                -I$(SHAREDINCPATH)  -I$(SHAREDINCPATH)GL
  
  CC = g++
  CFLAGS = $(COMPILERFLAGS) -g $(INCDIRS)
  LIBS = -lglut -lGL -lGLU -lm
  
  prog : $(MAIN)
  
  $(MAIN).o : $(SRCPATH)$(MAIN).cpp
  glew.o    : $(SHAREDPATH)glew.c
  GLTools.o    : $(SHAREDPATH)GLTools.cpp
  GLBatch.o    : $(SHAREDPATH)GLBatch.cpp
  GLTriangleBatch.o    : $(SHAREDPATH)GLTriangleBatch.cpp
  GLShaderManager.o    : $(SHAREDPATH)GLShaderManager.cpp
  math3d.o    : $(SHAREDPATH)math3d.cpp
  
  $(MAIN) : $(MAIN).o glew.o
       $(CC) $(CFLAGS) -o $(SRCPATH)$(MAIN) $(LIBDIRS) $(SRCPATH)$(MAIN).cpp \
           $(SHAREDPATH)glew.c $(SHAREDPATH)GLTools.cpp $(SHAREDPATH)GLBatch.cpp\ 
           $(SHAREDPATH)GLTriangleBatch.cpp $(SHAREDPATH)GLShaderManager.cpp \
           $(SHAREDPATH)math3d.cpp $(LIBS)
  
  clean:
      rm -f *.o
  </code></pre>
  
  <p>My problem is that get the following error:</p>
  
  <pre><code>demonking@Master ~/Development/Triangle $ make
  g++    -c -o triangle.o triangle.cpp
  triangle.cpp:4:50: error: GLTools.h: No such file or directory
  triangle.cpp:5:56: error: GLShaderManager.h: No such file or directory
  </code></pre>
  
  <p>But when I copy my Makefile to the folder Development (a folder up one level) and edit my paths it compiles without any errors.</p>
  
  <p>Why do I get an error when my triangle.cpp and Makefile are in one folder and I try to access GLTools in the parent folder?</p>