制作:在目标依赖性中结合模式规则和通配符
我有几个pdflatex主文件,称为ch*.tex
,数字替换了Asterick,这是通过编译ch*.tex
pdf文件> ch*.pdf打印的PDF文件。 ,在编译过程中将每个乳胶文件输入到每个ch*.tex
中,这些文件被保存到其各自的ch*/
目录中。使用makefile,我希望我的ch*.pdf
文件由ch*.tex
文件编译,并在ch*
subdirectory中使用TEX文件。作为其他依赖关系,无需硬编码每个ch*
实例。
但是,在某些情况下,可能不存在ch*
子目录。随着我的乳胶项目的发展而发生的变化,因为某些ch*.tex
文件可以分为子文件,而其他文件可能只是代码的一个大块文件。因此,我希望我的makefile能够使用ch*
子目录文件作为依赖项,如果它们不存在,但不是不存在。以下是一些失败的试验:
%.pdf : %.tex %/*.tex
pdflatex $<
该试验成功地检测了ch*
子目录中的现有文件,但是如果没有ch*
目录,则无法编译。
%.pdf : %.tex $(wildcard %/*.tex)
pdflatex $<
该试验无法识别$(WIRDCARD%/*。TEX)
作为依赖项,仅使用ch*.tex
。
如何在ch*
子目录(不使用其他子目录中的文件)中使用文件作为其各自的ch*.pdf
编译的依赖项?
I have a few PDFLaTeX main files called ch*.tex
with numbers replacing the asterick, a PDF file printed by compiling ch*.tex
called ch*.pdf
, and several LaTeX files input into each ch*.tex
during compile that are saved into their respective ch*/
directories. With a Makefile I want my ch*.pdf
files to be compiled by ch*.tex
files, with TeX files in the ch*
subdirectory as additional dependencies, without hardcoding each ch*
instances.
However, in some cases the ch*
subdirectory may not exist. This changes as my LaTeX projects develops, as some ch*.tex
files may be split into subfiles while others may just be one big block file of code. So I want my Makefile to use ch*
subdirectory files as dependencies if they exist, but not if they don't. Here are some failed trials:
%.pdf : %.tex %/*.tex
pdflatex lt;
This trial successfully detects existing files in the ch*
subdirectory, but fails to compile if there is no ch*
directory at all.
%.pdf : %.tex $(wildcard %/*.tex)
pdflatex lt;
This trial doesn't recognise $(wildcard %/*.tex)
as a dependency and only uses ch*.tex
.
How can I use files in the ch*
subdirectory (without using files in other subdirectories) as dependencies for its respective ch*.pdf
compilation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一种方法是使用 :
One way to do it is to use secondary expansion: