GNU Make-终端规则和关键字“null” [英] GNU Make - terminal rules and keyword "null"
问题描述
背景
这与我的问题有关 GNU make - 将每个前提条件转换为目标(隐式)
这个问题,因为它很有趣,可能是有用的 - 了解 make
- 我不想让它丢失在 问题。
I've posted this question because it's interesting and may be useful by itself - to understand make
- and I don't want it to get lost in the "original" question.
INFO
我有一个文件 Dummy.mk
:
%:: null
@:
null:
@:
c> make as make all MAKEFILES = Dummy.mk
。
null
with saflkjsaflkjdsa
,
%:: saflkjsaflkjdsa
@:
saflkjsaflkjdsa:
@:
构建的行为是不同的:规则从未执行。
the behavior of the build was different: the rule was never executed.
原因是因为这是一个终端规则:
一个选择是通过使用双冒号定义
将match-any规则标记为终端。 如果规则是终端,则除非其先决条件实际存在,否则不应用
。可能是
与其他隐式规则进行的前提条件不够好。
One choice is to mark the match-anything rule as terminal by defining it with a double colon. When a rule is terminal, it does not apply unless its prerequisites actually exist. Prerequisites that could be made with other implicit rules are not good enough. In other words, no further chaining is allowed beyond a terminal rule.
由于 saflkjsaflkjdsa
不存在,该规则未执行。好的,我明白了。
Since saflkjsaflkjdsa
did not exist, the rule was not executed. Ok fine I understand that.
但是当我使用关键字设置
Dummy.mk
null
But when I set Dummy.mk
using the keyword null
%:: null
@:
null:
@:
%::
规则执行,即它捕获所有目标,文件名等给出输出形式:2:update target< item>因为:null
其中< item>
是 make
读取的任何文件名或目标
the %::
rule does execute i.e. it captures ALL targets, filenames, etc giving me outputs of the form :2: update target <item> due to: null
where <item>
is any filename or target that make
reads in.
由于规则是使用 null
执行, c $ c> saflkjsaflkjdsa ,确定检测
null
为existing。
Since the rule is executing using null
but not with using saflkjsaflkjdsa
, make
is definitely detecting null
as "existing".
QUESTION
但是为什么我仍然得到:5:target'null'不存在
?
But then why do I still get the output :5: target 'null' does not exist
?
这是因为OS-或shell级别的特殊性 null
现在但不是同时存在?
Is that because of the OS- or shell-level peculiarities of null
existing but not existing at the same time?
环境 $ b * Windows 8,64位
* Make 4.2.1(输出 make
Environment
* Windows 8, 64-bit
* Make 4.2.1 (here's output of make
# GNU Make 4.2.1
# Built for Windows32
# Copyright (C) 1988-2016 Free Software Foundation, Inc.
# License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
# This is free software: you are free to change and redistribute it.
# There is NO WARRANTY, to the extent permitted by law.
find_and_set_shell() path search set default_shell = C:/Users/User1/Desktop/A/QNX_SDK/host/win32/x86/usr/bin/sh.exe
...
* make
在内部使用的shell是:
* Shell that make
is using internally is:
C:\Users\User1\Desktop\A\Project\bld\armle-v7\release\subProj>where sh
C:/Users/User1/Desktop/A/QNX_SDK/host/win32/x86/usr/bin/sh.exe
C:\Users\User1\Desktop\A\Project\bld\armle-v7\release\subProj>sh --help
GNU bash, version 3.1.17(1)-release-(i686-pc-msys)
Usage: sh [GNU long option] [option] ...
sh [GNU long option] [option] script-file ...
GNU long options:
--debug
--debugger
--dump-po-strings
--dump-strings
--help
--init-file
--login
--noediting
--noprofile
--norc
--posix
--protected
--rcfile
--restricted
--verbose
--version
--wordexp
Shell options:
-irsD or -c command or -O shopt_option (invocation only)
-abefhkmnptuvxBCHP or -o option
Type `sh -c "help set"' for more information about shell options.
Type `sh -c help' for more information about shell builtin commands.
Use the `bashbug' command to report bugs.
推荐答案
存在但不存在的空值的OS或shell级别的特性?
Is that because of the OS- or shell-level peculiarities of null existing but not existing at the same time?
由于您没有指定哪个操作系统或shell你正在使用,我们不可能说。我可以说是我试图在我的GNU / Linux系统上复制你的问题,并且不能:在我的系统上没有建立任何目标(使用 null
saflkjsaflkjdsa
没有区别)
Since you didn't specify which OS or shell you're using, it's impossible for us to say. All I can say is that I tried to replicate your problem on my GNU/Linux system and couldn't: on my system no targets were built in either case (using null
or saflkjsaflkjdsa
made no difference)
我怀疑你使用的是Windows;我有一个模糊的记忆, null
在Windows上是特殊的。但是,我不做Windows,所以我不能肯定地说。
My suspicion is you're using Windows; I have a vague recollection that null
is special somehow on Windows. But, I don't do Windows so I can't say for sure.
这篇关于GNU Make-终端规则和关键字“null”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!