summaryrefslogtreecommitdiff
path: root/usr.bin/make/engine.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/make/engine.c')
-rw-r--r--usr.bin/make/engine.c48
1 files changed, 40 insertions, 8 deletions
diff --git a/usr.bin/make/engine.c b/usr.bin/make/engine.c
index db622180df5..ff5c70f5092 100644
--- a/usr.bin/make/engine.c
+++ b/usr.bin/make/engine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: engine.c,v 1.35 2012/10/04 13:20:46 espie Exp $ */
+/* $OpenBSD: engine.c,v 1.36 2012/10/06 09:32:40 espie Exp $ */
/*
* Copyright (c) 2012 Marc Espie.
*
@@ -99,6 +99,24 @@ static void setup_engine(void);
static char **recheck_command_for_shell(char **);
static void list_parents(GNode *, FILE *);
+/* XXX due to a bug in make's logic, targets looking like *.a or -l*
+ * have been silently dropped when make couldn't figure them out.
+ * Now, we warn about them until all Makefile bugs have been fixed.
+ */
+static bool
+drop_silently(const char *s)
+{
+ size_t len;
+
+ if (s[0] == '-' && s[1] == 'l')
+ return true;
+
+ len = strlen(s);
+ if (len >=2 && s[len-2] == '.' && s[len-1] == 'a')
+ return true;
+ return false;
+}
+
bool
node_find_valid_commands(GNode *gn)
{
@@ -111,11 +129,10 @@ node_find_valid_commands(GNode *gn)
gn->type |= OP_SILENT;
if (OP_NOP(gn->type) && Lst_IsEmpty(&gn->commands)) {
- /* XXX */
- if ((gn->type & OP_LIB)) {
+ if (drop_silently(gn->name)) {
printf("Warning: target %s", gn->name);
list_parents(gn, stdout);
- printf(" does not have any command\n");
+ printf(" does not have any command (BUG)\n");
return true;
}
/*
@@ -586,11 +603,22 @@ job_attach_node(Job *job, GNode *node)
job->exit_type = JOB_EXIT_OKAY;
job->location = NULL;
job->flags = 0;
+ job->sent_signal = 0;
}
void
job_handle_status(Job *job, int status)
{
+ bool silent;
+
+ /* if there's one job running and we don't keep going, no need
+ * to report right now.
+ */
+ if ((job->flags & JOB_ERRCHECK) && !keepgoing && runningJobs == NULL)
+ silent = !DEBUG(JOB);
+ else
+ silent = false;
+
debug_job_printf("Process %ld (%s) exited with status %d.\n",
(long)job->pid, job->node->name, status);
@@ -598,26 +626,30 @@ job_handle_status(Job *job, int status)
if (WIFEXITED(status)) {
job->code = WEXITSTATUS(status);/* exited */
if (status != 0) {
- printf("*** Error code %d", job->code);
+ if (!silent)
+ printf("*** Error %d", job->code);
job->exit_type = JOB_EXIT_BAD;
} else
job->exit_type = JOB_EXIT_OKAY;
} else {
job->exit_type = JOB_SIGNALED;
job->code = WTERMSIG(status); /* signaled */
- printf("*** Signal %d", job->code);
+ if (!silent)
+ printf("*** Signal %d", job->code);
}
/* if there is a problem, what's going on ? */
if (job->exit_type != JOB_EXIT_OKAY) {
- printf(" in target %s", job->node->name);
+ if (!silent)
+ printf(" in target '%s'", job->node->name);
if (job->flags & JOB_ERRCHECK) {
job->node->built_status = ERROR;
/* compute expensive status if we really want it */
if ((job->flags & JOB_SILENT) && job == &myjob)
determine_expensive_job(job);
if (!keepgoing) {
- printf("\n");
+ if (!silent)
+ printf("\n");
job->next = errorJobs;
errorJobs = job;
/* XXX don't free the command */