title: If clauses inside makefile produces erros
body: <p>I have the following part of a <code>Makefile</code></p>
  
  <pre><code>#.SILENT:
  #.PHONY:
  SHELL     := /bin/bash
  ################################################################
  ## Colordefinition
  ################################################################
  NO_COLOR    = \x1b[0m
  OK_COLOR    = \x1b[32;01m
  ERROR_COLOR = \x1b[31;01m
  
  %.pdf: %.tex
      NAME=`basename $&lt; .tex` ;\
      echo -e "\t$(OK_COLOR)Typesetting $$NAME$(NO_COLOR)" ;\
      pdflatex -draftmode -interaction=nonstopmode $&lt; &gt; /dev/null ;\
      if [ $$? = 0 ] ; then \
        echo -e "\t$(OK_COLOR)compilation in draftmode without erros$(NO_COLOR)" ;\
        pdflatex -interaction=nonstopmode $&lt; &gt; /dev/null ;\
        if [ -e $$NAME.glo ] ; then \
          echo -e "$(OK_COLOR)Typesetting $$NAME.glo$(NO_COLOR)" ;\
          makeindex -s gglo.ist -o $$NAME.gls $$NAME.glo ;\
        fi ;\
        if [ -e $$NAME.idx ] ; then \
          echo -e "$(OK_COLOR)Typesetting $$NAME.idx$(NO_COLOR)" ;\
          makeinde -s gind.ist $$NAME.idx ;\
        fi ;\ 
      else \
        echo -e "\t$(ERROR_COLOR)compilation in draftmode with erros$(NO_COLOR)" ;\
        exit 0;\
      fi ;\
      echo -e "\t$(OK_COLOR)Typesetting $$NAME finished $(NO_COLOR)" ;\
  </code></pre>
  
  <p>The makefile doens't work and I can't find the error.</p>
  
  <p>My goal is to type:</p>
  
  <pre><code>make test.pdf
  </code></pre>
  
  <p>The following example can be used for testing (test.tex):</p>
  
  <pre><code>\documentclass{article}
  \begin{document}
  Hello World!
  \end{document}
  </code></pre>
  
  <p>How must the Makefile improve? </p>