all:
sed \
's/111/222/g; \
s/333/444/g;' \
file_001 > file_002
$make
makefile:2: target 'all' does not exist
sed \
's/111/222/g; \
s/333/444/g;' \
file_001 > file_002
sed: -e expression #1, char 27: unterminated address regex
makefile:2: recipe for target 'all' failed
make: *** [all] Error 1
11 个解决方案
#1
后面的几行不要用tab。
#2
不行啊,一样
#3
搜“跟我一起写makefile”?
#4
能告诉我第几章第几节吗?
#5
搜“makefile 续行符”?
#6
我的例子里不是用了续行符吗?难道还有别的用法?阁下要是知道的话请直接告诉我。
#7
all:
sed \
's/111/222/g; \
s/333/444/g;' \
file_001 > file_002
#8
Commands in a Makefile
Home Page (Projects) | Overview (NMAKE Reference) | How Do I... Topics (Projects)
A description block or inference rule specifies a block of commands to run if the dependency is out-of-date. NMAKE displays each command before running it, unless /S, .SILENT, !CMDSWITCHES, or @ is used. NMAKE looks for a matching inference rule if a description block is not followed by a commands block.
A commands block contains one or more commands, each on its own line. No blank line can appear between the dependency or rule and the commands block. However, a line containing only spaces or tabs can appear; this line is interpreted as a null command, and no error occurs. Blank lines are permitted between command lines.
A command line begins with one or more spaces or tabs. A backslash ( \ ) followed by a newline character is interpreted as a space in the command; use a backslash at the end of a line to continue a command onto the next line. NMAKE interprets the backslash literally if any other character, including a space or tab, follows the backslash.
A command preceded by a semicolon (;) can appear on a dependency line or inference rule, whether or not a commands block follows:
What do you want to know more about?
Command modifiers
Filename-parts syntax
Inline files in a makefile
#9
这跟我一楼举的反例不是一样吗?
#10
使用-e 选项, 注意2,-4行头的空格
#11
#1
后面的几行不要用tab。
#2
后面的几行不要用tab。
不行啊,一样
#3
搜“跟我一起写makefile”?
#4
搜“跟我一起写makefile”?
能告诉我第几章第几节吗?
#5
搜“makefile 续行符”?
#6
搜“makefile 续行符”?
我的例子里不是用了续行符吗?难道还有别的用法?阁下要是知道的话请直接告诉我。
#7
all:
sed \
's/111/222/g; \
s/333/444/g;' \
file_001 > file_002
#8
Commands in a Makefile
Home Page (Projects) | Overview (NMAKE Reference) | How Do I... Topics (Projects)
A description block or inference rule specifies a block of commands to run if the dependency is out-of-date. NMAKE displays each command before running it, unless /S, .SILENT, !CMDSWITCHES, or @ is used. NMAKE looks for a matching inference rule if a description block is not followed by a commands block.
A commands block contains one or more commands, each on its own line. No blank line can appear between the dependency or rule and the commands block. However, a line containing only spaces or tabs can appear; this line is interpreted as a null command, and no error occurs. Blank lines are permitted between command lines.
A command line begins with one or more spaces or tabs. A backslash ( \ ) followed by a newline character is interpreted as a space in the command; use a backslash at the end of a line to continue a command onto the next line. NMAKE interprets the backslash literally if any other character, including a space or tab, follows the backslash.
A command preceded by a semicolon (;) can appear on a dependency line or inference rule, whether or not a commands block follows: