GNU make:定时构建,是否可以在所有目标完成后有一个目标,其配方执行(GNU make: Timing a build, is it possible to have a target whose recipe executes after all targets complete)
从本质上讲,我正在寻找以下内容 - 或者是一个相当干净的黑客将它拉下来:
GET_TIMESTAMP = $(shell perl -e 'print time()') START_TIME := ${GET_TIMESTAMP} all: T1 T2 ... TN T1: T2: ...: TN: #... timer: @perl -e 'printf( "Loaded makefiles in %ds, build completed in %ds\n", $ARGV[1] - $ARGV[0], $ARGV[2] - $ARGV[1] );' ${START_TIME} ${LOAD_COMPLETE} ${GET_TIMESTAMP} .ATEND: timer LOAD_COMPLETE := ${GET_TIMESTAMP}
......可以通过多种方式启动......
~ gmake all (...) Loaded makefiles in 8s, build completed in 93s ~ gmake T2 T3 T4 (...) Loaded makefiles in 8s, build completed in 13s
其核心是
.ATEND
特殊目标的概念,当所有CMDGOALS
或DEFAULTGOALS
完成时会导致某些事情发生。My question is similar to this one and this one.
In essence, something like the following is what I'm looking for -- or a fairly clean hack for pulling it off:
GET_TIMESTAMP = $(shell perl -e 'print time()') START_TIME := ${GET_TIMESTAMP} all: T1 T2 ... TN T1: T2: ...: TN: #... timer: @perl -e 'printf( "Loaded makefiles in %ds, build completed in %ds\n", $ARGV[1] - $ARGV[0], $ARGV[2] - $ARGV[1] );' ${START_TIME} ${LOAD_COMPLETE} ${GET_TIMESTAMP} .ATEND: timer LOAD_COMPLETE := ${GET_TIMESTAMP}
... which could be kicked off in a number of ways:
~ gmake all (...) Loaded makefiles in 8s, build completed in 93s ~ gmake T2 T3 T4 (...) Loaded makefiles in 8s, build completed in 13s
At the heart of it is this idea of an
.ATEND
special target that causes something to happen when allCMDGOALS
orDEFAULTGOALS
are finished.
原文:https://stackoverflow.com/questions/8483149
最满意答案
Contains
方法有一个接受IEqualityComparer
的重载。 你可以通过以下方式给它一个:if (list.Contains(test2, StringComparer.OrdinalIgnoreCase)) { // do something }
The
Contains
method has an overload that accepts anIEqualityComparer
. You can give it one by doing the following:if (list.Contains(test2, StringComparer.OrdinalIgnoreCase)) { // do something }
相关问答
更多-
不区分大小写字符串比较(Case insensitive string comparison)[2023-12-29]
这很简单 你只需要在两个变量上调用strtolower() 。 如果需要处理Unicode或国际字符集,可以使用mb_strtolower() 。 请注意,其他答案建议使用strcasecmp() - 这个函数不处理多字节字符,所以任何UTF-8字符串的结果将是假的。 This is fairly simple; you just need to call strtolower() on both variables. If you need to deal with Unicode or internat ... -
您的代码不会编译,因为您没有覆盖Object的equals方法,该方法具有类似于public boolean equals(Object obj)签名 另外要进行比较,您可以在修改后的等号中执行以下操作: if (array == foo.array) { return true; } if (array == null || foo.array == null) { return false; } int length = array.length; if (foo.length ! ...
-
javascript比较字符串不区分大小写[重复](javascript compare strings without being case sensitive [duplicate])[2022-03-12]
你可以使这两个参数都是小写的,那样你总是会得到不区分大小写的搜索结果。 var string1 = "aBc"; var string2 = "AbC"; if (string1.toLowerCase() === string2.toLowerCase()) { #stuff } You can make both arguments lower case, and that way you will always end up with a case insensitive search. ... -
Boost包括一个方便的算法: #include
// Or, for fewer header dependencies: //#include std::string str1 = "hello, world!"; std::string str2 = "HELLO, WORLD!"; if (boost::iequals(str1, str2)) { // ... -
最简单的方法(如果你不担心特殊的Unicode字符)是调用toUpperCase : var areEqual = string1.toUpperCase() === string2.toUpperCase(); The simplest way to do it (if you're not worried about special Unicode characters) is to call toUpperCase: var areEqual = string1.toUpperCase() === ...
-
你可以使用这个 string.Equals(one, two, StringComparison.CurrentCultureIgnoreCase) 你的代码就是 if (string.Equals(one, two, StringComparison.CurrentCultureIgnoreCase)) { MessageBox.Show("Pass"); } else { MessageBox.Show("Fail"); } 使用CurrentCultureIgnoreCase : 使用 ...
-
如果你可以承受偏离严格的C标准,你可以使用strcasecmp() 。 它是一个POSIX API。 否则,您始终可以选择将字符串转换为特定大小写(UPPER或更低),然后使用strcmp()执行常规比较。 If you can afford deviating a little from strict C standard, you can make use of strcasecmp(). It is a POSIX API. Otherwise, you always have the option ...
-
如果你想以一种干净的方式来做,我会建议引入一个不区分大小写的字符串的包装类型。 这样,您可以在类型中反映出不区分大小写的比较概念,而不必更改记录上的默认结构比较。 [
] type CIString = | CI of string override x.Equals y = ... override x.GetHashCode() = ... interface System.IComparable wit ... -
Contains方法有一个接受IEqualityComparer的重载。 你可以通过以下方式给它一个: if (list.Contains(test2, StringComparer.OrdinalIgnoreCase)) { // do something } The Contains method has an overload that accepts an IEqualityComparer. You can give it one by doing the follo ...
-
C#表达式类方法扩展,使字符串比较不区分大小写(C# Expression class method extension, making string comparison case insensitive)[2023-04-27]
你可以得到三参数string.Compare方法的MethodInfo ,如下所示: private static readonly MethodInfo StringComparisonExpressionMethodInfo = typeof(string).GetMethod("Compare", new Type[] { typeof(string), typeof(string), typeof(StringComparison) }); 使用此MethodInf ...