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

查看:191
本文介绍了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 中的相关部分:

# 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 :

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.

查看自动生成的 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天全站免登陆