compat.c revision 1.88 1 /* $NetBSD: compat.c,v 1.88 2012/06/05 17:31:04 sjg Exp $ */
2
3 /*
4 * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Adam de Boor.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 */
34
35 /*
36 * Copyright (c) 1988, 1989 by Adam de Boor
37 * Copyright (c) 1989 by Berkeley Softworks
38 * All rights reserved.
39 *
40 * This code is derived from software contributed to Berkeley by
41 * Adam de Boor.
42 *
43 * Redistribution and use in source and binary forms, with or without
44 * modification, are permitted provided that the following conditions
45 * are met:
46 * 1. Redistributions of source code must retain the above copyright
47 * notice, this list of conditions and the following disclaimer.
48 * 2. Redistributions in binary form must reproduce the above copyright
49 * notice, this list of conditions and the following disclaimer in the
50 * documentation and/or other materials provided with the distribution.
51 * 3. All advertising materials mentioning features or use of this software
52 * must display the following acknowledgement:
53 * This product includes software developed by the University of
54 * California, Berkeley and its contributors.
55 * 4. Neither the name of the University nor the names of its contributors
56 * may be used to endorse or promote products derived from this software
57 * without specific prior written permission.
58 *
59 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
60 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
61 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
62 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
63 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
64 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
65 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
66 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
67 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
68 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
69 * SUCH DAMAGE.
70 */
71
72 #ifndef MAKE_NATIVE
73 static char rcsid[] = "$NetBSD: compat.c,v 1.88 2012/06/05 17:31:04 sjg Exp $";
74 #else
75 #include <sys/cdefs.h>
76 #ifndef lint
77 #if 0
78 static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94";
79 #else
80 __RCSID("$NetBSD: compat.c,v 1.88 2012/06/05 17:31:04 sjg Exp $");
81 #endif
82 #endif /* not lint */
83 #endif
84
85 /*-
86 * compat.c --
87 * The routines in this file implement the full-compatibility
88 * mode of PMake. Most of the special functionality of PMake
89 * is available in this mode. Things not supported:
90 * - different shells.
91 * - friendly variable substitution.
92 *
93 * Interface:
94 * Compat_Run Initialize things for this module and recreate
95 * thems as need creatin'
96 */
97
98 #include <sys/types.h>
99 #include <sys/stat.h>
100 #include <sys/wait.h>
101
102 #include <ctype.h>
103 #include <errno.h>
104 #include <signal.h>
105 #include <stdio.h>
106
107 #include "make.h"
108 #include "hash.h"
109 #include "dir.h"
110 #include "job.h"
111 #include "pathnames.h"
112
113 /*
114 * The following array is used to make a fast determination of which
115 * characters are interpreted specially by the shell. If a command
116 * contains any of these characters, it is executed by the shell, not
117 * directly by us.
118 */
119
120 static char meta[256];
121
122 static GNode *curTarg = NULL;
123 static GNode *ENDNode;
124 static void CompatInterrupt(int) __dead;
125
126 static void
127 Compat_Init(void)
128 {
129 const char *cp;
130
131 Shell_Init(); /* setup default shell */
132
133 for (cp = "#=|^(){};&<>*?[]:$`\\\n"; *cp != '\0'; cp++) {
134 meta[(unsigned char) *cp] = 1;
135 }
136 /*
137 * The null character serves as a sentinel in the string.
138 */
139 meta[0] = 1;
140 }
141
142 /*-
143 *-----------------------------------------------------------------------
144 * CompatInterrupt --
145 * Interrupt the creation of the current target and remove it if
146 * it ain't precious.
147 *
148 * Results:
149 * None.
150 *
151 * Side Effects:
152 * The target is removed and the process exits. If .INTERRUPT exists,
153 * its commands are run first WITH INTERRUPTS IGNORED..
154 *
155 *-----------------------------------------------------------------------
156 */
157 static void
158 CompatInterrupt(int signo)
159 {
160 GNode *gn;
161
162 if ((curTarg != NULL) && !Targ_Precious (curTarg)) {
163 char *p1;
164 char *file = Var_Value(TARGET, curTarg, &p1);
165
166 if (!noExecute && eunlink(file) != -1) {
167 Error("*** %s removed", file);
168 }
169 if (p1)
170 free(p1);
171
172 /*
173 * Run .INTERRUPT only if hit with interrupt signal
174 */
175 if (signo == SIGINT) {
176 gn = Targ_FindNode(".INTERRUPT", TARG_NOCREATE);
177 if (gn != NULL) {
178 Compat_Make(gn, gn);
179 }
180 }
181
182 }
183 if (signo == SIGQUIT)
184 _exit(signo);
185 bmake_signal(signo, SIG_DFL);
186 kill(myPid, signo);
187 }
188
189 /*-
191 *-----------------------------------------------------------------------
192 * CompatRunCommand --
193 * Execute the next command for a target. If the command returns an
194 * error, the node's made field is set to ERROR and creation stops.
195 *
196 * Input:
197 * cmdp Command to execute
198 * gnp Node from which the command came
199 *
200 * Results:
201 * 0 if the command succeeded, 1 if an error occurred.
202 *
203 * Side Effects:
204 * The node's 'made' field may be set to ERROR.
205 *
206 *-----------------------------------------------------------------------
207 */
208 int
209 CompatRunCommand(void *cmdp, void *gnp)
210 {
211 char *cmdStart; /* Start of expanded command */
212 char *cp, *bp;
213 Boolean silent, /* Don't print command */
214 doIt; /* Execute even if -n */
215 volatile Boolean errCheck; /* Check errors */
216 int reason; /* Reason for child's death */
217 int status; /* Description of child's death */
218 pid_t cpid; /* Child actually found */
219 pid_t retstat; /* Result of wait */
220 LstNode cmdNode; /* Node where current command is located */
221 const char ** volatile av; /* Argument vector for thing to exec */
222 char ** volatile mav;/* Copy of the argument vector for freeing */
223 int argc; /* Number of arguments in av or 0 if not
224 * dynamically allocated */
225 Boolean local; /* TRUE if command should be executed
226 * locally */
227 Boolean useShell; /* TRUE if command should be executed
228 * using a shell */
229 char * volatile cmd = (char *)cmdp;
230 GNode *gn = (GNode *)gnp;
231
232 silent = gn->type & OP_SILENT;
233 errCheck = !(gn->type & OP_IGNORE);
234 doIt = FALSE;
235
236 cmdNode = Lst_Member(gn->commands, cmd);
237 cmdStart = Var_Subst(NULL, cmd, gn, FALSE);
238
239 /*
240 * brk_string will return an argv with a NULL in av[0], thus causing
241 * execvp to choke and die horribly. Besides, how can we execute a null
242 * command? In any case, we warn the user that the command expanded to
243 * nothing (is this the right thing to do?).
244 */
245
246 if (*cmdStart == '\0') {
247 free(cmdStart);
248 Error("%s expands to empty string", cmd);
249 return(0);
250 }
251 cmd = cmdStart;
252 Lst_Replace(cmdNode, cmdStart);
253
254 if ((gn->type & OP_SAVE_CMDS) && (gn != ENDNode)) {
255 (void)Lst_AtEnd(ENDNode->commands, cmdStart);
256 return(0);
257 }
258 if (strcmp(cmdStart, "...") == 0) {
259 gn->type |= OP_SAVE_CMDS;
260 return(0);
261 }
262
263 while ((*cmd == '@') || (*cmd == '-') || (*cmd == '+')) {
264 switch (*cmd) {
265 case '@':
266 silent = DEBUG(LOUD) ? FALSE : TRUE;
267 break;
268 case '-':
269 errCheck = FALSE;
270 break;
271 case '+':
272 doIt = TRUE;
273 if (!meta[0]) /* we came here from jobs */
274 Compat_Init();
275 break;
276 }
277 cmd++;
278 }
279
280 while (isspace((unsigned char)*cmd))
281 cmd++;
282
283 /*
284 * If we did not end up with a command, just skip it.
285 */
286 if (!*cmd)
287 return (0);
288
289 #if !defined(MAKE_NATIVE)
290 /*
291 * In a non-native build, the host environment might be weird enough
292 * that it's necessary to go through a shell to get the correct
293 * behaviour. Or perhaps the shell has been replaced with something
294 * that does extra logging, and that should not be bypassed.
295 */
296 useShell = TRUE;
297 #else
298 /*
299 * Search for meta characters in the command. If there are no meta
300 * characters, there's no need to execute a shell to execute the
301 * command.
302 */
303 for (cp = cmd; !meta[(unsigned char)*cp]; cp++) {
304 continue;
305 }
306 useShell = (*cp != '\0');
307 #endif
308
309 /*
310 * Print the command before echoing if we're not supposed to be quiet for
311 * this one. We also print the command if -n given.
312 */
313 if (!silent || NoExecute(gn)) {
314 printf("%s\n", cmd);
315 fflush(stdout);
316 }
317
318 /*
319 * If we're not supposed to execute any commands, this is as far as
320 * we go...
321 */
322 if (!doIt && NoExecute(gn)) {
323 return (0);
324 }
325 if (DEBUG(JOB))
326 fprintf(debug_file, "Execute: '%s'\n", cmd);
327
328 again:
329 if (useShell) {
330 /*
331 * We need to pass the command off to the shell, typically
332 * because the command contains a "meta" character.
333 */
334 static const char *shargv[4];
335
336 shargv[0] = shellPath;
337 /*
338 * The following work for any of the builtin shell specs.
339 */
340 if (DEBUG(SHELL))
341 shargv[1] = "-xc";
342 else
343 shargv[1] = "-c";
344 shargv[2] = cmd;
345 shargv[3] = NULL;
346 av = shargv;
347 argc = 0;
348 bp = NULL;
349 mav = NULL;
350 } else {
351 /*
352 * No meta-characters, so no need to exec a shell. Break the command
353 * into words to form an argument vector we can execute.
354 */
355 mav = brk_string(cmd, &argc, TRUE, &bp);
356 if (mav == NULL) {
357 useShell = 1;
358 goto again;
359 }
360 av = (void *)mav;
361 }
362
363 local = TRUE;
364
365 #ifdef USE_META
366 if (useMeta) {
367 meta_compat_start();
368 }
369 #endif
370
371 /*
372 * Fork and execute the single command. If the fork fails, we abort.
373 */
374 cpid = vFork();
375 if (cpid < 0) {
376 Fatal("Could not fork");
377 }
378 if (cpid == 0) {
379 Check_Cwd(av);
380 Var_ExportVars();
381 #ifdef USE_META
382 if (useMeta) {
383 meta_compat_child();
384 }
385 #endif
386 if (local)
387 (void)execvp(av[0], (char *const *)UNCONST(av));
388 else
389 (void)execv(av[0], (char *const *)UNCONST(av));
390 execError("exec", av[0]);
391 _exit(1);
392 }
393 if (mav)
394 free(mav);
395 if (bp)
396 free(bp);
397 Lst_Replace(cmdNode, NULL);
398
399 #ifdef USE_META
400 if (useMeta) {
401 meta_compat_parent();
402 }
403 #endif
404
405 /*
406 * The child is off and running. Now all we can do is wait...
407 */
408 while (1) {
409
410 while ((retstat = wait(&reason)) != cpid) {
411 if (retstat > 0)
412 JobReapChild(retstat, reason, FALSE); /* not ours? */
413 if (retstat == -1 && errno != EINTR) {
414 break;
415 }
416 }
417
418 if (retstat > -1) {
419 if (WIFSTOPPED(reason)) {
420 status = WSTOPSIG(reason); /* stopped */
421 } else if (WIFEXITED(reason)) {
422 status = WEXITSTATUS(reason); /* exited */
423 #if defined(USE_META) && defined(USE_FILEMON_ONCE)
424 if (useMeta) {
425 meta_cmd_finish(NULL);
426 }
427 #endif
428 if (status != 0) {
429 if (DEBUG(ERROR)) {
430 fprintf(debug_file, "\n*** Failed target: %s\n*** Failed command: ",
431 gn->name);
432 for (cp = cmd; *cp; ) {
433 if (isspace((unsigned char)*cp)) {
434 fprintf(debug_file, " ");
435 while (isspace((unsigned char)*cp))
436 cp++;
437 } else {
438 fprintf(debug_file, "%c", *cp);
439 cp++;
440 }
441 }
442 fprintf(debug_file, "\n");
443 }
444 printf("*** Error code %d", status);
445 }
446 } else {
447 status = WTERMSIG(reason); /* signaled */
448 printf("*** Signal %d", status);
449 }
450
451
452 if (!WIFEXITED(reason) || (status != 0)) {
453 if (errCheck) {
454 #ifdef USE_META
455 if (useMeta) {
456 meta_job_error(NULL, gn, 0, status);
457 }
458 #endif
459 gn->made = ERROR;
460 if (keepgoing) {
461 /*
462 * Abort the current target, but let others
463 * continue.
464 */
465 printf(" (continuing)\n");
466 }
467 } else {
468 /*
469 * Continue executing commands for this target.
470 * If we return 0, this will happen...
471 */
472 printf(" (ignored)\n");
473 status = 0;
474 }
475 }
476 break;
477 } else {
478 Fatal("error in wait: %d: %s", retstat, strerror(errno));
479 /*NOTREACHED*/
480 }
481 }
482 free(cmdStart);
483
484 return (status);
485 }
486
487 /*-
489 *-----------------------------------------------------------------------
490 * Compat_Make --
491 * Make a target.
492 *
493 * Input:
494 * gnp The node to make
495 * pgnp Parent to abort if necessary
496 *
497 * Results:
498 * 0
499 *
500 * Side Effects:
501 * If an error is detected and not being ignored, the process exits.
502 *
503 *-----------------------------------------------------------------------
504 */
505 int
506 Compat_Make(void *gnp, void *pgnp)
507 {
508 GNode *gn = (GNode *)gnp;
509 GNode *pgn = (GNode *)pgnp;
510
511 if (!meta[0]) /* we came here from jobs */
512 Compat_Init();
513 if (gn->made == UNMADE && (gn == pgn || (pgn->type & OP_MADE) == 0)) {
514 /*
515 * First mark ourselves to be made, then apply whatever transformations
516 * the suffix module thinks are necessary. Once that's done, we can
517 * descend and make all our children. If any of them has an error
518 * but the -k flag was given, our 'make' field will be set FALSE again.
519 * This is our signal to not attempt to do anything but abort our
520 * parent as well.
521 */
522 gn->flags |= REMAKE;
523 gn->made = BEINGMADE;
524 if ((gn->type & OP_MADE) == 0)
525 Suff_FindDeps(gn);
526 Lst_ForEach(gn->children, Compat_Make, gn);
527 if ((gn->flags & REMAKE) == 0) {
528 gn->made = ABORTED;
529 pgn->flags &= ~REMAKE;
530 goto cohorts;
531 }
532
533 if (Lst_Member(gn->iParents, pgn) != NULL) {
534 char *p1;
535 Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn, 0);
536 if (p1)
537 free(p1);
538 }
539
540 /*
541 * All the children were made ok. Now cmgn->mtime contains the
542 * modification time of the newest child, we need to find out if we
543 * exist and when we were modified last. The criteria for datedness
544 * are defined by the Make_OODate function.
545 */
546 if (DEBUG(MAKE)) {
547 fprintf(debug_file, "Examining %s...", gn->name);
548 }
549 if (! Make_OODate(gn)) {
550 gn->made = UPTODATE;
551 if (DEBUG(MAKE)) {
552 fprintf(debug_file, "up-to-date.\n");
553 }
554 goto cohorts;
555 } else if (DEBUG(MAKE)) {
556 fprintf(debug_file, "out-of-date.\n");
557 }
558
559 /*
560 * If the user is just seeing if something is out-of-date, exit now
561 * to tell him/her "yes".
562 */
563 if (queryFlag) {
564 exit(1);
565 }
566
567 /*
568 * We need to be re-made. We also have to make sure we've got a $?
569 * variable. To be nice, we also define the $> variable using
570 * Make_DoAllVar().
571 */
572 Make_DoAllVar(gn);
573
574 /*
575 * Alter our type to tell if errors should be ignored or things
576 * should not be printed so CompatRunCommand knows what to do.
577 */
578 if (Targ_Ignore(gn)) {
579 gn->type |= OP_IGNORE;
580 }
581 if (Targ_Silent(gn)) {
582 gn->type |= OP_SILENT;
583 }
584
585 if (Job_CheckCommands(gn, Fatal)) {
586 /*
587 * Our commands are ok, but we still have to worry about the -t
588 * flag...
589 */
590 if (!touchFlag || (gn->type & OP_MAKE)) {
591 curTarg = gn;
592 #ifdef USE_META
593 if (useMeta && !NoExecute(gn)) {
594 meta_job_start(NULL, gn);
595 }
596 #endif
597 Lst_ForEach(gn->commands, CompatRunCommand, gn);
598 curTarg = NULL;
599 } else {
600 Job_Touch(gn, gn->type & OP_SILENT);
601 }
602 } else {
603 gn->made = ERROR;
604 }
605 #ifdef USE_META
606 if (useMeta && !NoExecute(gn)) {
607 meta_job_finish(NULL);
608 }
609 #endif
610
611 if (gn->made != ERROR) {
612 /*
613 * If the node was made successfully, mark it so, update
614 * its modification time and timestamp all its parents. Note
615 * that for .ZEROTIME targets, the timestamping isn't done.
616 * This is to keep its state from affecting that of its parent.
617 */
618 gn->made = MADE;
619 pgn->flags |= Make_Recheck(gn) == 0 ? FORCE : 0;
620 if (!(gn->type & OP_EXEC)) {
621 pgn->flags |= CHILDMADE;
622 Make_TimeStamp(pgn, gn);
623 }
624 } else if (keepgoing) {
625 pgn->flags &= ~REMAKE;
626 } else {
627 PrintOnError(gn, "\n\nStop.");
628 exit(1);
629 }
630 } else if (gn->made == ERROR) {
631 /*
632 * Already had an error when making this beastie. Tell the parent
633 * to abort.
634 */
635 pgn->flags &= ~REMAKE;
636 } else {
637 if (Lst_Member(gn->iParents, pgn) != NULL) {
638 char *p1;
639 Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn, 0);
640 if (p1)
641 free(p1);
642 }
643 switch(gn->made) {
644 case BEINGMADE:
645 Error("Graph cycles through %s", gn->name);
646 gn->made = ERROR;
647 pgn->flags &= ~REMAKE;
648 break;
649 case MADE:
650 if ((gn->type & OP_EXEC) == 0) {
651 pgn->flags |= CHILDMADE;
652 Make_TimeStamp(pgn, gn);
653 }
654 break;
655 case UPTODATE:
656 if ((gn->type & OP_EXEC) == 0) {
657 Make_TimeStamp(pgn, gn);
658 }
659 break;
660 default:
661 break;
662 }
663 }
664
665 cohorts:
666 Lst_ForEach(gn->cohorts, Compat_Make, pgnp);
667 return (0);
668 }
669
670 /*-
672 *-----------------------------------------------------------------------
673 * Compat_Run --
674 * Initialize this mode and start making.
675 *
676 * Input:
677 * targs List of target nodes to re-create
678 *
679 * Results:
680 * None.
681 *
682 * Side Effects:
683 * Guess what?
684 *
685 *-----------------------------------------------------------------------
686 */
687 void
688 Compat_Run(Lst targs)
689 {
690 GNode *gn = NULL;/* Current root target */
691 int errors; /* Number of targets not remade due to errors */
692
693 Compat_Init();
694
695 if (bmake_signal(SIGINT, SIG_IGN) != SIG_IGN) {
696 bmake_signal(SIGINT, CompatInterrupt);
697 }
698 if (bmake_signal(SIGTERM, SIG_IGN) != SIG_IGN) {
699 bmake_signal(SIGTERM, CompatInterrupt);
700 }
701 if (bmake_signal(SIGHUP, SIG_IGN) != SIG_IGN) {
702 bmake_signal(SIGHUP, CompatInterrupt);
703 }
704 if (bmake_signal(SIGQUIT, SIG_IGN) != SIG_IGN) {
705 bmake_signal(SIGQUIT, CompatInterrupt);
706 }
707
708 ENDNode = Targ_FindNode(".END", TARG_CREATE);
709 ENDNode->type = OP_SPECIAL;
710 /*
711 * If the user has defined a .BEGIN target, execute the commands attached
712 * to it.
713 */
714 if (!queryFlag) {
715 gn = Targ_FindNode(".BEGIN", TARG_NOCREATE);
716 if (gn != NULL) {
717 Compat_Make(gn, gn);
718 if (gn->made == ERROR) {
719 PrintOnError(gn, "\n\nStop.");
720 exit(1);
721 }
722 }
723 }
724
725 /*
726 * Expand .USE nodes right now, because they can modify the structure
727 * of the tree.
728 */
729 Make_ExpandUse(targs);
730
731 /*
732 * For each entry in the list of targets to create, call Compat_Make on
733 * it to create the thing. Compat_Make will leave the 'made' field of gn
734 * in one of several states:
735 * UPTODATE gn was already up-to-date
736 * MADE gn was recreated successfully
737 * ERROR An error occurred while gn was being created
738 * ABORTED gn was not remade because one of its inferiors
739 * could not be made due to errors.
740 */
741 errors = 0;
742 while (!Lst_IsEmpty (targs)) {
743 gn = (GNode *)Lst_DeQueue(targs);
744 Compat_Make(gn, gn);
745
746 if (gn->made == UPTODATE) {
747 printf("`%s' is up to date.\n", gn->name);
748 } else if (gn->made == ABORTED) {
749 printf("`%s' not remade because of errors.\n", gn->name);
750 errors += 1;
751 }
752 }
753
754 /*
755 * If the user has defined a .END target, run its commands.
756 */
757 if (errors == 0) {
758 Compat_Make(ENDNode, ENDNode);
759 if (gn->made == ERROR) {
760 PrintOnError(gn, "\n\nStop.");
761 exit(1);
762 }
763 }
764 }
765