>背景
这与我的问题 GNU make 有关 - 将每个先决条件转换为目标(隐式)
我发布了这个问题,因为它很有趣并且本身可能很有用 - 理解make
- 我不希望它迷失在"原始"问题中。
信息
我有一个文件Dummy.mk
:
%:: null
@:
null:
@:
我把它作为make all MAKEFILES=Dummy.mk
传递给我的make
.
当我用saflkjsaflkjdsa
替换null
时,
%:: saflkjsaflkjdsa
@:
saflkjsaflkjdsa:
@:
构建的行为是不同的:规则从未执行。
原因是因为这是一个"终端规则":
一种选择是通过定义将匹配任何规则标记为终端 它带有双冒号。当规则为终端时,它不适用 除非其先决条件确实存在。可能的先决条件 用其他隐含规则制定的还不够好。换句话说,没有 允许在终端规则之外进一步链接。
由于saflkjsaflkjdsa
不存在,因此未执行该规则。好吧,我明白了。
但是当我使用关键字设置Dummy.mk
时null
%:: null
@:
null:
@:
%::
规则确实执行,即它捕获所有目标、文件名等,为我提供表单:2: update target <item> due to: null
的输出,其中<item>
是make
读取的任何文件名或目标。
由于该规则使用 null
而不是使用 saflkjsaflkjdsa
执行,因此make
肯定会将null
检测为"存在"。
问题
但是为什么我仍然得到输出:5: target 'null' does not exist
?
这是因为null
存在但同时不存在的操作系统或外壳级特性吗?
环境
* 视窗 8,64 位
* 制作 4.2.1(这是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
内部使用的外壳是:
C:UsersUser1DesktopAProjectbldarmle-v7releasesubProj>where sh
C:/Users/User1/Desktop/A/QNX_SDK/host/win32/x86/usr/bin/sh.exe
C:UsersUser1DesktopAProjectbldarmle-v7releasesubProj>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.
这是因为空存在但同时不存在的操作系统或 shell 级别的特性吗?
由于您没有指定您正在使用哪个操作系统或 shell,因此我们无法说。 我只能说我试图在我的 GNU/Linux 系统上复制你的问题,但不能:在我的系统上,这两种情况下都没有构建目标(使用 null
或saflkjsaflkjdsa
没有区别)
我怀疑你正在使用Windows;我有一个模糊的记忆,null
在Windows上是特别的。 但是,我不做Windows,所以我不能肯定地说。