title: Makefile exits with fatal error
body: <p>I have a project with following structure:</p>
  
  <pre><code>$ tree
  .
  ├── bin
  ├── include
  │   └── reader.h
  ├── Makefile
  ├── obj
  └── src
      ├── main.cpp
      └── reader.cpp
  
  4 directories, 4 files
  </code></pre>
  
  <p>I want to have <code>.cpp</code> file in <code>src/</code>, headers in <code>include/</code> , compile object files in <code>obj/</code> and executables in <code>bin/</code>. I use GNU make in version 4.1, g++ in version 7.2.0 and Ubuntu 17.10. When I try to build it (I try to use ideas <a href="http://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/" rel="nofollow noreferrer">from here</a>, slightly modified) I get following error:</p>
  
  <pre><code>$ make
  make: Circular obj/main.o &lt;- obj/main.o dependency dropped.
  make: Circular obj/reader.o &lt;- obj/main.o dependency dropped.
  make: Circular obj/reader.o &lt;- obj/reader.o dependency dropped.
  g++ -c -o obj/obj/reader.o include/reader.h 
  In file included from &lt;command-line&gt;:0:0:
  /usr/include/stdc-predef.h:1:0: fatal error: can’t create precompiled header obj/obj/reader.o: No such file or directory
   /* Copyright (C) 1991-2017 Free Software Foundation, Inc.
  
  compilation terminated.
  Makefile:15: recipe for target 'obj/reader.o' failed
  make: *** [obj/reader.o] Error 1
  </code></pre>
  
  <p>I am new to makefiles, so I guess it's something very basic. How can I fix this?</p>
  
  <p><strong>EDIT</strong> I forgot about Makefile`. Here we go:</p>
  
  <pre><code>IDIR = include
  OBJDIR = obj
  
  CXX = g++
  CXXFLAGS = -g -Wall -std=c++14 -I$(IDIR)
  DEPS = reader.h
  
  _DEPS = reader.h
  DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS))
  
  _OBJ = main.o reader.o
  OBJ = $(patsubst %,$(OBJDIR)/%,$(_OBJ))
  
  $(OBJDIR)/%.o: $(OBJ) $(DEPS)
      $(CXX) -c -o $(OBJDIR)/$@ $&lt; $(CFLAGS)
  
  main: $(OBJ)
      $(CXX) -o $@ $^ $(CXXFLAGS)
  </code></pre>
  
  <p><strong>EDIT2</strong> After changing language to English I understood the warnings I had. 
   I deleted redundant <code>$(OBJDIR)</code> part from <code>$(OBJDIR)/%.o</code> directive and ended up with something like this:</p>
  
  <pre><code>IDIR = include
  OBJDIR = obj
  
  CXX = g++
  CXXFLAGS = -g -Wall -std=c++14 -I$(IDIR)
  DEPS = reader.h
  
  _DEPS = reader.h
  DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS))
  
  _OBJ = main.o reader.o
  OBJ = $(patsubst %,$(OBJDIR)/%,$(_OBJ))
  
  $(OBJDIR)/%.o: $(OBJ) $(DEPS)
      $(CXX) -c -o $@ $&lt; $(CFLAGS)
  
  main: $(OBJ)
      $(CXX) -o $@ $^ $(CXXFLAGS)
  </code></pre>
  
  <p>and new errors:</p>
  
  <pre><code>$ make
  make: Circular obj/main.o &lt;- obj/main.o dependency dropped.
  make: Circular obj/reader.o &lt;- obj/main.o dependency dropped.
  make: Circular obj/reader.o &lt;- obj/reader.o dependency dropped.
  g++ -c -o obj/main.o obj/reader.o 
  g++: warning: obj/reader.o: linker input file unused because linking not done
  g++ -o main obj/main.o obj/reader.o -g -Wall -std=c++14 -Iinclude
  g++: error: obj/main.o: No such file or directory
  Makefile:18: recipe for target 'main' failed
  make: *** [main] Error 1
  </code></pre>