scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit a634a8aae32973212f1253c8b5d2c0774909ba8e
parent da945663b43626a3053fe0db258fb7e356e30bc4
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 17 Jan 2024 13:22:56 +0100

make: Fig ignore rule behaviour

The order of the parameters was wrong in several cases
and it was updated to follow the same convention in all
the involved functions. Also, the argv[0] parameter  of
launched programs was wrong due to a +1 error.

Diffstat:
Msrc/cmd/make/posix.c | 4+++-
Msrc/cmd/make/rules.c | 20++++++++++++--------
2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/cmd/make/posix.c b/src/cmd/make/posix.c @@ -35,7 +35,9 @@ launch(char *cmd, int ignore) if (!ignore) args[1] = "-c"; - if ((name = strrchr(shell, '/')) == NULL) + if ((name = strrchr(shell, '/')) != NULL) + ++name; + else name = shell; args[0] = name; execve(shell, args, environ); diff --git a/src/cmd/make/rules.c b/src/cmd/make/rules.c @@ -208,13 +208,13 @@ out_loop: r = launch(s, ignore); if (ignore) - return 1; + return 0; return r; } static int -touch(char *name, int silence, int ignore) +touch(char *name, int ignore, int silence) { char *cmd; int r, n; @@ -236,7 +236,7 @@ touch(char *name, int silence, int ignore) } static int -touchdeps(Target *tp, int silent, int ignore) +touchdeps(Target *tp, int ignore, int silent) { int r; Target **p; @@ -266,27 +266,31 @@ run(Target *tp) silent = 0; p = lookup(".SILENT"); for (q = p->deps; q && *q; ++q) { - if (strcmp((*q)->name, tp->name) == 0) + if (strcmp((*q)->name, tp->name) == 0) { + debug("target %s error silent by .SILENT", tp->name); silent = 1; + } } ignore = 0; p = lookup(".IGNORE"); for (q = p->deps; q && *q; ++q) { - if (strcmp((*q)->name, tp->name) == 0) + if (strcmp((*q)->name, tp->name) == 0) { + debug("target %s error ignored by .IGNORE", tp->name); ignore = 1; + } } err = 0; if (tflag) { - r = touchdeps(tp, silent, ignore); + r = touchdeps(tp, ignore, silent); if (r) return r; } for (i = 0; i < tp->nactions; i++) { s = expandstring(tp->actions[i], tp); - r = execline(tp, s, silent, ignore); + r = execline(tp, s, ignore, silent); free(s); if (r) @@ -294,7 +298,7 @@ run(Target *tp) } if (tflag) { - r = touch(tp->name, silent, ignore); + r = touch(tp->name, ignore, silent); if (r) return r; }