title: No rule to make target .o, why?
body: <p>This is the first makefile of my life! I have a project in which I have the <em>src</em> folder (in which I keep my .cpp files), an <em>include</em> folder (in which I keep my .hpp files) and a <em>build</em> folder in which I would like to store my object files. </p>
  
  <pre><code> # define the C compiler to use
  CCXX = g++ -std=c++11
  
  # define any compile-time flags
  CXXFLAGS = -g -Wall
  
  # define any directories containing header files other than /usr/include
  INCLUDES = -I./include
  
  #define the directory for src files
  SRCDIR = ./src/
  
  #define the directive for object files
  OBJDIR = ./build/
  
  # define the C source files
  SRCS = action.cpp conditionedBT.cpp control_flow_node.cpp execution_node.cpp main.cpp
  
  # define the C object files 
  OBJS = $(OBJDIR)$(SRCS:.cpp=.o)
  
  # define the executable file 
  MAIN = out
  
  .PHONY: depend 
  
  all: $(MAIN)
      @echo Program compiled
  
  $(MAIN): $(OBJS) 
      $(CCXX) $(CXXFLAGS) $(INCLUDES) -o $(MAIN) $(OBJS)
  
  $(OBJDIR)/%.o: ($SRCDIR)/%.c
      $(CCXX) $(CXXFLAGS) $(INCLUDES) -c -o $@ $&lt;
  #.c.o:
  #   $(CC) $(CFLAGS) $(INCLUDES) -c $&lt;  -o $@
  #clean:
  #   $(RM) *.o *~ $(MAIN)
  
  depend: $(addprefix $(SRCDIR),$(SRCS))
      makedepend $(INCLUDES) $^
  
  # DO NOT DELETE THIS LINE -- make depend needs it
  </code></pre>
  
  <p>Given the above, I get the following error when I try to execute make: </p>
  
  <pre><code>make: *** No rule to make target `build/action.o', needed by `out'.  Stop.
  </code></pre>