static int rule_run_command (const char *filename, unsigned long line_no, const char *name, char *p, char *q) {
- int is_quiet = state->quiet, is_ignoring_errors = 0;
char *new_cmds, *s;
+ int is_ignoring_errors = state->ignore_errors;
+ int is_quiet = state->quiet;
+ int should_execute = !state->dry_run;
+
*q = '\0';
new_cmds = xstrdup (p);
new_cmds = variable_expand_line ("<command-line>", 1, new_cmds);
s = new_cmds;
- while (isspace ((int) *s) || *s == '-' || *s == '@') {
+ while (isspace ((int) *s) || *s == '-' || *s == '@' || *s == '+') {
if (*s == '@') {
is_quiet = 1;
is_ignoring_errors = 1;
}
+ if (*s == '+') {
+ should_execute = 1;
+ }
+
s++;
}
printf ("%s\n", new_cmds);
}
- /*if (!dry_run) */{
+ if (should_execute) {
int error = system (s);
variable_add (xstrdup ("OS"), xstrdup (os_name), VAR_ORIGIN_FILE);
variable_add (xstrdup ("MAKE"), xstrdup (argv[0]), VAR_ORIGIN_FILE);
-<<<<<<< HEAD
#if defined (_WIN32) || defined (__WIN32__)
variable_add (xstrdup ("SHELL"), xstrdup ("sh.exe"), VAR_ORIGIN_FILE);
#else
variable_add (xstrdup ("SHELL"), xstrdup ("/bin/sh"), VAR_ORIGIN_FILE);
#endif
-=======
->>>>>>> parent of 8f81312 (More support)
state = xmalloc (sizeof (*state));
parse_args (argv, argc);
{
- char *cwd, *path;
- size_t len;
+ char *path, *cwd = get_current_directory ();
- cwd = get_current_directory ();
- len = strlen ("CURDIR") + 4 + strlen (cwd);
-
- path = xmalloc (len + 1);
+ path = xmalloc (strlen ("CURDIR") + 4 + strlen (cwd) + 1);
sprintf (path, "CURDIR ?= %s", cwd);
parse_var_line ("<command-line>", 1, path, VAR_ORIGIN_FILE);
free (path);
- len = strlen (".CURDIR") + 4 + strlen (cwd);
-
- path = xmalloc (len + 1);
+ path = xmalloc (strlen (".CURDIR") + 4 + strlen (cwd) + 1);
sprintf (path, ".CURDIR ?= %s", cwd);
parse_var_line ("<command-line>", 1, path, VAR_ORIGIN_FILE);