Autoconf/Automake 条件和 dist 规则 [英] Autoconf/Automake conditionals and dist rules

查看:47
本文介绍了Autoconf/Automake 条件和 dist 规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始在我正在从事的项目中使用 autoconf 和 automake.该项目的文档是用 LaTeX 编写的.由于我不想将 LaTeX 作为依赖项,我想使用 autoconf 检查 pdflatex 二进制文件的存在,然后在 Makefile.am 中使用该信息来决定是简单地将 .tex 文件复制到文档目录,还是生成 PDF 并复制两者.

I recently started using autoconf and automake for a project I'm working on. The project's documentation is written in LaTeX. Since I don't want to have LaTeX as a dependency I want to check the presence of the pdflatex binary with autoconf and then use that information in the Makefile.am to decide whether to simply copy the .tex file to the documentation directory, or to generate the PDF and copy both.

这是 configure.ac 中的相关部分:

This is the relevant section in configure.ac:

# Check for presence of pdfLaTeX
AC_CHECK_PROG(PDFLATEX, pdflatex, pdflatex)
if test -z "$PDFLATEX"; then
  AC_MSG_WARN([Unable to create PDF version of the user manual.])
fi

AM_CONDITIONAL([HAVE_PDFLATEX], test -n "$PDFLATEX")

doc/ 目录中,我有以下 Makefile.am:

In the doc/ directory I have the following Makefile.am:

docfiles = manual.tex QuickStart.txt

if HAVE_PDFLATEX
docfiles += manual.pdf
MANNAME = manual
MANTEXSRC = $(MANNAME).tex
MANAUX = $(MANNAME).aux
MANPDF = $(MANNAME).pdf

CLEANFILES = $(MANPDF) $(MANNAME).log $(MANNAME).idx $(MANNAME).out 
 $(MANNAME).toc $(MANAUX)

$(MANPDF): $(srcdir)/$(MANTEXSRC)
    $(PDFLATEX) $<
endif

dist_doc_DATA = $(docfiles)

这个设置在 pdflatex 存在时有效,但当它不存在时运行 make 有效,但 make distcheck 要求一种构建方式PDF文件:

This setup works when pdflatex is present, but when it is absent running make works, but make distcheck asks for a way to build the PDF file:

make[1]: *** No rule to make target `manual.pdf', needed by `distdir'.  Stop.

查看 automake 生成的 Makefile 我看到:

Looking in the Makefile that automake generated I see:

#am__append_1 = manual.pdf
am__dist_doc_DATA_DIST = manual.tex QuickStart.txt manual.pdf

再往下我发现:

docfiles = manual.tex QuickStart.txt $(am__append_1)
#MANNAME = manual
#MANTEXSRC = $(MANNAME).tex
#MANAUX = $(MANNAME).aux
#MANPDF = $(MANNAME).pdf
#CLEANFILES = $(MANPDF) $(MANNAME).log $(MANNAME).idx $(MANNAME).out 
# $(MANNAME).toc $(MANAUX) .btmp

dist_doc_DATA = $(docfiles)

我在这里遗漏了什么?

推荐答案

我认为你的问题是你有条件地分发"manual.pdf,而 automake 对 dist 规则相当保守.试试这个:

I think your problem is that you're conditionally "distributing" manual.pdf, and automake's rather conservative about dist rules. Try this:

if HAVE_PDFLATEX
doc_DATA = manual.pdf
# Rest of your stuff...
endif

这篇关于Autoconf/Automake 条件和 dist 规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆