首页 \ 问答 \ Makefile:如何设置一个LOGFILE =`date +'test_%m。%d_%H.%M.%S.log'`变量只有一次?(Makefile: how to set a LOGFILE=`date +'test_%m.%d_%H.%M.%S.log'` variable only once?)

Makefile:如何设置一个LOGFILE =`date +'test_%m。%d_%H.%M.%S.log'`变量只有一次?(Makefile: how to set a LOGFILE=`date +'test_%m.%d_%H.%M.%S.log'` variable only once?)

我喜欢将测试程序的输出记录到带有时间戳的日志文件中。

我创建了以下Makefile,但它不起作用。 “make”似乎根据需要在最后时刻计算LOGFILE。

Makefile文件

LOGFILE=`date +'test_%m.%d_%H.%M.%S.log'`
export DLOG=$(LOGFILE)
test2:
    echo DLOG=$$DLOG
    echo DLOG=${DLOG}
    sleep 2
    echo DLOG=${DLOG}

make test2

echo DLOG=$DLOG
DLOG=`date +'test_%m.%d_%H.%M.%S.log'`
echo DLOG=`date +'test_%m.%d_%H.%M.%S.log'`
DLOG=test_10.22_10.28.04.log
sleep 2
echo DLOG=`date +'test_%m.%d_%H.%M.%S.log'`
DLOG=test_10.22_10.28.06.log

我想找到一些“make”只计算一次LOGFILE或DLOG变量,我可以在makefile中的任何地方使用相同的值。 可能吗?


I like to log output of test program to a log file with time stamp.

I created following Makefile, but it doesn't work. The "make" seems to calculate LOGFILE at the last moment as needed.

Makefile

LOGFILE=`date +'test_%m.%d_%H.%M.%S.log'`
export DLOG=$(LOGFILE)
test2:
    echo DLOG=$$DLOG
    echo DLOG=${DLOG}
    sleep 2
    echo DLOG=${DLOG}

make test2

echo DLOG=$DLOG
DLOG=`date +'test_%m.%d_%H.%M.%S.log'`
echo DLOG=`date +'test_%m.%d_%H.%M.%S.log'`
DLOG=test_10.22_10.28.04.log
sleep 2
echo DLOG=`date +'test_%m.%d_%H.%M.%S.log'`
DLOG=test_10.22_10.28.06.log

I like to find someway to have the "make" calculate the LOGFILE or DLOG variable only once and I can use the same value everywhere in the makefile. Is it possible?


原文:https://stackoverflow.com/questions/33287226
更新时间:2024-01-07 09:01

最满意答案

另一种方法是使用filer来显示您想要的数据

在此处输入图像描述


Another alternative is to use filer to show the data you want

enter image description here

相关问答

更多
  • GQL语言只能用于检索实体或关键字(参见http://code.google.com/appengine/docs/python/datastore/gqlreference.html ) 你必须这样做: persons = Person.all() for p in persons: p.delete() 关于错误BadValueError: Property y must be a str or unicode instance, not a long ,您必须修改数据库中的所有数据(从整数 ...
  • GqlQuery是一个类 。 您的代码已经创建了GqlQuery类的实例。 要从数据存储区返回内容,您需要使用以下任一实例方法: .fetch() # requires number of entities as first argument .get() 例: my_query = db.GqlQuery("SELECT * FROM Post WHERE subject = :subject", subject="hello_world") my_pos ...
  • 您可以使用实体的密钥来检索它: SELECT * FROM Programme where __key__ = KEY('agtzcG9...................') 而且,您应该能够使用类似的名称进行查询: SELECT * FROM Programme where __key__ = KEY('Programme', '_1') 请注意,这不是您希望在AppEngine应用程序中执行的操作; 正如尼克在他的评论中所说,这是一个巨大的浪费时间。 真的,这个例子只是告诉你如何通过管理控制台中 ...
  • 我相信一个Gcl查询不能包含对访问方法或属性提取的调用(与其只能执行"SELECT * FROM"以获取整个实体或"SELECT __key__ FROM"只能获取键的事实相同 - 它不能在[假设! - )] "SELECT this, that FROM ”中选择字段。 因此,您需要获取密钥,然后调用每个密钥的.id()访问器(如果您希望None不是用于没有ID而是名称的密钥;如果您希望获得该名称,请使用.id_or_name() ,如果可用的话,并且仅作为最后的手段)。 例如,仅获取非无ID: thek ...
  • 我相信你面临的问题来自OR运算符--GQL没有一个,所以你在条件语句中的条件在语法上是不正确的。 从Clauses表中的WHERE行(强调我的): 将结果集限制为符合一个或多个条件的实体。 每个条件使用比较运算符将实体的属性与值进行比较。 如果多个条件与AND关键字结合使用,那么实体必须满足查询要返回的所有条件。 GQL没有OR运算符 。 I believe the problem you're facing comes from the OR operator - GQL doesn't have one ...
  • 您无法使用数据存储区以便宜或轻松的方式使用聚合函数。 您需要以不同方式处理问题并在应用程序层中维护计数/总和等。 这是传统(强大)MySQL灵活性的范式转变。 我个人一起使用。 CloudSQL用于汇总和报告由我的应用程序层更新的数据。 PS感谢您使用PHP-GDS !! 如果你想提出请求,我正在考虑向GitHub添加一些聚合辅助工具。 汤姆 You cannot use aggregate functions cheaply or easily with Datastore. You need to ap ...
  • 另一种方法是使用filer来显示您想要的数据 Another alternative is to use filer to show the data you want
  • query = GqlQuery("SELECT * FROM Atable WHERE owner = :1", users.get_current_user()) query = GqlQuery("SELECT * FROM Atable WHERE owner = :1", users.get_current_user())
  • 看起来像一个很好的解决方 App Engine DB有其局限性,它为您留下了很多工作。 我注意到你正在使用DB; 你考虑过迁移到NDB吗? 它是下一代数据库: https : //developers.google.com/appengine/docs/python/ndb/ 。 NDB解决了DB的许多缺点。 首先,它支持“OR”查询甚至是AND和OR的嵌套组合: https : //developers.google.com/appengine/docs/python/ndb/queries#nest_a ...
  • 我可能找到了答案: 文档表明“... Google Cloud Client Library for Java支持GQL,但其他Google Cloud客户端库不支持。” I may have found the answer: The docs indicate that "... Google Cloud Client Library for Java supports GQL, but other Google Cloud client libraries do not."

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)