【问题标题】:How to capture the input to form the output directory in makefile如何在makefile中捕获输入以形成输出目录
【发布时间】:2013-11-11 17:52:23
【问题描述】:

我使用原始的 makefile 来构建我的代码,其中包含用 makefile 编写的 Perl 脚本。

现在我想将屏幕上显示的所有日志打印到 txt 文件中。

我可以在我的 makefile 中使用什么命令来执行此操作?

我打算在 makefile 中使用一些命令将屏幕上显示的内容输出到 txt 文件。

我需要将输出保存到一个 txt 文件,其目录应根据我的 perl 脚本的输入。

例如在makefile中:

all:

   $(X)make -C .. DIR=$(DIR) Y=$(Y) Z=$(Z)
   perl filename.pl $(DIR)/$(Y)/i.lst 2>&1 | tee log.txt

我应该如何更改 makefile 以便将 log.txt 保存在与输入 $DIR 相同的目录中? Ans 我还想将名称“log”更改为输入,我该怎么做?

谁能帮忙?

【问题讨论】:

  • 您希望文本文件具有什么名称?
  • 您只需在tee 的参数中选择一个不同的文件名即可更改记录文件的名称。

标签: linux perl makefile


【解决方案1】:

对您的问题的一种可能的解读向我暗示了这个答案

all:

   $(X)make -C .. DIR=$(DIR) Y=$(Y) Z=$(Z) 2>&1 | tee $(DIR)/log.txt
   perl filename.pl $(DIR)/$(Y)/i.lst 2>&1 | tee -a $(DIR)/log.txt

【讨论】:

  • @etan-reisner 可能是一个想法,如果您单独回答?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2010-12-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-08-29
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多