title: Create Directory using MakeFile
body: <p>I wrote a MakeFile, but I need it to create folder OBJ, so, for this, I tried a lot of things... based on this link:
  <a href="https://stackoverflow.com/questions/ask">https://stackoverflow.com/questions/ask</a></p>
  
  <p>So, that is my makefile</p>
  
  <pre><code>IDIR =.
  CC=gcc
  CFLAGS=-I$(IDIR) -Wall -g
  
  SRCDIR=src
  ODIR=obj
  LIBS=-ltest
  
  _OBJ = main.o 
  OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))
  
  OUTPUTDIR = ../bin
  
  $(ODIR)/%.o: $(SRCDIR)/%.c
      $(CC) -c -o $@ $&lt; $(CFLAGS)
  
  $(OUTPUTDIR)/test: $(OBJ) 
      $(CC) -o $@ $^ $(CFLAGS) $(LIBS)
  </code></pre>
  
  <p>I need to create the obj folder, I tried that idea:</p>
  
  <pre><code>OBJDIR := objdir
  OBJS := $(addprefix $(OBJDIR)/,foo.o bar.o baz.o)
  
  $(OBJDIR)/%.o : %.c
      $(COMPILE.c) $(OUTPUT_OPTION) $&lt;
  
  all: $(OBJS)
  
  $(OBJS): | $(OBJDIR)
  
  $(OBJDIR):
      mkdir -p $(OBJDIR)
  </code></pre>
  
  <p>and this:</p>
  
  <pre><code>MKDIR_P = mkdir -p
  
  .PHONY: directories
  
  all: directories program
  
  directories: ${OUT_DIR}
  
  ${OUT_DIR}:
          ${MKDIR_P} ${OUT_DIR}
  </code></pre>
  
  <p>But apparently every time I called the makefile, it ignored the command to create the directory OBJ and began compiling directly...</p>
  
  <p>How I can make to makefile create the directory?</p>