Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
发送要生成的参数(Linux或其他*nix风格)_Linux_Makefile - Fatal编程技术网

发送要生成的参数(Linux或其他*nix风格)

发送要生成的参数(Linux或其他*nix风格),linux,makefile,Linux,Makefile,请参见下面的代码:如何在不键入BASE\u NAME的情况下将参数BASE\u NAME=myfile发送到命令行。我只想进去 $make pdf myfile 要生成PDF,然后从选项-o?打开它,这本身不是一个TeX问题,但是 如果你指定通用规则而不是特定规则,你会更好。此外,如果要打开文件,Makefile惯例建议使用命令makeopen,而不是make-o 我通常是这样做的 # The only thing that changes! TEXFILES = firstfile.tex

请参见下面的代码:如何在不键入
BASE\u NAME
的情况下将参数
BASE\u NAME=myfile
发送到命令行。我只想进去

$make pdf myfile


要生成PDF,然后从选项
-o

打开它,这本身不是一个TeX问题,但是

如果你指定通用规则而不是特定规则,你会更好。此外,如果要打开文件,
Makefile
惯例建议使用命令
makeopen
,而不是
make-o

我通常是这样做的

# The only thing that changes!
TEXFILES = firstfile.tex secondfile.tex  

PDFS = ${TEXFILES:%.tex=%.pdf}

all: $(PDFS)

open: all
    for x in ${PDFS}; do (xpdf $$x &); done

# You can write a similar rule for ps...
%.pdf: %.tex  
    pdflatex $*
    -bibtex $*
    pdflatex $*
    - while ( grep -q '^LaTeX Warning: Label(s) may have changed' $*.log || \
    grep -q '^Package natbib Warning: Citation(s) may have changed' $*.log ) \
    do pdflatex $*; done


clean:
   $(RM) *.aux *.bbl *.dvi *.log *.out *.toc *.blg *.lof *.lot

distclean: clean
       $(RM) $(PDFS)

我认为您应该更改您的
Makefile
,正如Boris所写:

%.pdf: %.tex
     pdflatex $<
%.pdf:%.tex
pdflatex$<

之后,您可以运行
makemyfile.pdf
makefoo.pdf
或其他任何程序。

我认为这是离题的。虽然一些TeX用户使用Makefiles,但TeX方面的专业知识和Makefiles方面的专业知识并不一致。我建议迁移到另一个站点(可能是超级用户?。@JosephWright我不同意:与TeX相关的Makefiles有自己的特定功能,就像检查是否需要另一个编译运行的技巧一样。@Boris:但这个问题不是关于检查是否需要另一个编译运行,而是关于如何传递参数和选项以进行编译。你需要将开头的空格转换为制表符:我不知道如何将制表符放在SX输入字段中:(现在
使其打开
并且错误:对于${PDFS}中的x;do acroread$$x&;done/bin/sh:语法错误:;“意外的使:*[打开]Erro 2抱歉,我错了:这不适用于&:(.正确的一行是${PDFS}中的x
;do acroread$$x;done
另一种方法是将调用放入子shell:${PDFS}中的x
do(acroread$$x&);done
。我仍然记得我的Unix基础知识,但有时需要时间:)谢谢@Boris。我发现Rubber安装ruber和digit ruber-d myfile用于生成pdf文件,ruber-clean myfile用于清除aux文件。谢谢。
# The only thing that changes!
TEXFILES = firstfile.tex secondfile.tex  

PDFS = ${TEXFILES:%.tex=%.pdf}

all: $(PDFS)

open: all
    for x in ${PDFS}; do (xpdf $$x &); done

# You can write a similar rule for ps...
%.pdf: %.tex  
    pdflatex $*
    -bibtex $*
    pdflatex $*
    - while ( grep -q '^LaTeX Warning: Label(s) may have changed' $*.log || \
    grep -q '^Package natbib Warning: Citation(s) may have changed' $*.log ) \
    do pdflatex $*; done


clean:
   $(RM) *.aux *.bbl *.dvi *.log *.out *.toc *.blg *.lof *.lot

distclean: clean
       $(RM) $(PDFS)
%.pdf: %.tex
     pdflatex $<