latex makefile 找不到 png: make: *** 没有规则来制作目标 `pngfigure.pdf',这是 `main.pdf' 所需要的。停止

latex makefile not finding png: make: *** No rule to make target `pngfigure.pdf', needed by `main.pdf'. Stop

我无法编译我的一份文件。我以前用过这个 makefile 没有问题。然而,这次,它似乎无法识别.png 图形并尝试将它们加载为.pdf。

main.tex

\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}
.
.
.

和我的 Makefile

# 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 $(<:%.tex=%.toc); then cp $(<:%.tex=%.toc) $(<:%.tex=%.toc.bak); fi 
RM = rm -f
OUTDATED = echo "EPS-file is out-of-date!" && false


all: $(TRG) copy clean

define run-latex
      $(COPY);$(LATEX) $<
      egrep -q $(MAKEIDX) $< && ($(MAKEINDEX) $(<:%.tex=%);$(COPY);$(LATEX) $<) ; true
      egrep -c $(RERUNBIB) $(<:%.tex=%.log) && ($(BIBTEX) $(<:%.tex=%);$(COPY);$(LATEX) $<) ; true
      egrep -q $(RERUN) $(<:%.tex=%.log) && ($(COPY);$(LATEX) $<) ; true
      egrep -q $(RERUN) $(<:%.tex=%.log) && ($(COPY);$(LATEX) $<) ; true
      if cmp -s $(<:%.tex=%.toc) $(<:%.tex=%.toc.bak); then true ;else $(LATEX) $< ; fi
      $(RM) $(<:%.tex=%.toc.bak)
      # Display relevant warnings
      egrep -i "(Reference|Citation).*undefined" $(<:%.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 $< > $(<:%.eps=%.pdf)

运行 make,我得到错误:

make: *** No rule to make target `pngfigure.pdf', needed by `main.pdf'.  Stop.

如果我运行

$ pdflatex main.tex

它编译正常并且图像显示出来。该错误仅发生在 make.

此外,作为对这个问题的补充,在我使用 texcount 来计算单词的 makefile 中,我无法弄清楚如何让它加载 main.tex 文件,不管它是什么叫。我不得不求助于实际的文件名。我觉得应该是这样的

texcount %.tex

但这不起作用

这个错误:

make: *** No rule to make target `pngfigure.pdf', needed by `main.pdf'.  Stop.

表示您将 pngfigure.pdf 列为 main.pdf 的先决条件,但 make 不知道如何构建它。

它不知道如何构建它,大概是因为它实际上不是 pdf 文件(或可以转换为 pdf 文件的 tex 文件)。

此处不正确的先决条件来自 PDFPICS 宏,它在 tex 文件中找到所有 \includegraphics 条目,然后为它们输出 $name.pdf。显然,至少在那种情况下是不正确的。

此外,如果图像不在当前目录中(因为它们似乎不在这种情况)。

为此,您需要合并文档中对 \graphicspath 的解析,并将其包含在 PDFPICS 生成的先决条件中。