Skip to content

Commit 4d99f93

Browse files
author
Sam Ravnborg
committed
kbuild: escape '#' in .target.cmd files
Commandlines are contained in the .<target>.cmd files and in case they contain a '#' char make see this as start of comment. Teach fixdep to escape the '#' char so make will assing the full commandline. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
1 parent f6333eb commit 4d99f93

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

scripts/basic/fixdep.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,22 @@ void usage(void)
130130
exit(1);
131131
}
132132

133+
/*
134+
* Print out the commandline prefixed with cmd_<target filename> :=
135+
* If commandline contains '#' escape with '\' so make to not see
136+
* the '#' as a start-of-comment symbol
137+
**/
133138
void print_cmdline(void)
134139
{
135-
printf("cmd_%s := %s\n\n", target, cmdline);
140+
char *p = cmdline;
141+
142+
printf("cmd_%s := ", target);
143+
for (; *p; p++) {
144+
if (*p == '#')
145+
printf("\\");
146+
printf("%c", *p);
147+
}
148+
printf("\n\n");
136149
}
137150

138151
char * str_config = NULL;

0 commit comments

Comments
 (0)