我试图理解一个执行 Javac 并向其传递一些简单参数的简单命令行字符串。完整的命令行是:
javac -d $(OUTPATH) -sourcepath $(SOURCEPATH) $<
除了最后的标记:$<
之外,这一行中的所有内容对我来说都是简单易懂的。
这些标记是什么意思?
附录:确实,评论者是正确的。该行出现在 makefile 中。现在对我来说很明显,但当我写这个问题时,makefile 被传递给 make
并且不是 shell 脚本。
请注意: $ 做什么?和 $@ 代表 Makefile? 也讨论了这一点(当我查找以前的问题时没有看到它)。
I am trying to understand a simple command-line string that executes Javac and passes it some simple arguments. The complete command line is:
javac -d $(OUTPATH) -sourcepath $(SOURCEPATH) lt;
Everything in this line is straightforward and understandable to me except for the final tokens: $<
.
What do these tokens mean?
ADDENDUM: Indeed, the commenters are correct. This line occurs within a makefile. It is obvious to me now, but not when I wrote this question, that a makefile is passed to make
and is not a shell script.
Please note: What do $< and $@ represent in a Makefile? also discusses this (I did not see it when I looked for previous questions about this).
发布评论
评论(1)
这看起来像是 makefile 中的内容,而不是命令行中的内容。在这种情况下,
$<
扩展为当前目标的第一个先决条件。即.class
目标所依赖的.java
文件。This looks like something from a makefile, not a command line. In that case,
$<
expands to the first prerequisite of the current target. That is, the.java
file that the.class
target depends on.