title: latex makefile not finding png: make: *** No rule to make target `pngfigure.pdf', needed by `main.pdf'. Stop
body: <p>I'm having trouble getting one of my documents to compile. I've used this makefile before no problems. However, this time, It seems to have a problem recognising .png figures and tries to load them as .pdf.</p>
  
  <p>main.tex</p>
  
  <pre><code>\documentclass[letterpaper, 10 pt, conference]{ieeeconf}  % Comment this line out
                                                            % if you need a4paper
  %\documentclass[a4paper, 10pt, conference]{ieeeconf}      % Use this line for a4
                                                            % paper
  
  \IEEEoverridecommandlockouts                              % This command is only
                                                            % needed if you want to
                                                            % use the \thanks command
  \overrideIEEEmargins
  % See the \addtolength command later in the file to balance the column lengths
  % on the last page of the document
  
  % The following packages can be found on http:\\www.ctan.org
  \usepackage{graphics} % for pdf, bitmapped graphics files
  \usepackage{epsfig} % for postscript graphics files
  \usepackage{mathptmx} % assumes new font selection scheme installed
  \usepackage{times} % assumes new font selection scheme installed
  \usepackage{amsmath} % assumes amsmath package installed
  \usepackage{amssymb}  % assumes amsmath package installed
  
  \usepackage{graphicx}   % Include figures
  \usepackage{float}      % Include figures
  
  \graphicspath{{./Figures/}} %Where the figures folder is located
  
  \title{\LARGE \bf
  .
  .
  .
  \begin{document}
  .
  .
  .
  \begin{figure}[thpb]
    \centering
    \includegraphics[width=3in]{pngfigure}
    \caption{pngfigure}
    \label{fig:pngfigure}
  \end{figure}
  .
  .
  .
  </code></pre>
  
  <p>and my Makefile</p>
  
  <pre><code># Makefile for LaTeX files
  
  LATEX   = pdflatex
  BIBTEX  = bibtex
  MAKEINDEX = makeindex
  
  OUTPUT_PDF_FILE_NAME = phd_conversion_report
  RERUN = "(There were undefined references|Rerun to get (cross-references|the bars) right)"
  RERUNBIB = "No file.*\.bbl|Citation.*undefined"
  MAKEIDX = "^[^%]*\\makeindex"
  MPRINT = "^[^%]*print"
  USETHUMBS = "^[^%]*thumbpdf"
  
  SRC := $(shell egrep -l '^[^%]*\\begin\{document\}' *.tex)
  BIBFILE := $(shell perl -ne '($$_)=/^[^%]*\\bibliography\{(.*?)\}/;@_=split /,/;foreach $$b (@_) {print "$$b.bib "}' $(SRC))
  
  PDFPICS := $(shell perl -ne '@foo=/^[^%]*\\(includegraphics)(\[.*?\])?\{(.*?)\}/g;if (defined($$foo[2])) { if ($$foo[2] =~ /.pdf$$/) { print "$$foo[2] "; } else { print "$$foo[2].pdf "; }}' *.tex)
  DEP = *.tex
  
  TRG = $(SRC:%.tex=%.pdf)
  
  COPY = if test -r $(&lt;:%.tex=%.toc); then cp $(&lt;:%.tex=%.toc) $(&lt;:%.tex=%.toc.bak); fi 
  RM = rm -f
  OUTDATED = echo "EPS-file is out-of-date!" &amp;&amp; false
  
  
  all: $(TRG) copy clean
  
  define run-latex
        $(COPY);$(LATEX) $&lt;
        egrep -q $(MAKEIDX) $&lt; &amp;&amp; ($(MAKEINDEX) $(&lt;:%.tex=%);$(COPY);$(LATEX) $&lt;) ; true
        egrep -c $(RERUNBIB) $(&lt;:%.tex=%.log) &amp;&amp; ($(BIBTEX) $(&lt;:%.tex=%);$(COPY);$(LATEX) $&lt;) ; true
        egrep -q $(RERUN) $(&lt;:%.tex=%.log) &amp;&amp; ($(COPY);$(LATEX) $&lt;) ; true
        egrep -q $(RERUN) $(&lt;:%.tex=%.log) &amp;&amp; ($(COPY);$(LATEX) $&lt;) ; true
        if cmp -s $(&lt;:%.tex=%.toc) $(&lt;:%.tex=%.toc.bak); then true ;else $(LATEX) $&lt; ; fi
        $(RM) $(&lt;:%.tex=%.toc.bak)
        # Display relevant warnings
        egrep -i "(Reference|Citation).*undefined" $(&lt;:%.tex=%.log) ; true
  endef
  
  $(TRG): %.pdf: %.tex $(DEP) $(PDFPICS) $(BIBFILE)
        @$(run-latex); \
  
  PHONY: copy
  copy:
        cp $(TRG:%.pdf=%.pdf) $(OUTPUT_PDF_FILE_NAME).pdf
  
  .PHONY: clean
  clean:
        -rm -f $(TRG) $(PSF) $(TRG:%.pdf=%.aux) $(TRG:%.pdf=%.bbl) $(TRG:%.pdf=%.blg) $(TRG:%.pdf=%.log) $(TRG:%.pdf=%.out); \
          $(RM) *.toc *.lot *.lof *.log Sections/*.aux Sections/*.fls Sections/*.log Sections/*.fdb*; \
  
  .PHONY: cleanpdf
  cleanpdf:
        -rm -f $(TRG) $(PSF) $(PDF) $(TRG:%.pdf=%.aux) $(TRG:%.pdf=%.bbl) $(TRG:%.pdf=%.blg) $(TRG:%.pdf=%.log) $(TRG:%.pdf=%.out); \
          $(RM) *.toc *.lot *.lof Sections/*.aux Sections/*.fls Sections/*.log Sections/*.fdb*; \
          $(RM) $(OUTPUT_PDF_FILE_NAME).pdf; \
  
  .PHONY: view
  view:
      acroread $(TRG:%.pdf=%.pdf)
  
  .PHONY: osx
  osx:
      open $(TRG:%.pdf=%.pdf)
  
  .PHONY: count
  count:
      texcount main.tex   
  
  ######################################################################
  # Define rules for PDF source files.
  .PHONY: pdf
  %.pdf: %.eps
      epstopdf $&lt; &gt; $(&lt;:%.eps=%.pdf)
  </code></pre>
  
  <p>Running make, I get the error:</p>
  
  <pre><code>make: *** No rule to make target `pngfigure.pdf', needed by `main.pdf'.  Stop.
  </code></pre>
  
  <p>If I run</p>
  
  <pre><code>$ pdflatex main.tex
  </code></pre>
  
  <p>It compiles fine and the images show up. The error only happens with make.</p>
  
  <p>Also, as an add on to this question, in the makefile I use texcount to count the words, I couldn't figure out how to get it to load the main.tex file no matter what it was called. I had to resort to the actual filename. I think it should be something like</p>
  
  <pre><code>texcount %.tex
  </code></pre>
  
  <p>But that doesn't work</p>