GNU Make中的仅订单目标 - 适用于Microsoft NMAKE?(Order-only targets as in GNU Make - for Microsoft NMAKE?)
有时您会遇到这样的情况:您希望对要调用的规则强制执行特定排序,而不强制在执行其中一条规则时更新目标。 在这种情况下,您需要定义仅订单的先决条件 。 可以通过在先决条件列表中放置管道符号(|)来指定仅订单的先决条件:管道符号左侧的任何先决条件都是正常的; 右边的任何先决条件都是仅限订单:
targets : normal-prerequisites | order-only-prerequisites
$^
中不包含仅订单的先决条件; 你可以用$|
来引用它们 。我发现这对于指定系统库作为链接的附加依赖性非常有用。
CXX = cl CXXFLAGS = /nologo /W4 /EHsc /MD RC = rc RCFLAGS = /nologo # Link executables; $^ = all prerequisites; $| = order-only prerequisites %.exe: %.obj %.res $(CXX) $(CXXFLAGS) /Fe$@ $^ $| # Compile source files %.obj: %.cpp $(CXX) $(CXXFLAGS) /c /Fo$@ $^ # Compile resource files %.res: %.rc $(RC) $(RCFLAGS) /r /fo$@ $^ # System libraries needed for linking. Specify them as order-only prerequisites # so their (no-op) rule being executed (due to their absence from the build # directory) won't make the target appear out of date. ErrorShow.exe: | user32.lib Singleton.exe: | user32.lib advapi32.lib ProcessInfo.exe: | user32.lib advapi32.lib gdi32.lib # Set libraries as no-op targets to satisfy rule existence requirement. advapi32.lib: gdi32.lib: user32.lib:
有没有办法让微软NMAKE做同等的事情?
GNU Make allows to specify order-only targets:
Occasionally [...] you have a situation where you want to impose a specific ordering on the rules to be invoked without forcing the target to be updated if one of those rules is executed. In that case, you want to define order-only prerequisites. Order-only prerequisites can be specified by placing a pipe symbol (|) in the prerequisites list: any prerequisites to the left of the pipe symbol are normal; any prerequisites to the right are order-only:
targets : normal-prerequisites | order-only-prerequisites
Order-only prerequisites are not contained in
$^
; you may refer to them using$|
.I find this useful for specifying system libraries as additional dependencies for linking.
CXX = cl CXXFLAGS = /nologo /W4 /EHsc /MD RC = rc RCFLAGS = /nologo # Link executables; $^ = all prerequisites; $| = order-only prerequisites %.exe: %.obj %.res $(CXX) $(CXXFLAGS) /Fe$@ $^ $| # Compile source files %.obj: %.cpp $(CXX) $(CXXFLAGS) /c /Fo$@ $^ # Compile resource files %.res: %.rc $(RC) $(RCFLAGS) /r /fo$@ $^ # System libraries needed for linking. Specify them as order-only prerequisites # so their (no-op) rule being executed (due to their absence from the build # directory) won't make the target appear out of date. ErrorShow.exe: | user32.lib Singleton.exe: | user32.lib advapi32.lib ProcessInfo.exe: | user32.lib advapi32.lib gdi32.lib # Set libraries as no-op targets to satisfy rule existence requirement. advapi32.lib: gdi32.lib: user32.lib:
Is there any way to have Microsoft NMAKE do the equivalent?
原文:https://stackoverflow.com/questions/11482929
最满意答案
创建自定义范围,定义要从搜索中包含/排除的一组文件。
- CTRL + SHIFT + F用于查找路径对话框。 (Mac用户按命令 + shift + F )
在范围下选择自定义 。
从下拉列表中选择一个范围,或通过点击下拉列表右侧的...按钮创建自定义范围。
- 在出现的对话框中,单击+按钮并选择本地
- 在右窗格中,您可以包括并排除单个文件,并递归地包含或排除文件夹下的所有文件。
现在当您使用“在路径中查找”时 ,请使用您的自定义范围来限制哪些文件被搜索。
我怀疑在您的问题中引用“ 查找文件” ,这些说明可能不适用于您的版本,但知道此功能存在且始终为30天的评估版本是有用的。
Create a Custom Scope defining the set of files to include/exclude from your search.
- CTRL+SHIFT+F for the Find in Path dialog. (Mac users press command+shift+F)
Under Scope select Custom.
Choose a scope from the drop down list or create a Custom Scope by clicking on the ... button to the right of dropdown.
- In the dialog that appears, click on the + button and select Local
- On the right pane you can Include and Exclude individual files and Recursively include or exclude all files beneath a folder.
Now when you use Find in Path, use your custom scope to restrict which files are searched.
I suspect from the reference to Find in Files in your question that these instructions may not apply to your version but it is useful to know that this functionality exists and there is always the 30 day evaluation version.
相关问答
更多-
LINUX 如何查看JPG文件[2022-06-13]
find -
如果您只想将查找限制到第一级,您可以执行以下操作: find /dev -maxdepth 1 -name 'abc-*' ...或者如果你特别想排除.udev目录,你可以这样做: find /dev -name '.udev' -prune -o -name 'abc-*' -print If you just want to limit the find to the first level you can do: find /dev -maxdepth 1 -name 'abc-*' .. ...
-
如何告诉IntelliJ的“查找文件”来忽略生成的文件?(How can I tell IntelliJ's “Find in Files” to ignore generated files?)[2022-11-28]
创建自定义范围,定义要从搜索中包含/排除的一组文件。 CTRL + SHIFT + F用于查找路径对话框。 (Mac用户按命令 + shift + F ) 在范围下选择自定义 。 从下拉列表中选择一个范围,或通过点击下拉列表右侧的...按钮创建自定义范围。 在出现的对话框中,单击+按钮并选择本地 在右窗格中,您可以包括并排除单个文件,并递归地包含或排除文件夹下的所有文件。 现在当您使用“在路径中查找”时 ,请使用您的自定义范围来限制哪些文件被搜索。 我怀疑在您的问题中引用“ 查找文件” ,这些说明可能不适用 ... -
(此答案已更新,以符合SVN 1.8和1.9的行为) 你有两个问题: 将文件标记为忽略: “忽略文件”我的意思是文件不会出现在列表中,即使是“unversioned”:您的SVN客户端将假装该文件在文件系统中根本不存在。 被忽略的文件由“文件模式”指定。 SVN的在线文档中介绍了文件模式的语法和格式: http : //svnbook.red-bean.com/nightly/en/svn.advanced.props.special.ignore.html “Subversion中的文件模式”。 Subv ...
-
想出远程主机仅在您保存文件时触发。 只有这样才会发生文件同步,但仅限于您保存/触摸的文件。 远程主机不“监听”是否只更新了任何文件/文件夹。 希望这有助于某人。 Figured out that Remote Host only triggers when you save a file. Only then a file sync happens, but only on the file you saved/touched. Remote Host does not 'listen' to see if ...
-
在添加到.gitignore文件之前,它们被添加到回购库中。 您应该使用git rm --cached filename.ext从repo中删除它们,并提交(与.gitignore文件一起)。 Chances are they were added to the repo before they were added to the .gitignore file. You should remove them from the repo with git rm --cached filename.ext, ...
-
您可以使用TODO视图的“ Scope Based功能从报告的TODO中排除类或包。 要使用此功能,请单击TODO视图中的“ Scope Based选项卡,然后单击“ Scope下拉列表旁边的“ ...按钮。 在生成的对话框中,您可以定义包含和排除模式,以隔离您希望忽略的类(尽管不是类中的代码块)。 例 鉴于此课程: package org.glytching.sandbox.translation; public class Foo { // TODO i would like to igno ...
-
这并不能严格回答您的问题,但您可以通过将Emacs配置为使用特定目录来保留备份文件来避免此问题.Emacs或XEmacs有不同的实现。 在GNU Emacs中 (defvar user-temporary-file-directory (concat temporary-file-directory user-login-name "/")) (make-directory user-temporary-file-directory t) (setq backup-by- ...
-
其实这很简单,我只是关于将classes标注为根源。 我不知道为什么标记generated成为源根无效。 Actually it was very simple, I only was about marking classes as sources root. I don't know why marking generated as sources root did not work.
-
如果您在创建/填充gitignore文件之前创建并将其添加到git此目录中,则必须使用git中的文件删除此目录。 在此目录中使用git rm --cached -r。 该命令从git跟踪的文件中删除。 顺便说一句,这不是intellij的问题,而是git中的问题。 If you created and added it into git this directory before you created/filled gitignore file, then you must remove this dir ...