Mon 29 Sep 2008 06:43:03 PM UTC, original submission:
If make determines that the shell is "unixy", the generated shell script used to run a rule containing a continuation character will have one too many '\'s. For example, the following makefile fails:
all:
echo this is\
a test
because the generated "batch" file used to run the echo command above is:
echo this is\\
a test
This results in two commands being executed (by unixy shells); "echo" and "a". Clearly not what was intended.
The attached patch fixes this for me. Note the "DB (DB_JOBS" line is, of course, unnecessary but it's invaluable when trying to debug a BATCH_MODE_ONLY_SHELL configured make.
diff -Naur make-3.81,orig/job.c make-3.81/job.c
--- make-3.81,orig/job.c 2006-03-19 19:03:04.000000000 -0800
+++ make-3.81/job.c 2008-09-27 19:29:03.283931000 -0700
@@ -2733,7 +2733,7 @@
if (PRESERVE_BSNL)
{
*(ap++) = '\\';
- *(ap++) = '\\';
+ if (!batch_mode_shell) *(ap++) = '\\';
*(ap++) = '\n';
}
@@ -2799,6 +2799,9 @@
fputc ('\n', batch);
fclose (batch);
+ DB (DB_JOBS, (_("Batch file contents:%s\n\t%s\n"),
+ !unixy_shell ? "\n\t@echo off" : "", command_ptr));
+
/* create argv */
new_argv = (char *) xmalloc(3 sizeof (char *));
if (unixy_shell) {
|