title: Parallel makefile requires dependency ordering
body: <p>I have the following piece of makefile:</p>
  
  <pre><code>CXXFLAGS = -std=c++0x -Wall
  SRCS     = test1.cpp test2.cpp
  OBJDIR   = object
  OBJS     = $(SRCS:%.cpp=$(OBJDIR)/%.o)
  
  all: test1 
  release: clean test1
  
  test1: $(OBJS)
      $(CXX) -o $@ $(OBJS)
  
  $(OBJDIR)/%.o: %.cpp
      $(CXX) $(CXXFLAGS) -MD -c -o $@ $&lt;
  
  -include $(SRCS:.cpp=.d)
  
  clean:
      rm -rf $(OBJDIR)/*
  
  .PHONY: all clean release 
  </code></pre>
  
  <p>Now if I try to invoke "make -j4 release" the clean target often gets execute in the middle of building files which causes compilation to fail. My question is how to ensure that the clean target has completed before starting the release build.</p>